2544 lines
3.9 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var Cwr=Object.create;var m6=Object.defineProperty;var Owr=Object.getOwnPropertyDescriptor;var Ewr=Object.getOwnPropertyNames;var Pwr=Object.getPrototypeOf,Twr=Object.prototype.hasOwnProperty;var FGe=t=>{throw TypeError(t)};var Awr=(t,e,r)=>e in t?m6(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var b=(t,e)=>()=>(t&&(e=t(t=0)),e);var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),as=(t,e)=>{for(var r in e)m6(t,r,{get:e[r],enumerable:!0})},kGe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ewr(e))!Twr.call(t,o)&&o!==r&&m6(t,o,{get:()=>e[o],enumerable:!(n=Owr(e,o))||n.enumerable});return t};var j=(t,e,r)=>(r=t!=null?Cwr(Pwr(t)):{},kGe(e||!t||!t.__esModule?m6(r,"default",{value:t,enumerable:!0}):r,t)),jc=t=>kGe(m6({},"__esModule",{value:!0}),t);var bd=(t,e,r)=>Awr(t,typeof e!="symbol"?e+"":e,r),Iwr=(t,e,r)=>e.has(t)||FGe("Cannot "+r);var Mwe=(t,e,r)=>e.has(t)?FGe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var $Ge=(t,e,r)=>(Iwr(t,e,"access private method"),r);function Rwe(){if(!DX&&(DX=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!DX))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return DX(Mwr)}var DX,Mwr,BGe=b(()=>{Mwr=new Uint8Array(16)});function zGe(t,e=0){return _d[t[e+0]]+_d[t[e+1]]+_d[t[e+2]]+_d[t[e+3]]+"-"+_d[t[e+4]]+_d[t[e+5]]+"-"+_d[t[e+6]]+_d[t[e+7]]+"-"+_d[t[e+8]]+_d[t[e+9]]+"-"+_d[t[e+10]]+_d[t[e+11]]+_d[t[e+12]]+_d[t[e+13]]+_d[t[e+14]]+_d[t[e+15]]}var _d,UGe=b(()=>{_d=[];for(let t=0;t<256;++t)_d.push((t+256).toString(16).slice(1))});var Rwr,Nwe,qGe=b(()=>{Rwr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Nwe={randomUUID:Rwr}});function Nwr(t,e,r){if(Nwe.randomUUID&&!e&&!t)return Nwe.randomUUID();t=t||{};let n=t.random||(t.rng||Rwe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(let o=0;o<16;++o)e[r+o]=n[o];return e}return zGe(n)}var mm,HGe=b(()=>{qGe();BGe();UGe();mm=Nwr});var ZN=b(()=>{HGe()});var Gn,jwe,bt,wv,h6=b(()=>{(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Gn||(Gn={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(jwe||(jwe={}));bt=Gn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wv=t=>{switch(typeof t){case"undefined":return bt.undefined;case"string":return bt.string;case"number":return Number.isNaN(t)?bt.nan:bt.number;case"boolean":return bt.boolean;case"function":return bt.function;case"bigint":return bt.bigint;case"symbol":return bt.symbol;case"object":return Array.isArray(t)?bt.array:t===null?bt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?bt.promise:typeof Map<"u"&&t instanceof Map?bt.map:typeof Set<"u"&&t instanceof Set?bt.set:typeof Date<"u"&&t instanceof Date?bt.date:bt.object;default:return bt.unknown}}});var ke,jwr,hm,LX=b(()=>{h6();ke=Gn.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"]),jwr=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),hm=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let l=a.path[u];u===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],u++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Gn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};hm.create=t=>new hm(t)});var Dwr,pE,Dwe=b(()=>{LX();h6();Dwr=(t,e)=>{let r;switch(t.code){case ke.invalid_type:t.received===bt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case ke.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Gn.jsonStringifyReplacer)}`;break;case ke.unrecognized_keys:r=`Unrecognized key(s) in object: ${Gn.joinValues(t.keys,", ")}`;break;case ke.invalid_union:r="Invalid input";break;case ke.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Gn.joinValues(t.options)}`;break;case ke.invalid_enum_value:r=`Invalid enum value. Expected ${Gn.joinValues(t.options)}, received '${t.received}'`;break;case ke.invalid_arguments:r="Invalid function arguments";break;case ke.invalid_return_type:r="Invalid function return type";break;case ke.invalid_date:r="Invalid date";break;case ke.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Gn.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case ke.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case ke.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case ke.custom:r="Invalid input";break;case ke.invalid_intersection_types:r="Intersection results could not be merged";break;case ke.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case ke.not_finite:r="Number must be finite";break;default:r=e.defaultError,Gn.assertNever(t)}return{message:r}},pE=Dwr});function Lwr(t){VGe=t}function fB(){return VGe}var VGe,FX=b(()=>{Dwe();VGe=pE});function ut(t,e){let r=fB(),n=g6({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===pE?void 0:pE].filter(o=>!!o)});t.common.issues.push(n)}var g6,Fwr,vd,_r,YN,Sf,kX,$X,LA,pB,Lwe=b(()=>{FX();Dwe();g6=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",u=n.filter(l=>!!l).slice().reverse();for(let l of u)s=l(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}},Fwr=[];vd=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return _r;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return _r;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}},_r=Object.freeze({status:"aborted"}),YN=t=>({status:"dirty",value:t}),Sf=t=>({status:"valid",value:t}),kX=t=>t.status==="aborted",$X=t=>t.status==="dirty",LA=t=>t.status==="valid",pB=t=>typeof Promise<"u"&&t instanceof Promise});var WGe=b(()=>{});var Vt,KGe=b(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Vt||(Vt={}))});function ln(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}function YGe(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function e0r(t){return new RegExp(`^${YGe(t)}$`)}function XGe(t){let e=`${ZGe}T${YGe(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function t0r(t,e){return!!((e==="v4"||!e)&&Kwr.test(t)||(e==="v6"||!e)&&Jwr.test(t))}function r0r(t,e){if(!qwr.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function n0r(t,e){return!!((e==="v4"||!e)&&Gwr.test(t)||(e==="v6"||!e)&&Zwr.test(t))}function o0r(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}function mB(t){if(t instanceof ym){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=gm.create(mB(n))}return new ym({...t._def,shape:()=>e})}else return t instanceof gE?new gE({...t._def,type:mB(t.element)}):t instanceof gm?gm.create(mB(t.unwrap())):t instanceof Sv?Sv.create(mB(t.unwrap())):t instanceof xv?xv.create(t.items.map(e=>mB(e))):t}function kwe(t,e){let r=wv(t),n=wv(e);if(t===e)return{valid:!0,data:t};if(r===bt.object&&n===bt.object){let o=Gn.objectKeys(e),i=Gn.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=kwe(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===bt.array&&n===bt.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let a=t[i],s=e[i],u=kwe(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===bt.date&&n===bt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function QGe(t,e){return new uj({values:t,typeName:re.ZodEnum,...ln(e)})}function JGe(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function eJe(t,e={},r){return t?kA.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=JGe(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=JGe(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):kA.create()}var Lg,GGe,Pn,kwr,$wr,Bwr,zwr,Uwr,qwr,Hwr,Vwr,Wwr,Fwe,Kwr,Gwr,Jwr,Zwr,Ywr,Xwr,ZGe,Qwr,FA,XN,QN,ej,tj,hB,rj,nj,kA,hE,Rb,gB,gE,ym,oj,mE,BX,ij,xv,zX,yB,bB,UX,aj,sj,uj,lj,$A,Fg,gm,Sv,cj,dj,_B,i0r,y6,b6,fj,a0r,re,s0r,tJe,rJe,u0r,l0r,nJe,c0r,d0r,f0r,p0r,m0r,h0r,g0r,y0r,b0r,_0r,v0r,w0r,x0r,S0r,C0r,O0r,E0r,P0r,T0r,A0r,I0r,M0r,R0r,N0r,j0r,D0r,L0r,F0r,k0r,$0r,B0r,z0r,U0r,q0r,oJe=b(()=>{LX();FX();KGe();Lwe();h6();Lg=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},GGe=(t,e)=>{if(LA(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new hm(t.common.issues);return this._error=r,this._error}}};Pn=class{get description(){return this._def.description}_getType(e){return wv(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:wv(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new vd,ctx:{common:e.parent.common,data:e.data,parsedType:wv(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(pB(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wv(e)},o=this._parseSync({data:e,path:n.path,parent:n});return GGe(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wv(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return LA(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>LA(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wv(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(pB(o)?o:Promise.resolve(o));return GGe(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:ke.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new Fg({schema:this,typeName:re.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return gm.create(this,this._def)}nullable(){return Sv.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return gE.create(this)}promise(){return $A.create(this,this._def)}or(e){return oj.create([this,e],this._def)}and(e){return ij.create(this,e,this._def)}transform(e){return new Fg({...ln(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new cj({...ln(this._def),innerType:this,defaultValue:r,typeName:re.ZodDefault})}brand(){return new y6({typeName:re.ZodBranded,type:this,...ln(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new dj({...ln(this._def),innerType:this,catchValue:r,typeName:re.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return b6.create(this,e)}readonly(){return fj.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},kwr=/^c[^\s-]{8,}$/i,$wr=/^[0-9a-z]+$/,Bwr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zwr=/^[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,Uwr=/^[a-z0-9_-]{21}$/i,qwr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hwr=/^[-+]?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)?)??$/,Vwr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Wwr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Kwr=/^(?:(?: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])$/,Gwr=/^(?:(?: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])$/,Jwr=/^(([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]))$/,Zwr=/^(([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])$/,Ywr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xwr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ZGe="((\\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])))",Qwr=new RegExp(`^${ZGe}$`);FA=class t extends Pn{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==bt.string){let i=this._getOrReturnCtx(e);return ut(i,{code:ke.invalid_type,expected:bt.string,received:i.parsedType}),_r}let n=new vd,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),ut(o,{code:ke.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),ut(o,{code:ke.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?ut(o,{code:ke.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ut(o,{code:ke.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Vwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"email",code:ke.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Fwe||(Fwe=new RegExp(Wwr,"u")),Fwe.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"emoji",code:ke.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")zwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"uuid",code:ke.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Uwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"nanoid",code:ke.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")kwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"cuid",code:ke.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")$wr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"cuid2",code:ke.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Bwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"ulid",code:ke.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),ut(o,{validation:"url",code:ke.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"regex",code:ke.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),ut(o,{code:ke.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),ut(o,{code:ke.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),ut(o,{code:ke.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?XGe(i).test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{code:ke.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Qwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{code:ke.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?e0r(i).test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{code:ke.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Hwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"duration",code:ke.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?t0r(e.data,i.version)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"ip",code:ke.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?r0r(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"jwt",code:ke.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?n0r(e.data,i.version)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"cidr",code:ke.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Ywr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"base64",code:ke.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Xwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"base64url",code:ke.invalid_string,message:i.message}),n.dirty()):Gn.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:ke.invalid_string,...Vt.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Vt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Vt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Vt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Vt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Vt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Vt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Vt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Vt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Vt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Vt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Vt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Vt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Vt.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Vt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Vt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Vt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Vt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Vt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Vt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Vt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Vt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Vt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Vt.errToObj(r)})}nonempty(e){return this.min(1,Vt.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};FA.create=t=>new FA({checks:[],typeName:re.ZodString,coerce:t?.coerce??!1,...ln(t)});XN=class t extends Pn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==bt.number){let i=this._getOrReturnCtx(e);return ut(i,{code:ke.invalid_type,expected:bt.number,received:i.parsedType}),_r}let n,o=new vd;for(let i of this._def.checks)i.kind==="int"?Gn.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),ut(n,{code:ke.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),ut(n,{code:ke.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),ut(n,{code:ke.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?o0r(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),ut(n,{code:ke.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),ut(n,{code:ke.not_finite,message:i.message}),o.dirty()):Gn.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Vt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Vt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Vt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Vt.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Vt.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Vt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Vt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Vt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Vt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Vt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Vt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Vt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Vt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Vt.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Gn.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};XN.create=t=>new XN({checks:[],typeName:re.ZodNumber,coerce:t?.coerce||!1,...ln(t)});QN=class t extends Pn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==bt.bigint)return this._getInvalidInput(e);let n,o=new vd;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),ut(n,{code:ke.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),ut(n,{code:ke.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),ut(n,{code:ke.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Gn.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ut(r,{code:ke.invalid_type,expected:bt.bigint,received:r.parsedType}),_r}gte(e,r){return this.setLimit("min",e,!0,Vt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Vt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Vt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Vt.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Vt.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Vt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Vt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Vt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Vt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Vt.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};QN.create=t=>new QN({checks:[],typeName:re.ZodBigInt,coerce:t?.coerce??!1,...ln(t)});ej=class extends Pn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==bt.boolean){let n=this._getOrReturnCtx(e);return ut(n,{code:ke.invalid_type,expected:bt.boolean,received:n.parsedType}),_r}return Sf(e.data)}};ej.create=t=>new ej({typeName:re.ZodBoolean,coerce:t?.coerce||!1,...ln(t)});tj=class t extends Pn{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==bt.date){let i=this._getOrReturnCtx(e);return ut(i,{code:ke.invalid_type,expected:bt.date,received:i.parsedType}),_r}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return ut(i,{code:ke.invalid_date}),_r}let n=new vd,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),ut(o,{code:ke.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),ut(o,{code:ke.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Gn.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Vt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Vt.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};tj.create=t=>new tj({checks:[],coerce:t?.coerce||!1,typeName:re.ZodDate,...ln(t)});hB=class extends Pn{_parse(e){if(this._getType(e)!==bt.symbol){let n=this._getOrReturnCtx(e);return ut(n,{code:ke.invalid_type,expected:bt.symbol,received:n.parsedType}),_r}return Sf(e.data)}};hB.create=t=>new hB({typeName:re.ZodSymbol,...ln(t)});rj=class extends Pn{_parse(e){if(this._getType(e)!==bt.undefined){let n=this._getOrReturnCtx(e);return ut(n,{code:ke.invalid_type,expected:bt.undefined,received:n.parsedType}),_r}return Sf(e.data)}};rj.create=t=>new rj({typeName:re.ZodUndefined,...ln(t)});nj=class extends Pn{_parse(e){if(this._getType(e)!==bt.null){let n=this._getOrReturnCtx(e);return ut(n,{code:ke.invalid_type,expected:bt.null,received:n.parsedType}),_r}return Sf(e.data)}};nj.create=t=>new nj({typeName:re.ZodNull,...ln(t)});kA=class extends Pn{constructor(){super(...arguments),this._any=!0}_parse(e){return Sf(e.data)}};kA.create=t=>new kA({typeName:re.ZodAny,...ln(t)});hE=class extends Pn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Sf(e.data)}};hE.create=t=>new hE({typeName:re.ZodUnknown,...ln(t)});Rb=class extends Pn{_parse(e){let r=this._getOrReturnCtx(e);return ut(r,{code:ke.invalid_type,expected:bt.never,received:r.parsedType}),_r}};Rb.create=t=>new Rb({typeName:re.ZodNever,...ln(t)});gB=class extends Pn{_parse(e){if(this._getType(e)!==bt.undefined){let n=this._getOrReturnCtx(e);return ut(n,{code:ke.invalid_type,expected:bt.void,received:n.parsedType}),_r}return Sf(e.data)}};gB.create=t=>new gB({typeName:re.ZodVoid,...ln(t)});gE=class t extends Pn{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==bt.array)return ut(r,{code:ke.invalid_type,expected:bt.array,received:r.parsedType}),_r;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(ut(r,{code:a?ke.too_big:ke.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(ut(r,{code:ke.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(ut(r,{code:ke.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new Lg(r,a,r.path,s)))).then(a=>vd.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Lg(r,a,r.path,s)));return vd.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Vt.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Vt.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Vt.toString(r)}})}nonempty(e){return this.min(1,e)}};gE.create=(t,e)=>new gE({type:t,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray,...ln(e)});ym=class t extends Pn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Gn.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==bt.object){let l=this._getOrReturnCtx(e);return ut(l,{code:ke.invalid_type,expected:bt.object,received:l.parsedType}),_r}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Rb&&this._def.unknownKeys==="strip"))for(let l in o.data)a.includes(l)||s.push(l);let u=[];for(let l of a){let c=i[l],d=o.data[l];u.push({key:{status:"valid",value:l},value:c._parse(new Lg(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Rb){let l=this._def.unknownKeys;if(l==="passthrough")for(let c of s)u.push({key:{status:"valid",value:c},value:{status:"valid",value:o.data[c]}});else if(l==="strict")s.length>0&&(ut(o,{code:ke.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let c of s){let d=o.data[c];u.push({key:{status:"valid",value:c},value:l._parse(new Lg(o,d,o.path,c)),alwaysSet:c in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let c of u){let d=await c.key,f=await c.value;l.push({key:d,value:f,alwaysSet:c.alwaysSet})}return l}).then(l=>vd.mergeObjectSync(n,l)):vd.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Vt.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Vt.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:re.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Gn.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Gn.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return mB(this)}partial(e){let r={};for(let n of Gn.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Gn.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof gm;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return QGe(Gn.objectKeys(this.shape))}};ym.create=(t,e)=>new ym({shape:()=>t,unknownKeys:"strip",catchall:Rb.create(),typeName:re.ZodObject,...ln(e)});ym.strictCreate=(t,e)=>new ym({shape:()=>t,unknownKeys:"strict",catchall:Rb.create(),typeName:re.ZodObject,...ln(e)});ym.lazycreate=(t,e)=>new ym({shape:t,unknownKeys:"strip",catchall:Rb.create(),typeName:re.ZodObject,...ln(e)});oj=class extends Pn{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new hm(s.ctx.common.issues));return ut(r,{code:ke.invalid_union,unionErrors:a}),_r}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let u of n){let l={...r,common:{...r.common,issues:[]},parent:null},c=u._parseSync({data:r.data,path:r.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!i&&(i={result:c,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(u=>new hm(u));return ut(r,{code:ke.invalid_union,unionErrors:s}),_r}}get options(){return this._def.options}};oj.create=(t,e)=>new oj({options:t,typeName:re.ZodUnion,...ln(e)});mE=t=>t instanceof aj?mE(t.schema):t instanceof Fg?mE(t.innerType()):t instanceof sj?[t.value]:t instanceof uj?t.options:t instanceof lj?Gn.objectValues(t.enum):t instanceof cj?mE(t._def.innerType):t instanceof rj?[void 0]:t instanceof nj?[null]:t instanceof gm?[void 0,...mE(t.unwrap())]:t instanceof Sv?[null,...mE(t.unwrap())]:t instanceof y6||t instanceof fj?mE(t.unwrap()):t instanceof dj?mE(t._def.innerType):[],BX=class t extends Pn{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==bt.object)return ut(r,{code:ke.invalid_type,expected:bt.object,received:r.parsedType}),_r;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ut(r,{code:ke.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),_r)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=mE(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new t({typeName:re.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...ln(n)})}};ij=class extends Pn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(kX(i)||kX(a))return _r;let s=kwe(i.value,a.value);return s.valid?(($X(i)||$X(a))&&r.dirty(),{status:r.value,value:s.data}):(ut(n,{code:ke.invalid_intersection_types}),_r)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ij.create=(t,e,r)=>new ij({left:t,right:e,typeName:re.ZodIntersection,...ln(r)});xv=class t extends Pn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==bt.array)return ut(n,{code:ke.invalid_type,expected:bt.array,received:n.parsedType}),_r;if(n.data.length<this._def.items.length)return ut(n,{code:ke.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_r;!this._def.rest&&n.data.length>this._def.items.length&&(ut(n,{code:ke.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let u=this._def.items[s]||this._def.rest;return u?u._parse(new Lg(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>vd.mergeArray(r,a)):vd.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};xv.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xv({items:t,typeName:re.ZodTuple,rest:null,...ln(e)})};zX=class t extends Pn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==bt.object)return ut(n,{code:ke.invalid_type,expected:bt.object,received:n.parsedType}),_r;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Lg(n,s,n.path,s)),value:a._parse(new Lg(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?vd.mergeObjectAsync(r,o):vd.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Pn?new t({keyType:e,valueType:r,typeName:re.ZodRecord,...ln(n)}):new t({keyType:FA.create(),valueType:e,typeName:re.ZodRecord,...ln(r)})}},yB=class extends Pn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==bt.map)return ut(n,{code:ke.invalid_type,expected:bt.map,received:n.parsedType}),_r;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new Lg(n,s,n.path,[l,"key"])),value:i._parse(new Lg(n,u,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let u of a){let l=await u.key,c=await u.value;if(l.status==="aborted"||c.status==="aborted")return _r;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let u of a){let l=u.key,c=u.value;if(l.status==="aborted"||c.status==="aborted")return _r;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};yB.create=(t,e,r)=>new yB({valueType:e,keyType:t,typeName:re.ZodMap,...ln(r)});bB=class t extends Pn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==bt.set)return ut(n,{code:ke.invalid_type,expected:bt.set,received:n.parsedType}),_r;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ut(n,{code:ke.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(ut(n,{code:ke.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(u){let l=new Set;for(let c of u){if(c.status==="aborted")return _r;c.status==="dirty"&&r.dirty(),l.add(c.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((u,l)=>i._parse(new Lg(n,u,n.path,l)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:Vt.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Vt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};bB.create=(t,e)=>new bB({valueType:t,minSize:null,maxSize:null,typeName:re.ZodSet,...ln(e)});UX=class t extends Pn{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==bt.function)return ut(r,{code:ke.invalid_type,expected:bt.function,received:r.parsedType}),_r;function n(s,u){return g6({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,fB(),pE].filter(l=>!!l),issueData:{code:ke.invalid_arguments,argumentsError:u}})}function o(s,u){return g6({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,fB(),pE].filter(l=>!!l),issueData:{code:ke.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof $A){let s=this;return Sf(async function(...u){let l=new hm([]),c=await s._def.args.parseAsync(u,i).catch(p=>{throw l.addIssue(n(u,p)),l}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw l.addIssue(o(d,p)),l})})}else{let s=this;return Sf(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new hm([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new hm([o(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:xv.create(e).rest(hE.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||xv.create([]).rest(hE.create()),returns:r||hE.create(),typeName:re.ZodFunction,...ln(n)})}},aj=class extends Pn{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};aj.create=(t,e)=>new aj({getter:t,typeName:re.ZodLazy,...ln(e)});sj=class extends Pn{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ut(r,{received:r.data,code:ke.invalid_literal,expected:this._def.value}),_r}return{status:"valid",value:e.data}}get value(){return this._def.value}};sj.create=(t,e)=>new sj({value:t,typeName:re.ZodLiteral,...ln(e)});uj=class t extends Pn{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return ut(r,{expected:Gn.joinValues(n),received:r.parsedType,code:ke.invalid_type}),_r}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return ut(r,{received:r.data,code:ke.invalid_enum_value,options:n}),_r}return Sf(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};uj.create=QGe;lj=class extends Pn{_parse(e){let r=Gn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==bt.string&&n.parsedType!==bt.number){let o=Gn.objectValues(r);return ut(n,{expected:Gn.joinValues(o),received:n.parsedType,code:ke.invalid_type}),_r}if(this._cache||(this._cache=new Set(Gn.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=Gn.objectValues(r);return ut(n,{received:n.data,code:ke.invalid_enum_value,options:o}),_r}return Sf(e.data)}get enum(){return this._def.values}};lj.create=(t,e)=>new lj({values:t,typeName:re.ZodNativeEnum,...ln(e)});$A=class extends Pn{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==bt.promise&&r.common.async===!1)return ut(r,{code:ke.invalid_type,expected:bt.promise,received:r.parsedType}),_r;let n=r.parsedType===bt.promise?r.data:Promise.resolve(r.data);return Sf(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};$A.create=(t,e)=>new $A({type:t,typeName:re.ZodPromise,...ln(e)});Fg=class extends Pn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{ut(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return _r;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?_r:u.status==="dirty"?YN(u.value):r.value==="dirty"?YN(u.value):u});{if(r.value==="aborted")return _r;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?_r:s.status==="dirty"?YN(s.value):r.value==="dirty"?YN(s.value):s}}if(o.type==="refinement"){let a=s=>{let u=o.refinement(s,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?_r:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?_r:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!LA(a))return _r;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>LA(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):_r);Gn.assertNever(o)}};Fg.create=(t,e,r)=>new Fg({schema:t,typeName:re.ZodEffects,effect:e,...ln(r)});Fg.createWithPreprocess=(t,e,r)=>new Fg({schema:e,effect:{type:"preprocess",transform:t},typeName:re.ZodEffects,...ln(r)});gm=class extends Pn{_parse(e){return this._getType(e)===bt.undefined?Sf(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gm.create=(t,e)=>new gm({innerType:t,typeName:re.ZodOptional,...ln(e)});Sv=class extends Pn{_parse(e){return this._getType(e)===bt.null?Sf(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Sv.create=(t,e)=>new Sv({innerType:t,typeName:re.ZodNullable,...ln(e)});cj=class extends Pn{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===bt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};cj.create=(t,e)=>new cj({innerType:t,typeName:re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ln(e)});dj=class extends Pn{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return pB(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new hm(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new hm(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};dj.create=(t,e)=>new dj({innerType:t,typeName:re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ln(e)});_B=class extends Pn{_parse(e){if(this._getType(e)!==bt.nan){let n=this._getOrReturnCtx(e);return ut(n,{code:ke.invalid_type,expected:bt.nan,received:n.parsedType}),_r}return{status:"valid",value:e.data}}};_B.create=t=>new _B({typeName:re.ZodNaN,...ln(t)});i0r=Symbol("zod_brand"),y6=class extends Pn{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},b6=class t extends Pn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?_r:i.status==="dirty"?(r.dirty(),YN(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?_r:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:re.ZodPipeline})}},fj=class extends Pn{_parse(e){let r=this._def.innerType._parse(e),n=o=>(LA(o)&&(o.value=Object.freeze(o.value)),o);return pB(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};fj.create=(t,e)=>new fj({innerType:t,typeName:re.ZodReadonly,...ln(e)});a0r={object:ym.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(re||(re={}));s0r=(t,e={message:`Input not instance of ${t.name}`})=>eJe(r=>r instanceof t,e),tJe=FA.create,rJe=XN.create,u0r=_B.create,l0r=QN.create,nJe=ej.create,c0r=tj.create,d0r=hB.create,f0r=rj.create,p0r=nj.create,m0r=kA.create,h0r=hE.create,g0r=Rb.create,y0r=gB.create,b0r=gE.create,_0r=ym.create,v0r=ym.strictCreate,w0r=oj.create,x0r=BX.create,S0r=ij.create,C0r=xv.create,O0r=zX.create,E0r=yB.create,P0r=bB.create,T0r=UX.create,A0r=aj.create,I0r=sj.create,M0r=uj.create,R0r=lj.create,N0r=$A.create,j0r=Fg.create,D0r=gm.create,L0r=Sv.create,F0r=Fg.createWithPreprocess,k0r=b6.create,$0r=()=>tJe().optional(),B0r=()=>rJe().optional(),z0r=()=>nJe().optional(),U0r={string:t=>FA.create({...t,coerce:!0}),number:t=>XN.create({...t,coerce:!0}),boolean:t=>ej.create({...t,coerce:!0}),bigint:t=>QN.create({...t,coerce:!0}),date:t=>tj.create({...t,coerce:!0})},q0r=_r});var dt={};as(dt,{BRAND:()=>i0r,DIRTY:()=>YN,EMPTY_PATH:()=>Fwr,INVALID:()=>_r,NEVER:()=>q0r,OK:()=>Sf,ParseStatus:()=>vd,Schema:()=>Pn,ZodAny:()=>kA,ZodArray:()=>gE,ZodBigInt:()=>QN,ZodBoolean:()=>ej,ZodBranded:()=>y6,ZodCatch:()=>dj,ZodDate:()=>tj,ZodDefault:()=>cj,ZodDiscriminatedUnion:()=>BX,ZodEffects:()=>Fg,ZodEnum:()=>uj,ZodError:()=>hm,ZodFirstPartyTypeKind:()=>re,ZodFunction:()=>UX,ZodIntersection:()=>ij,ZodIssueCode:()=>ke,ZodLazy:()=>aj,ZodLiteral:()=>sj,ZodMap:()=>yB,ZodNaN:()=>_B,ZodNativeEnum:()=>lj,ZodNever:()=>Rb,ZodNull:()=>nj,ZodNullable:()=>Sv,ZodNumber:()=>XN,ZodObject:()=>ym,ZodOptional:()=>gm,ZodParsedType:()=>bt,ZodPipeline:()=>b6,ZodPromise:()=>$A,ZodReadonly:()=>fj,ZodRecord:()=>zX,ZodSchema:()=>Pn,ZodSet:()=>bB,ZodString:()=>FA,ZodSymbol:()=>hB,ZodTransformer:()=>Fg,ZodTuple:()=>xv,ZodType:()=>Pn,ZodUndefined:()=>rj,ZodUnion:()=>oj,ZodUnknown:()=>hE,ZodVoid:()=>gB,addIssueToContext:()=>ut,any:()=>m0r,array:()=>b0r,bigint:()=>l0r,boolean:()=>nJe,coerce:()=>U0r,custom:()=>eJe,date:()=>c0r,datetimeRegex:()=>XGe,defaultErrorMap:()=>pE,discriminatedUnion:()=>x0r,effect:()=>j0r,enum:()=>M0r,function:()=>T0r,getErrorMap:()=>fB,getParsedType:()=>wv,instanceof:()=>s0r,intersection:()=>S0r,isAborted:()=>kX,isAsync:()=>pB,isDirty:()=>$X,isValid:()=>LA,late:()=>a0r,lazy:()=>A0r,literal:()=>I0r,makeIssue:()=>g6,map:()=>E0r,nan:()=>u0r,nativeEnum:()=>R0r,never:()=>g0r,null:()=>p0r,nullable:()=>L0r,number:()=>rJe,object:()=>_0r,objectUtil:()=>jwe,oboolean:()=>z0r,onumber:()=>B0r,optional:()=>D0r,ostring:()=>$0r,pipeline:()=>k0r,preprocess:()=>F0r,promise:()=>N0r,quotelessJson:()=>jwr,record:()=>O0r,set:()=>P0r,setErrorMap:()=>Lwr,strictObject:()=>v0r,string:()=>tJe,symbol:()=>d0r,transformer:()=>j0r,tuple:()=>C0r,undefined:()=>f0r,union:()=>w0r,unknown:()=>h0r,util:()=>Gn,void:()=>y0r});var _6=b(()=>{FX();Lwe();WGe();h6();oJe();LX()});var qX=b(()=>{_6();_6()});var aJe=x((h7n,iJe)=>{function kg(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}iJe.exports=kg;kg.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};kg.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};kg.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return!1;var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r),this._options.unref&&this._timer.unref(),!0};kg.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};kg.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};kg.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};kg.prototype.start=kg.prototype.try;kg.prototype.errors=function(){return this._errors};kg.prototype.attempts=function(){return this._attempts};kg.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=o,r=a)}return e}});var sJe=x(pj=>{var H0r=aJe();pj.operation=function(t){var e=pj.timeouts(t);return new H0r(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};pj.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(i,a){return i-a}),n};pj.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};pj.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var o=0;o<r.length;o++){var i=r[o],a=t[i];t[i]=function(u){var l=pj.operation(e),c=Array.prototype.slice.call(arguments,1),d=c.pop();c.push(function(f){l.retry(f)||(f&&(arguments[0]=l.mainError()),d.apply(this,arguments))}),l.attempt(function(){u.apply(t,c)})}.bind(t,a),t[i].options=e}}});var lJe=x((y7n,uJe)=>{uJe.exports=sJe()});var WX=x((b7n,VX)=>{"use strict";var V0r=lJe(),W0r=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],HX=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},K0r=(t,e,r)=>{let n=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=n,t},G0r=t=>W0r.includes(t),cJe=(t,e)=>new Promise((r,n)=>{e={onFailedAttempt:()=>{},retries:10,...e};let o=V0r.operation(e);o.attempt(async i=>{try{r(await t(i))}catch(a){if(!(a instanceof Error)){n(new TypeError(`Non-error was thrown: "${a}". You should only throw errors.`));return}if(a instanceof HX)o.stop(),n(a.originalError);else if(a instanceof TypeError&&!G0r(a.message))o.stop(),n(a);else{K0r(a,i,e);try{await e.onFailedAttempt(a)}catch(s){n(s);return}o.retry(a)||n(o.mainError())}}})});VX.exports=cJe;VX.exports.default=cJe;VX.exports.AbortError=HX});var dJe,fJe=b(()=>{dJe=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});function J0r(t){return typeof t=="string"&&dJe.test(t)}var BA,$we=b(()=>{fJe();BA=J0r});function Z0r(t){if(!BA(t))throw TypeError("Invalid UUID");var e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}var pJe,mJe=b(()=>{$we();pJe=Z0r});function GX(t,e=0){return(wd[t[e+0]]+wd[t[e+1]]+wd[t[e+2]]+wd[t[e+3]]+"-"+wd[t[e+4]]+wd[t[e+5]]+"-"+wd[t[e+6]]+wd[t[e+7]]+"-"+wd[t[e+8]]+wd[t[e+9]]+"-"+wd[t[e+10]]+wd[t[e+11]]+wd[t[e+12]]+wd[t[e+13]]+wd[t[e+14]]+wd[t[e+15]]).toLowerCase()}var wd,KX,Bwe=b(()=>{wd=[];for(KX=0;KX<256;++KX)wd.push((KX+256).toString(16).slice(1))});function zwe(){if(!JX&&(JX=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!JX))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return JX(Y0r)}var JX,Y0r,hJe=b(()=>{Y0r=new Uint8Array(16)});function X0r(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}function Uwe(t,e,r){function n(o,i,a,s){var u;if(typeof o=="string"&&(o=X0r(o)),typeof i=="string"&&(i=pJe(i)),((u=i)===null||u===void 0?void 0:u.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var l=new Uint8Array(16+o.length);if(l.set(i),l.set(o,i.length),l=r(l),l[6]=l[6]&15|e,l[8]=l[8]&63|128,a){s=s||0;for(var c=0;c<16;++c)a[s+c]=l[c];return a}return GX(l)}try{n.name=t}catch{}return n.DNS=Q0r,n.URL=exr,n}var Q0r,exr,gJe=b(()=>{Bwe();mJe();Q0r="6ba7b810-9dad-11d1-80b4-00c04fd430c8",exr="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var txr,qwe,yJe=b(()=>{txr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),qwe={randomUUID:txr}});function rxr(t,e,r){if(qwe.randomUUID&&!e&&!t)return qwe.randomUUID();t=t||{};var n=t.random||(t.rng||zwe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return GX(n)}var Rs,bJe=b(()=>{yJe();hJe();Bwe();Rs=rxr});function nxr(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function Hwe(t,e){return t<<e|t>>>32-e}function oxr(t){var e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var n=unescape(encodeURIComponent(t));t=[];for(var o=0;o<n.length;++o)t.push(n.charCodeAt(o))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var i=t.length/4+2,a=Math.ceil(i/16),s=new Array(a),u=0;u<a;++u){for(var l=new Uint32Array(16),c=0;c<16;++c)l[c]=t[u*64+c*4]<<24|t[u*64+c*4+1]<<16|t[u*64+c*4+2]<<8|t[u*64+c*4+3];s[u]=l}s[a-1][14]=(t.length-1)*8/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=(t.length-1)*8&4294967295;for(var d=0;d<a;++d){for(var f=new Uint32Array(80),p=0;p<16;++p)f[p]=s[d][p];for(var m=16;m<80;++m)f[m]=Hwe(f[m-3]^f[m-8]^f[m-14]^f[m-16],1);for(var h=r[0],y=r[1],g=r[2],_=r[3],w=r[4],S=0;S<80;++S){var C=Math.floor(S/20),E=Hwe(h,5)+nxr(C,y,g,_)+w+e[C]+f[S]>>>0;w=_,_=g,g=Hwe(y,30)>>>0,y=h,h=E}r[0]=r[0]+h>>>0,r[1]=r[1]+y>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+_>>>0,r[4]=r[4]+w>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var _Je,vJe=b(()=>{_Je=oxr});var ixr,ZX,wJe=b(()=>{gJe();vJe();ixr=Uwe("v5",80,_Je),ZX=ixr});var mj=b(()=>{bJe();wJe();$we()});function xJe(t=!1){let e=sxr.getInstance().getStore();if(!t&&e===void 0)throw new Error(`Could not get the current run tree.
Please make sure you are calling this method within a traceable function and that tracing is enabled.`);return e}function YX(t){return typeof t=="function"&&"langsmith:traceable"in t}var Kwe,Wwe,axr,Gwe,sxr,z7n,SJe=b(()=>{Kwe=class{getStore(){}run(e,r){return r()}},Wwe=Symbol.for("ls:tracing_async_local_storage"),axr=new Kwe,Gwe=class{getInstance(){return globalThis[Wwe]??axr}initializeGlobalInstance(e){globalThis[Wwe]===void 0&&(globalThis[Wwe]=e)}},sxr=new Gwe;z7n=Symbol.for("langsmith:traceable:root")});var Jwe=b(()=>{SJe()});function QX(t,e){return uxr.call(t,e)}function eQ(t){if(Array.isArray(t)){let r=new Array(t.length);for(let n=0;n<r.length;n++)r[n]=""+n;return r}if(Object.keys)return Object.keys(t);let e=[];for(let r in t)QX(t,r)&&e.push(r);return e}function Cf(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function tQ(t){let e=0,r=t.length,n;for(;e<r;){if(n=t.charCodeAt(e),n>=48&&n<=57){e++;continue}return!1}return!0}function Cv(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function v6(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function XX(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(XX(t[r]))return!0}else if(typeof t=="object"){let r=eQ(t),n=r.length;for(var e=0;e<n;e++)if(XX(t[r[e]]))return!0}}return!1}function CJe(t,e){let r=[t];for(let n in e){let o=typeof e[n]=="object"?JSON.stringify(e[n],null,2):e[n];typeof o<"u"&&r.push(`${n}: ${o}`)}return r.join(`
`)}var uxr,hj,w6=b(()=>{uxr=Object.prototype.hasOwnProperty;hj=class extends Error{constructor(e,r,n,o,i){super(CJe(e,{name:r,index:n,operation:o,tree:i})),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"index",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"operation",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"tree",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.setPrototypeOf(this,new.target.prototype),this.message=CJe(e,{name:r,index:n,operation:o,tree:i})}}});var Zwe={};as(Zwe,{JsonPatchError:()=>Ns,_areEquals:()=>x6,applyOperation:()=>gj,applyPatch:()=>zA,applyReducer:()=>dxr,deepClone:()=>lxr,getValueByPointer:()=>rQ,validate:()=>OJe,validator:()=>nQ});function rQ(t,e){if(e=="")return t;var r={op:"_get",path:e};return gj(t,r),r.value}function gj(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):nQ(e,0)),e.path===""){let a={newDocument:t};if(e.op==="add")return a.newDocument=e.value,a;if(e.op==="replace")return a.newDocument=e.value,a.removed=t,a;if(e.op==="move"||e.op==="copy")return a.newDocument=rQ(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=x6(t,e.value),a.test===!1)throw new Ns("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return a.newDocument=t,a}else{if(e.op==="remove")return a.removed=t,a.newDocument=null,a;if(e.op==="_get")return e.value=t,a;if(r)throw new Ns("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return a}}else{n||(t=Cf(t));let s=(e.path||"").split("/"),u=t,l=1,c=s.length,d,f,p;for(typeof r=="function"?p=r:p=nQ;;){if(f=s[l],f&&f.indexOf("~")!=-1&&(f=v6(f)),o&&(f=="__proto__"||f=="prototype"&&l>0&&s[l-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&d===void 0&&(u[f]===void 0?d=s.slice(0,l).join("/"):l==c-1&&(d=e.path),d!==void 0&&p(e,0,t,d)),l++,Array.isArray(u)){if(f==="-")f=u.length;else{if(r&&!tQ(f))throw new Ns("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,e,t);tQ(f)&&(f=~~f)}if(l>=c){if(r&&e.op==="add"&&f>u.length)throw new Ns("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let m=cxr[e.op].call(e,u,f,t);if(m.test===!1)throw new Ns("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(l>=c){let m=vB[e.op].call(e,u,f,t);if(m.test===!1)throw new Ns("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(u=u[f],r&&l<c&&(!u||typeof u!="object"))throw new Ns("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,e,t)}}}function zA(t,e,r,n=!0,o=!0){if(r&&!Array.isArray(e))throw new Ns("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=Cf(t));let i=new Array(e.length);for(let a=0,s=e.length;a<s;a++)i[a]=gj(t,e[a],r,!0,o,a),t=i[a].newDocument;return i.newDocument=t,i}function dxr(t,e,r){let n=gj(t,e);if(n.test===!1)throw new Ns("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function nQ(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new Ns("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(vB[t.op]){if(typeof t.path!="string")throw new Ns("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new Ns('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,r);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new Ns("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new Ns("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&XX(t.value))throw new Ns("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,r);if(r){if(t.op=="add"){var o=t.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new Ns("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,r)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==n)throw new Ns("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var a={op:"_get",path:t.from,value:void 0},s=OJe([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ns("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new Ns("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function OJe(t,e,r){try{if(!Array.isArray(t))throw new Ns("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)zA(Cf(e),Cf(t),r||!0);else{r=r||nQ;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(o){if(o instanceof Ns)return o;throw o}}function x6(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){var r=Array.isArray(t),n=Array.isArray(e),o,i,a;if(r&&n){if(i=t.length,i!=e.length)return!1;for(o=i;o--!==0;)if(!x6(t[o],e[o]))return!1;return!0}if(r!=n)return!1;var s=Object.keys(t);if(i=s.length,i!==Object.keys(e).length)return!1;for(o=i;o--!==0;)if(!e.hasOwnProperty(s[o]))return!1;for(o=i;o--!==0;)if(a=s[o],!x6(t[a],e[a]))return!1;return!0}return t!==t&&e!==e}var Ns,lxr,vB,cxr,oQ=b(()=>{w6();Ns=hj,lxr=Cf,vB={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){let n=rQ(r,this.path);n&&(n=Cf(n));let o=gj(r,{op:"remove",path:this.from}).removed;return gj(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=rQ(r,this.from);return gj(r,{op:"add",path:this.path,value:Cf(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:x6(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},cxr={add:function(t,e,r){return tQ(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var n=t.splice(e,1);return{newDocument:r,removed:n[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:vB.move,copy:vB.copy,test:vB.test,_get:vB._get}});function EJe(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=eQ(e),a=eQ(t),s=!1,u=!1,l=a.length-1;l>=0;l--){var c=a[l],d=t[c];if(QX(e,c)&&!(e[c]===void 0&&d!==void 0&&Array.isArray(e)===!1)){var f=e[c];typeof d=="object"&&d!=null&&typeof f=="object"&&f!=null&&Array.isArray(d)===Array.isArray(f)?EJe(d,f,r,n+"/"+Cv(c),o):d!==f&&(s=!0,o&&r.push({op:"test",path:n+"/"+Cv(c),value:Cf(d)}),r.push({op:"replace",path:n+"/"+Cv(c),value:Cf(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+Cv(c),value:Cf(d)}),r.push({op:"remove",path:n+"/"+Cv(c)}),u=!0):(o&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}),s=!0)}if(!(!u&&i.length==a.length))for(var l=0;l<i.length;l++){var c=i[l];!QX(t,c)&&e[c]!==void 0&&r.push({op:"add",path:n+"/"+Cv(c),value:Cf(e[c])})}}}function iQ(t,e,r=!1){var n=[];return EJe(t,e,n,"",r),n}var PJe=b(()=>{w6();oQ();});var Y7n,Ywe=b(()=>{oQ();PJe();w6();oQ();w6();Y7n={...Zwe,JsonPatchError:hj,deepClone:Cf,escapePathComponent:Cv,unescapePathComponent:v6}});var TJe,AJe,Xwe,IJe,Qwe,e0e,t0e,MJe,RJe,NJe,jJe,DJe,LJe,FJe,kJe,$Je,BJe,zJe,UJe,qJe,HJe,VJe,WJe,KJe,GJe,JJe,ZJe,YJe,XJe,QJe,r0e,e7e,t7e,r7e=b(()=>{TJe="gen_ai.operation.name",AJe="gen_ai.system",Xwe="gen_ai.request.model",IJe="gen_ai.response.model",Qwe="gen_ai.usage.input_tokens",e0e="gen_ai.usage.output_tokens",t0e="gen_ai.usage.total_tokens",MJe="gen_ai.request.max_tokens",RJe="gen_ai.request.temperature",NJe="gen_ai.request.top_p",jJe="gen_ai.request.frequency_penalty",DJe="gen_ai.request.presence_penalty",LJe="gen_ai.response.finish_reasons",FJe="gen_ai.prompt",kJe="gen_ai.completion",$Je="gen_ai.request.extra_query",BJe="gen_ai.request.extra_body",zJe="gen_ai.serialized.name",UJe="gen_ai.serialized.signature",qJe="gen_ai.serialized.doc",HJe="gen_ai.response.id",VJe="gen_ai.response.service_tier",WJe="gen_ai.response.system_fingerprint",KJe="gen_ai.usage.input_token_details",GJe="gen_ai.usage.output_token_details",JJe="langsmith.trace.session_id",ZJe="langsmith.trace.session_name",YJe="langsmith.span.kind",XJe="langsmith.trace.name",QJe="langsmith.metadata",r0e="langsmith.span.tags",e7e="langsmith.request.streaming",t7e="langsmith.request.headers"});var pxr,n7e,o7e,Wt,aQ=b(()=>{yE();pxr=(...t)=>fetch(...t),n7e=Symbol.for("ls:fetch_implementation"),o7e=()=>{let t=globalThis[n7e];return t?typeof t=="function"&&"Headers"in t&&"Request"in t&&"Response"in t:!1},Wt=t=>async(...e)=>{if(t||ac("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[n7e]??pxr)(...e);return(t||ac("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r}});var S6,n0e=b(()=>{yE();S6=()=>ac("PROJECT")??Ah("LANGCHAIN_SESSION")??"default"});var sQ,uQ=b(()=>{o0e();i0e();aQ();n0e();sQ="0.3.54"});function lQ(){if(a0e===void 0){let t=bxr(),e=vxr();a0e={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:sQ,...e}}return a0e}function a7e(){let t=_xr()||{},e={},r=["LANGCHAIN_API_KEY","LANGCHAIN_ENDPOINT","LANGCHAIN_TRACING_V2","LANGCHAIN_PROJECT","LANGCHAIN_SESSION","LANGSMITH_API_KEY","LANGSMITH_ENDPOINT","LANGSMITH_TRACING_V2","LANGSMITH_PROJECT","LANGSMITH_SESSION"];for(let[n,o]of Object.entries(t))(n.startsWith("LANGCHAIN_")||n.startsWith("LANGSMITH_"))&&typeof o=="string"&&!r.includes(n)&&!n.toLowerCase().includes("key")&&!n.toLowerCase().includes("secret")&&!n.toLowerCase().includes("token")&&(n==="LANGCHAIN_REVISION_ID"?e.revision_id=o:e[n]=o);return e}function _xr(){try{return typeof process<"u"&&process.env?Object.entries(process.env).reduce((t,[e,r])=>(t[e]=String(r),t),{}):void 0}catch{return}}function Ah(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function ac(t){return Ah(`LANGSMITH_${t}`)||Ah(`LANGCHAIN_${t}`)}function vxr(){if(s0e!==void 0)return s0e;let t=["VERCEL_GIT_COMMIT_SHA","NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA","COMMIT_REF","RENDER_GIT_COMMIT","CI_COMMIT_SHA","CIRCLE_SHA1","CF_PAGES_COMMIT_SHA","REACT_APP_GIT_SHA","SOURCE_VERSION","GITHUB_SHA","TRAVIS_COMMIT","GIT_COMMIT","BUILD_VCS_NUMBER","bamboo_planRepository_revision","Build.SourceVersion","BITBUCKET_COMMIT","DRONE_COMMIT_SHA","SEMAPHORE_GIT_SHA","BUILDKITE_COMMIT"],e={};for(let r of t){let n=Ah(r);n!==void 0&&(e[r]=n)}return s0e=e,e}function cQ(){return Ah("OTEL_ENABLED")==="true"||ac("OTEL_ENABLED")==="true"}var bE,mxr,hxr,gxr,i7e,yxr,bxr,a0e,s0e,yE=b(()=>{uQ();mxr=()=>typeof window<"u"&&typeof window.document<"u",hxr=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",gxr=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),i7e=()=>typeof Deno<"u",yxr=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!i7e(),bxr=()=>bE||(mxr()?bE="browser":yxr()?bE="node":hxr()?bE="webworker":gxr()?bE="jsdom":i7e()?bE="deno":bE="other",bE)});function dQ(){return m0e.getTraceInstance()}function u7e(){return m0e.getContextInstance()}function l7e(){return m0e.getDefaultOTLPTracerComponents()}var c0e,d0e,f0e,u0e,l0e,s7e,wxr,xxr,p0e,m0e,h0e=b(()=>{yE();c0e=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...r){!this.hasWarned&&cQ()&&(console.warn('You have enabled OTEL export via the `OTEL_ENABLED` or `LANGSMITH_OTEL_ENABLED` environment variable, but have not initialized the required OTEL instances. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.'),this.hasWarned=!0);let n;if(r.length===1&&typeof r[0]=="function"?n=r[0]:r.length===2&&typeof r[1]=="function"?n=r[1]:r.length===3&&typeof r[2]=="function"&&(n=r[2]),typeof n=="function")return n()}},d0e=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new c0e})}getTracer(e,r){return this.mockTracer}getActiveSpan(){}setSpan(e,r){return e}getSpan(e){}setSpanContext(e,r){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},f0e=class{active(){return{}}with(e,r){return r()}},u0e=Symbol.for("ls:otel_trace"),l0e=Symbol.for("ls:otel_context"),s7e=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),wxr=new d0e,xxr=new f0e,p0e=class{getTraceInstance(){return globalThis[u0e]??wxr}getContextInstance(){return globalThis[l0e]??xxr}initializeGlobalInstances(e){globalThis[u0e]===void 0&&(globalThis[u0e]=e.trace),globalThis[l0e]===void 0&&(globalThis[l0e]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[s7e]=e}getDefaultOTLPTracerComponents(){return globalThis[s7e]??void 0}},m0e=new p0e});function Cxr(t){return Sxr[t]||t}var Sxr,fQ,c7e=b(()=>{r7e();h0e();Sxr={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};fQ=class{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}exportBatch(e,r){for(let n of e)try{if(!n.run)continue;if(n.operation==="post"){let o=this.createSpanForRun(n,n.run,r.get(n.id));o&&!n.run.end_time&&this.spans.set(n.id,o)}else this.updateSpanForRun(n,n.run)}catch(o){console.error(`Error processing operation ${n.id}:`,o)}}createSpanForRun(e,r,n){let o=n&&dQ().getSpan(n);if(o)try{return this.finishSpanSetup(o,r,e)}catch(i){console.error(`Failed to create span for run ${e.id}:`,i);return}}finishSpanSetup(e,r,n){return this.setSpanAttributes(e,r,n),r.error?(e.setStatus({code:2}),e.recordException(new Error(r.error))):e.setStatus({code:1}),r.end_time&&e.end(new Date(r.end_time)),e}updateSpanForRun(e,r){try{let n=this.spans.get(e.id);if(!n){console.debug(`No span found for run ${e.id} during update`);return}this.setSpanAttributes(n,r,e),r.error?(n.setStatus({code:2}),n.recordException(new Error(r.error))):n.setStatus({code:1});let o=r.end_time;o&&(n.end(new Date(o)),this.spans.delete(e.id))}catch(n){console.error(`Failed to update span for run ${e.id}:`,n)}}extractModelName(e){if(e.extra?.metadata){let r=e.extra.metadata;if(r.ls_model_name)return r.ls_model_name;if(r.invocation_params){let n=r.invocation_params;if(n.model)return n.model;if(n.model_name)return n.model_name}}}setSpanAttributes(e,r,n){if("run_type"in r&&r.run_type){e.setAttribute(YJe,r.run_type);let s=Cxr(r.run_type||"chain");e.setAttribute(TJe,s)}"name"in r&&r.name&&e.setAttribute(XJe,r.name),"session_id"in r&&r.session_id&&e.setAttribute(JJe,r.session_id),"session_name"in r&&r.session_name&&e.setAttribute(ZJe,r.session_name),this.setGenAiSystem(e,r);let o=this.extractModelName(r);o&&e.setAttribute(Xwe,o),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&e.setAttribute(Qwe,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&e.setAttribute(e0e,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&e.setAttribute(t0e,r.total_tokens),this.setInvocationParameters(e,r);let i=r.extra?.metadata||{};for(let[s,u]of Object.entries(i))u!=null&&e.setAttribute(`${QJe}.${s}`,String(u));let a=r.tags;if(a&&Array.isArray(a)?e.setAttribute(r0e,a.join(", ")):a&&e.setAttribute(r0e,String(a)),"serialized"in r&&typeof r.serialized=="object"){let s=r.serialized;s.name&&e.setAttribute(zJe,String(s.name)),s.signature&&e.setAttribute(UJe,String(s.signature)),s.doc&&e.setAttribute(qJe,String(s.doc))}this.setIOAttributes(e,n)}setGenAiSystem(e,r){let n="langchain",o=this.extractModelName(r);if(o){let i=o.toLowerCase();i.includes("anthropic")||i.startsWith("claude")?n="anthropic":i.includes("bedrock")?n="aws.bedrock":i.includes("azure")&&i.includes("openai")?n="az.ai.openai":i.includes("azure")&&i.includes("inference")?n="az.ai.inference":i.includes("cohere")?n="cohere":i.includes("deepseek")?n="deepseek":i.includes("gemini")?n="gemini":i.includes("groq")?n="groq":i.includes("watson")||i.includes("ibm")?n="ibm.watsonx.ai":i.includes("mistral")?n="mistral_ai":i.includes("gpt")||i.includes("openai")?n="openai":i.includes("perplexity")||i.includes("sonar")?n="perplexity":i.includes("vertex")?n="vertex_ai":(i.includes("xai")||i.includes("grok"))&&(n="xai")}e.setAttribute(AJe,n)}setInvocationParameters(e,r){if(!r.extra?.metadata?.invocation_params)return;let n=r.extra.metadata.invocation_params;n.max_tokens!==void 0&&e.setAttribute(MJe,n.max_tokens),n.temperature!==void 0&&e.setAttribute(RJe,n.temperature),n.top_p!==void 0&&e.setAttribute(NJe,n.top_p),n.frequency_penalty!==void 0&&e.setAttribute(jJe,n.frequency_penalty),n.presence_penalty!==void 0&&e.setAttribute(DJe,n.presence_penalty)}setIOAttributes(e,r){if(r.run.inputs)try{let n=r.run.inputs;typeof n=="object"&&n!==null&&(n.model&&Array.isArray(n.messages)&&e.setAttribute(Xwe,n.model),n.stream!==void 0&&e.setAttribute(e7e,n.stream),n.extra_headers&&e.setAttribute(t7e,JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute($Je,JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute(BJe,JSON.stringify(n.extra_body))),e.setAttribute(FJe,JSON.stringify(n))}catch(n){console.debug(`Failed to process inputs for run ${r.id}`,n)}if(r.run.outputs)try{let n=r.run.outputs,o=this.getUnifiedRunTokens(n);if(o&&(e.setAttribute(Qwe,o[0]),e.setAttribute(e0e,o[1]),e.setAttribute(t0e,o[0]+o[1])),n&&typeof n=="object"){if(n.model&&e.setAttribute(IJe,String(n.model)),n.id&&e.setAttribute(HJe,n.id),n.choices&&Array.isArray(n.choices)){let i=n.choices.map(a=>a.finish_reason).filter(a=>a).map(String);i.length>0&&e.setAttribute(LJe,i.join(", "))}if(n.service_tier&&e.setAttribute(VJe,n.service_tier),n.system_fingerprint&&e.setAttribute(WJe,n.system_fingerprint),n.usage_metadata&&typeof n.usage_metadata=="object"){let i=n.usage_metadata;i.input_token_details&&e.setAttribute(KJe,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(GJe,JSON.stringify(i.output_token_details))}}e.setAttribute(kJe,JSON.stringify(n))}catch(n){console.debug(`Failed to process outputs for run ${r.id}`,n)}}getUnifiedRunTokens(e){if(!e)return null;let r=this.extractUnifiedRunTokens(e.usage_metadata);if(r)return r;let n=Object.keys(e);for(let a of n){let s=e[a];if(!(!s||typeof s!="object")&&(r=this.extractUnifiedRunTokens(s.usage_metadata),r||s.lc===1&&s.kwargs&&typeof s.kwargs=="object"&&(r=this.extractUnifiedRunTokens(s.kwargs.usage_metadata),r)))return r}let o=e.generations||[];if(!Array.isArray(o))return null;let i=Array.isArray(o[0])?o.flat():o;for(let a of i)if(typeof a=="object"&&a.message&&typeof a.message=="object"&&a.message.kwargs&&typeof a.message.kwargs=="object"&&(r=this.extractUnifiedRunTokens(a.message.kwargs.usage_metadata),r))return r;return null}extractUnifiedRunTokens(e){return!e||typeof e!="object"||typeof e.input_tokens!="number"||typeof e.output_tokens!="number"?null:[e.input_tokens,e.output_tokens]}}});var f7e=x((bZn,g0e)=>{"use strict";var Oxr=Object.prototype.hasOwnProperty,xp="~";function C6(){}Object.create&&(C6.prototype=Object.create(null),new C6().__proto__||(xp=!1));function Exr(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function d7e(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new Exr(r,n||t,o),a=xp?xp+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],i]:t._events[a].push(i):(t._events[a]=i,t._eventsCount++),t}function pQ(t,e){--t._eventsCount===0?t._events=new C6:delete t._events[e]}function Of(){this._events=new C6,this._eventsCount=0}Of.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)Oxr.call(r,n)&&e.push(xp?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Of.prototype.listeners=function(e){var r=xp?xp+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,a=new Array(i);o<i;o++)a[o]=n[o].fn;return a};Of.prototype.listenerCount=function(e){var r=xp?xp+e:e,n=this._events[r];return n?n.fn?1:n.length:0};Of.prototype.emit=function(e,r,n,o,i,a){var s=xp?xp+e:e;if(!this._events[s])return!1;var u=this._events[s],l=arguments.length,c,d;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,r),!0;case 3:return u.fn.call(u.context,r,n),!0;case 4:return u.fn.call(u.context,r,n,o),!0;case 5:return u.fn.call(u.context,r,n,o,i),!0;case 6:return u.fn.call(u.context,r,n,o,i,a),!0}for(d=1,c=new Array(l-1);d<l;d++)c[d-1]=arguments[d];u.fn.apply(u.context,c)}else{var f=u.length,p;for(d=0;d<f;d++)switch(u[d].once&&this.removeListener(e,u[d].fn,void 0,!0),l){case 1:u[d].fn.call(u[d].context);break;case 2:u[d].fn.call(u[d].context,r);break;case 3:u[d].fn.call(u[d].context,r,n);break;case 4:u[d].fn.call(u[d].context,r,n,o);break;default:if(!c)for(p=1,c=new Array(l-1);p<l;p++)c[p-1]=arguments[p];u[d].fn.apply(u[d].context,c)}}return!0};Of.prototype.on=function(e,r,n){return d7e(this,e,r,n,!1)};Of.prototype.once=function(e,r,n){return d7e(this,e,r,n,!0)};Of.prototype.removeListener=function(e,r,n,o){var i=xp?xp+e:e;if(!this._events[i])return this;if(!r)return pQ(this,i),this;var a=this._events[i];if(a.fn)a.fn===r&&(!o||a.once)&&(!n||a.context===n)&&pQ(this,i);else{for(var s=0,u=[],l=a.length;s<l;s++)(a[s].fn!==r||o&&!a[s].once||n&&a[s].context!==n)&&u.push(a[s]);u.length?this._events[i]=u.length===1?u[0]:u:pQ(this,i)}return this};Of.prototype.removeAllListeners=function(e){var r;return e?(r=xp?xp+e:e,this._events[r]&&pQ(this,r)):(this._events=new C6,this._eventsCount=0),this};Of.prototype.off=Of.prototype.removeListener;Of.prototype.addListener=Of.prototype.on;Of.prefixed=xp;Of.EventEmitter=Of;typeof g0e<"u"&&(g0e.exports=Of)});var m7e=x((_Zn,p7e)=>{"use strict";p7e.exports=(t,e)=>(e=e||(()=>{}),t.then(r=>new Promise(n=>{n(e())}).then(()=>r),r=>new Promise(n=>{n(e())}).then(()=>{throw r})))});var g7e=x((vZn,hQ)=>{"use strict";var Pxr=m7e(),mQ=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},h7e=(t,e,r)=>new Promise((n,o)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){n(t);return}let i=setTimeout(()=>{if(typeof r=="function"){try{n(r())}catch(u){o(u)}return}let a=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,s=r instanceof Error?r:new mQ(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);Pxr(t.then(n,o),()=>{clearTimeout(i)})});hQ.exports=h7e;hQ.exports.default=h7e;hQ.exports.TimeoutError=mQ});var y7e=x(y0e=>{"use strict";Object.defineProperty(y0e,"__esModule",{value:!0});function Txr(t,e,r){let n=0,o=t.length;for(;o>0;){let i=o/2|0,a=n+i;r(t[a],e)<=0?(n=++a,o-=i+1):o=i}return n}y0e.default=Txr});var b7e=x(_0e=>{"use strict";Object.defineProperty(_0e,"__esModule",{value:!0});var Axr=y7e(),b0e=class{constructor(){this._queue=[]}enqueue(e,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let o=Axr.default(this._queue,n,(i,a)=>a.priority-i.priority);this._queue.splice(o,0,n)}dequeue(){let e=this._queue.shift();return e?.run}filter(e){return this._queue.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this._queue.length}};_0e.default=b0e});var yQ=x(w0e=>{"use strict";Object.defineProperty(w0e,"__esModule",{value:!0});var Ixr=f7e(),_7e=g7e(),Mxr=b7e(),gQ=()=>{},Rxr=new _7e.TimeoutError,v0e=class extends Ixr{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=gQ,this._resolveIdle=gQ,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:Mxr.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(i=(o=e.interval)===null||o===void 0?void 0:o.toString())!==null&&i!==void 0?i:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||e.interval===0,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=e.throwOnTimeout===!0,this._isPaused=e.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=gQ,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=gQ,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){let e=Date.now();if(this._intervalId===void 0){let r=this._intervalEnd-e;if(r<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),e&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,r={}){return new Promise((n,o)=>{let i=async()=>{this._pendingCount++,this._intervalCount++;try{let a=this._timeout===void 0&&r.timeout===void 0?e():_7e.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(Rxr)});n(await a)}catch(a){o(a)}this._next()};this._queue.enqueue(i,r),this._tryToStartAnother(),this.emit("add")})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(e=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}};w0e.default=v0e});var v7e,bQ,Nxr,jxr,O6,w7e=b(()=>{v7e=j(WX(),1),bQ=j(yQ(),1);aQ();Nxr=[400,401,403,404,405,406,407,408],jxr=[409],O6=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.debug=e.debug,"default"in bQ.default?this.queue=new bQ.default.default({concurrency:this.maxConcurrency}):this.queue=new bQ.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){let n=this.onFailedResponseHook;return this.queue.add(()=>(0,v7e.default)(()=>e(...r).catch(o=>{throw o instanceof Error?o:new Error(o)}),{async onFailedAttempt(o){if(o.message.startsWith("Cancel")||o.message.startsWith("TimeoutError")||o.message.startsWith("AbortError")||o?.code==="ECONNABORTED")throw o;let i=o?.response,a=i?.status;if(a){if(Nxr.includes(+a))throw o;if(jxr.includes(+a))return;n&&await n(i)}},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(e,r,...n){return e.signal?Promise.race([this.call(r,...n),new Promise((o,i)=>{e.signal?.addEventListener("abort",()=>{i(new Error("AbortError"))})})]):this.call(r,...n)}fetch(...e){return this.call(()=>Wt(this.debug)(...e).then(r=>r.ok?r:Promise.reject(r)))}}});function x0e(t){return typeof t?._getType=="function"}function S0e(t){let e={type:t._getType(),data:{content:t.content}};return t?.additional_kwargs&&Object.keys(t.additional_kwargs).length>0&&(e.data.additional_kwargs={...t.additional_kwargs}),e}var x7e=b(()=>{});function nn(t,e){if(!Dxr.test(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}var Dxr,S7e=b(()=>{Dxr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});function _Q(t){C7e[t]||(console.warn(t),C7e[t]=!0)}var C7e,C0e=b(()=>{C7e={}});var E6=x((AZn,O7e)=>{var Lxr="2.0.0",Fxr=Number.MAX_SAFE_INTEGER||9007199254740991,kxr=16,$xr=250,Bxr=["major","premajor","minor","preminor","patch","prepatch","prerelease"];O7e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:kxr,MAX_SAFE_BUILD_LENGTH:$xr,MAX_SAFE_INTEGER:Fxr,RELEASE_TYPES:Bxr,SEMVER_SPEC_VERSION:Lxr,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var P6=x((IZn,E7e)=>{var zxr=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};E7e.exports=zxr});var wB=x((_E,P7e)=>{var{MAX_SAFE_COMPONENT_LENGTH:O0e,MAX_SAFE_BUILD_LENGTH:Uxr,MAX_LENGTH:qxr}=E6(),Hxr=P6();_E=P7e.exports={};var Vxr=_E.re=[],Wxr=_E.safeRe=[],St=_E.src=[],Ct=_E.t={},Kxr=0,E0e="[a-zA-Z0-9-]",Gxr=[["\\s",1],["\\d",qxr],[E0e,Uxr]],Jxr=t=>{for(let[e,r]of Gxr)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},on=(t,e,r)=>{let n=Jxr(e),o=Kxr++;Hxr(t,o,e),Ct[t]=o,St[o]=e,Vxr[o]=new RegExp(e,r?"g":void 0),Wxr[o]=new RegExp(n,r?"g":void 0)};on("NUMERICIDENTIFIER","0|[1-9]\\d*");on("NUMERICIDENTIFIERLOOSE","\\d+");on("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${E0e}*`);on("MAINVERSION",`(${St[Ct.NUMERICIDENTIFIER]})\\.(${St[Ct.NUMERICIDENTIFIER]})\\.(${St[Ct.NUMERICIDENTIFIER]})`);on("MAINVERSIONLOOSE",`(${St[Ct.NUMERICIDENTIFIERLOOSE]})\\.(${St[Ct.NUMERICIDENTIFIERLOOSE]})\\.(${St[Ct.NUMERICIDENTIFIERLOOSE]})`);on("PRERELEASEIDENTIFIER",`(?:${St[Ct.NUMERICIDENTIFIER]}|${St[Ct.NONNUMERICIDENTIFIER]})`);on("PRERELEASEIDENTIFIERLOOSE",`(?:${St[Ct.NUMERICIDENTIFIERLOOSE]}|${St[Ct.NONNUMERICIDENTIFIER]})`);on("PRERELEASE",`(?:-(${St[Ct.PRERELEASEIDENTIFIER]}(?:\\.${St[Ct.PRERELEASEIDENTIFIER]})*))`);on("PRERELEASELOOSE",`(?:-?(${St[Ct.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${St[Ct.PRERELEASEIDENTIFIERLOOSE]})*))`);on("BUILDIDENTIFIER",`${E0e}+`);on("BUILD",`(?:\\+(${St[Ct.BUILDIDENTIFIER]}(?:\\.${St[Ct.BUILDIDENTIFIER]})*))`);on("FULLPLAIN",`v?${St[Ct.MAINVERSION]}${St[Ct.PRERELEASE]}?${St[Ct.BUILD]}?`);on("FULL",`^${St[Ct.FULLPLAIN]}$`);on("LOOSEPLAIN",`[v=\\s]*${St[Ct.MAINVERSIONLOOSE]}${St[Ct.PRERELEASELOOSE]}?${St[Ct.BUILD]}?`);on("LOOSE",`^${St[Ct.LOOSEPLAIN]}$`);on("GTLT","((?:<|>)?=?)");on("XRANGEIDENTIFIERLOOSE",`${St[Ct.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);on("XRANGEIDENTIFIER",`${St[Ct.NUMERICIDENTIFIER]}|x|X|\\*`);on("XRANGEPLAIN",`[v=\\s]*(${St[Ct.XRANGEIDENTIFIER]})(?:\\.(${St[Ct.XRANGEIDENTIFIER]})(?:\\.(${St[Ct.XRANGEIDENTIFIER]})(?:${St[Ct.PRERELEASE]})?${St[Ct.BUILD]}?)?)?`);on("XRANGEPLAINLOOSE",`[v=\\s]*(${St[Ct.XRANGEIDENTIFIERLOOSE]})(?:\\.(${St[Ct.XRANGEIDENTIFIERLOOSE]})(?:\\.(${St[Ct.XRANGEIDENTIFIERLOOSE]})(?:${St[Ct.PRERELEASELOOSE]})?${St[Ct.BUILD]}?)?)?`);on("XRANGE",`^${St[Ct.GTLT]}\\s*${St[Ct.XRANGEPLAIN]}$`);on("XRANGELOOSE",`^${St[Ct.GTLT]}\\s*${St[Ct.XRANGEPLAINLOOSE]}$`);on("COERCEPLAIN",`(^|[^\\d])(\\d{1,${O0e}})(?:\\.(\\d{1,${O0e}}))?(?:\\.(\\d{1,${O0e}}))?`);on("COERCE",`${St[Ct.COERCEPLAIN]}(?:$|[^\\d])`);on("COERCEFULL",St[Ct.COERCEPLAIN]+`(?:${St[Ct.PRERELEASE]})?(?:${St[Ct.BUILD]})?(?:$|[^\\d])`);on("COERCERTL",St[Ct.COERCE],!0);on("COERCERTLFULL",St[Ct.COERCEFULL],!0);on("LONETILDE","(?:~>?)");on("TILDETRIM",`(\\s*)${St[Ct.LONETILDE]}\\s+`,!0);_E.tildeTrimReplace="$1~";on("TILDE",`^${St[Ct.LONETILDE]}${St[Ct.XRANGEPLAIN]}$`);on("TILDELOOSE",`^${St[Ct.LONETILDE]}${St[Ct.XRANGEPLAINLOOSE]}$`);on("LONECARET","(?:\\^)");on("CARETTRIM",`(\\s*)${St[Ct.LONECARET]}\\s+`,!0);_E.caretTrimReplace="$1^";on("CARET",`^${St[Ct.LONECARET]}${St[Ct.XRANGEPLAIN]}$`);on("CARETLOOSE",`^${St[Ct.LONECARET]}${St[Ct.XRANGEPLAINLOOSE]}$`);on("COMPARATORLOOSE",`^${St[Ct.GTLT]}\\s*(${St[Ct.LOOSEPLAIN]})$|^$`);on("COMPARATOR",`^${St[Ct.GTLT]}\\s*(${St[Ct.FULLPLAIN]})$|^$`);on("COMPARATORTRIM",`(\\s*)${St[Ct.GTLT]}\\s*(${St[Ct.LOOSEPLAIN]}|${St[Ct.XRANGEPLAIN]})`,!0);_E.comparatorTrimReplace="$1$2$3";on("HYPHENRANGE",`^\\s*(${St[Ct.XRANGEPLAIN]})\\s+-\\s+(${St[Ct.XRANGEPLAIN]})\\s*$`);on("HYPHENRANGELOOSE",`^\\s*(${St[Ct.XRANGEPLAINLOOSE]})\\s+-\\s+(${St[Ct.XRANGEPLAINLOOSE]})\\s*$`);on("STAR","(<|>)?=?\\s*\\*");on("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");on("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var vQ=x((MZn,T7e)=>{var Zxr=Object.freeze({loose:!0}),Yxr=Object.freeze({}),Xxr=t=>t?typeof t!="object"?Zxr:t:Yxr;T7e.exports=Xxr});var P0e=x((RZn,M7e)=>{var A7e=/^[0-9]+$/,I7e=(t,e)=>{let r=A7e.test(t),n=A7e.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Qxr=(t,e)=>I7e(e,t);M7e.exports={compareIdentifiers:I7e,rcompareIdentifiers:Qxr}});var Ef=x((NZn,D7e)=>{var wQ=P6(),{MAX_LENGTH:R7e,MAX_SAFE_INTEGER:xQ}=E6(),{safeRe:N7e,t:j7e}=wB(),eSr=vQ(),{compareIdentifiers:xB}=P0e(),T0e=class t{constructor(e,r){if(r=eSr(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>R7e)throw new TypeError(`version is longer than ${R7e} characters`);wQ("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?N7e[j7e.LOOSE]:N7e[j7e.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>xQ||this.major<0)throw new TypeError("Invalid major version");if(this.minor>xQ||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>xQ||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let i=+o;if(i>=0&&i<xQ)return i}return o}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(wQ("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),xB(this.major,e.major)||xB(this.minor,e.minor)||xB(this.patch,e.patch)}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(wQ("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return xB(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(wQ("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return xB(n,o)}while(++r)}inc(e,r,n){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[o];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let i=[r,o];n===!1&&(i=[r]),xB(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};D7e.exports=T0e});var bj=x((jZn,F7e)=>{var L7e=Ef(),tSr=(t,e,r=!1)=>{if(t instanceof L7e)return t;try{return new L7e(t,e)}catch(n){if(!r)return null;throw n}};F7e.exports=tSr});var $7e=x((DZn,k7e)=>{var rSr=bj(),nSr=(t,e)=>{let r=rSr(t,e);return r?r.version:null};k7e.exports=nSr});var z7e=x((LZn,B7e)=>{var oSr=bj(),iSr=(t,e)=>{let r=oSr(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};B7e.exports=iSr});var H7e=x((FZn,q7e)=>{var U7e=Ef(),aSr=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new U7e(t instanceof U7e?t.version:t,r).inc(e,n,o).version}catch{return null}};q7e.exports=aSr});var K7e=x((kZn,W7e)=>{var V7e=bj(),sSr=(t,e)=>{let r=V7e(t,null,!0),n=V7e(e,null,!0),o=r.compare(n);if(o===0)return null;let i=o>0,a=i?r:n,s=i?n:r,u=!!a.prerelease.length;if(!!s.prerelease.length&&!u)return!s.patch&&!s.minor?"major":a.patch?"patch":a.minor?"minor":"major";let c=u?"pre":"";return r.major!==n.major?c+"major":r.minor!==n.minor?c+"minor":r.patch!==n.patch?c+"patch":"prerelease"};W7e.exports=sSr});var J7e=x(($Zn,G7e)=>{var uSr=Ef(),lSr=(t,e)=>new uSr(t,e).major;G7e.exports=lSr});var Y7e=x((BZn,Z7e)=>{var cSr=Ef(),dSr=(t,e)=>new cSr(t,e).minor;Z7e.exports=dSr});var Q7e=x((zZn,X7e)=>{var fSr=Ef(),pSr=(t,e)=>new fSr(t,e).patch;X7e.exports=pSr});var tZe=x((UZn,eZe)=>{var mSr=bj(),hSr=(t,e)=>{let r=mSr(t,e);return r&&r.prerelease.length?r.prerelease:null};eZe.exports=hSr});var $g=x((qZn,nZe)=>{var rZe=Ef(),gSr=(t,e,r)=>new rZe(t,r).compare(new rZe(e,r));nZe.exports=gSr});var iZe=x((HZn,oZe)=>{var ySr=$g(),bSr=(t,e,r)=>ySr(e,t,r);oZe.exports=bSr});var sZe=x((VZn,aZe)=>{var _Sr=$g(),vSr=(t,e)=>_Sr(t,e,!0);aZe.exports=vSr});var SQ=x((WZn,lZe)=>{var uZe=Ef(),wSr=(t,e,r)=>{let n=new uZe(t,r),o=new uZe(e,r);return n.compare(o)||n.compareBuild(o)};lZe.exports=wSr});var dZe=x((KZn,cZe)=>{var xSr=SQ(),SSr=(t,e)=>t.sort((r,n)=>xSr(r,n,e));cZe.exports=SSr});var pZe=x((GZn,fZe)=>{var CSr=SQ(),OSr=(t,e)=>t.sort((r,n)=>CSr(n,r,e));fZe.exports=OSr});var T6=x((JZn,mZe)=>{var ESr=$g(),PSr=(t,e,r)=>ESr(t,e,r)>0;mZe.exports=PSr});var CQ=x((ZZn,hZe)=>{var TSr=$g(),ASr=(t,e,r)=>TSr(t,e,r)<0;hZe.exports=ASr});var A0e=x((YZn,gZe)=>{var ISr=$g(),MSr=(t,e,r)=>ISr(t,e,r)===0;gZe.exports=MSr});var I0e=x((XZn,yZe)=>{var RSr=$g(),NSr=(t,e,r)=>RSr(t,e,r)!==0;yZe.exports=NSr});var OQ=x((QZn,bZe)=>{var jSr=$g(),DSr=(t,e,r)=>jSr(t,e,r)>=0;bZe.exports=DSr});var EQ=x((eYn,_Ze)=>{var LSr=$g(),FSr=(t,e,r)=>LSr(t,e,r)<=0;_Ze.exports=FSr});var M0e=x((tYn,vZe)=>{var kSr=A0e(),$Sr=I0e(),BSr=T6(),zSr=OQ(),USr=CQ(),qSr=EQ(),HSr=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return kSr(t,r,n);case"!=":return $Sr(t,r,n);case">":return BSr(t,r,n);case">=":return zSr(t,r,n);case"<":return USr(t,r,n);case"<=":return qSr(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};vZe.exports=HSr});var xZe=x((rYn,wZe)=>{var VSr=Ef(),WSr=bj(),{safeRe:PQ,t:TQ}=wB(),KSr=(t,e)=>{if(t instanceof VSr)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?PQ[TQ.COERCEFULL]:PQ[TQ.COERCE]);else{let u=e.includePrerelease?PQ[TQ.COERCERTLFULL]:PQ[TQ.COERCERTL],l;for(;(l=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||l.index+l[0].length!==r.index+r[0].length)&&(r=l),u.lastIndex=l.index+l[1].length+l[2].length;u.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",i=r[4]||"0",a=e.includePrerelease&&r[5]?`-${r[5]}`:"",s=e.includePrerelease&&r[6]?`+${r[6]}`:"";return WSr(`${n}.${o}.${i}${a}${s}`,e)};wZe.exports=KSr});var CZe=x((nYn,SZe)=>{var R0e=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,r)}return this}};SZe.exports=R0e});var Bg=x((oYn,TZe)=>{var GSr=/\s+/g,N0e=class t{constructor(e,r){if(r=ZSr(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof j0e)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(GSr," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(o=>!EZe(o[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&nCr(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&tCr)|(this.options.loose&&rCr))+":"+e,o=OZe.get(n);if(o)return o;let i=this.options.loose,a=i?bm[Sp.HYPHENRANGELOOSE]:bm[Sp.HYPHENRANGE];e=e.replace(a,pCr(this.options.includePrerelease)),va("hyphen replace",e),e=e.replace(bm[Sp.COMPARATORTRIM],XSr),va("comparator trim",e),e=e.replace(bm[Sp.TILDETRIM],QSr),va("tilde trim",e),e=e.replace(bm[Sp.CARETTRIM],eCr),va("caret trim",e);let s=e.split(" ").map(d=>oCr(d,this.options)).join(" ").split(/\s+/).map(d=>fCr(d,this.options));i&&(s=s.filter(d=>(va("loose invalid filter",d,this.options),!!d.match(bm[Sp.COMPARATORLOOSE])))),va("range list",s);let u=new Map,l=s.map(d=>new j0e(d,this.options));for(let d of l){if(EZe(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return OZe.set(n,c),c}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>PZe(n,r)&&e.set.some(o=>PZe(o,r)&&n.every(i=>o.every(a=>i.intersects(a,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new YSr(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(mCr(this.set[r],e,this.options))return!0;return!1}};TZe.exports=N0e;var JSr=CZe(),OZe=new JSr,ZSr=vQ(),j0e=A6(),va=P6(),YSr=Ef(),{safeRe:bm,t:Sp,comparatorTrimReplace:XSr,tildeTrimReplace:QSr,caretTrimReplace:eCr}=wB(),{FLAG_INCLUDE_PRERELEASE:tCr,FLAG_LOOSE:rCr}=E6(),EZe=t=>t.value==="<0.0.0-0",nCr=t=>t.value==="",PZe=(t,e)=>{let r=!0,n=t.slice(),o=n.pop();for(;r&&n.length;)r=n.every(i=>o.intersects(i,e)),o=n.pop();return r},oCr=(t,e)=>(va("comp",t,e),t=sCr(t,e),va("caret",t),t=iCr(t,e),va("tildes",t),t=lCr(t,e),va("xrange",t),t=dCr(t,e),va("stars",t),t),Cp=t=>!t||t.toLowerCase()==="x"||t==="*",iCr=(t,e)=>t.trim().split(/\s+/).map(r=>aCr(r,e)).join(" "),aCr=(t,e)=>{let r=e.loose?bm[Sp.TILDELOOSE]:bm[Sp.TILDE];return t.replace(r,(n,o,i,a,s)=>{va("tilde",t,n,o,i,a,s);let u;return Cp(o)?u="":Cp(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:Cp(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(va("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,va("tilde return",u),u})},sCr=(t,e)=>t.trim().split(/\s+/).map(r=>uCr(r,e)).join(" "),uCr=(t,e)=>{va("caret",t,e);let r=e.loose?bm[Sp.CARETLOOSE]:bm[Sp.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,a,s,u)=>{va("caret",t,o,i,a,s,u);let l;return Cp(i)?l="":Cp(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:Cp(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(va("replaceCaret pr",u),i==="0"?a==="0"?l=`>=${i}.${a}.${s}-${u} <${i}.${a}.${+s+1}-0`:l=`>=${i}.${a}.${s}-${u} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.${s}-${u} <${+i+1}.0.0-0`):(va("no pr"),i==="0"?a==="0"?l=`>=${i}.${a}.${s}${n} <${i}.${a}.${+s+1}-0`:l=`>=${i}.${a}.${s}${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.${s} <${+i+1}.0.0-0`),va("caret return",l),l})},lCr=(t,e)=>(va("replaceXRanges",t,e),t.split(/\s+/).map(r=>cCr(r,e)).join(" ")),cCr=(t,e)=>{t=t.trim();let r=e.loose?bm[Sp.XRANGELOOSE]:bm[Sp.XRANGE];return t.replace(r,(n,o,i,a,s,u)=>{va("xRange",t,n,o,i,a,s,u);let l=Cp(i),c=l||Cp(a),d=c||Cp(s),f=d;return o==="="&&f&&(o=""),u=e.includePrerelease?"-0":"",l?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&f?(c&&(a=0),s=0,o===">"?(o=">=",c?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):o==="<="&&(o="<",c?i=+i+1:a=+a+1),o==="<"&&(u="-0"),n=`${o+i}.${a}.${s}${u}`):c?n=`>=${i}.0.0${u} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${u} <${i}.${+a+1}.0-0`),va("xRange return",n),n})},dCr=(t,e)=>(va("replaceStars",t,e),t.trim().replace(bm[Sp.STAR],"")),fCr=(t,e)=>(va("replaceGTE0",t,e),t.trim().replace(bm[e.includePrerelease?Sp.GTE0PRE:Sp.GTE0],"")),pCr=t=>(e,r,n,o,i,a,s,u,l,c,d,f)=>(Cp(n)?r="":Cp(o)?r=`>=${n}.0.0${t?"-0":""}`:Cp(i)?r=`>=${n}.${o}.0${t?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Cp(l)?u="":Cp(c)?u=`<${+l+1}.0.0-0`:Cp(d)?u=`<${l}.${+c+1}.0-0`:f?u=`<=${l}.${c}.${d}-${f}`:t?u=`<${l}.${c}.${+d+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),mCr=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(va(t[n].semver),t[n].semver!==j0e.ANY&&t[n].semver.prerelease.length>0){let o=t[n].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var A6=x((iYn,jZe)=>{var I6=Symbol("SemVer ANY"),F0e=class t{static get ANY(){return I6}constructor(e,r){if(r=AZe(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),L0e("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===I6?this.value="":this.value=this.operator+this.semver.version,L0e("comp",this)}parse(e){let r=this.options.loose?IZe[MZe.COMPARATORLOOSE]:IZe[MZe.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new RZe(n[2],this.options.loose):this.semver=I6}toString(){return this.value}test(e){if(L0e("Comparator.test",e,this.options.loose),this.semver===I6||e===I6)return!0;if(typeof e=="string")try{e=new RZe(e,this.options)}catch{return!1}return D0e(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new NZe(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new NZe(this.value,r).test(e.semver):(r=AZe(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||D0e(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||D0e(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};jZe.exports=F0e;var AZe=vQ(),{safeRe:IZe,t:MZe}=wB(),D0e=M0e(),L0e=P6(),RZe=Ef(),NZe=Bg()});var M6=x((aYn,DZe)=>{var hCr=Bg(),gCr=(t,e,r)=>{try{e=new hCr(e,r)}catch{return!1}return e.test(t)};DZe.exports=gCr});var FZe=x((sYn,LZe)=>{var yCr=Bg(),bCr=(t,e)=>new yCr(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));LZe.exports=bCr});var $Ze=x((uYn,kZe)=>{var _Cr=Ef(),vCr=Bg(),wCr=(t,e,r)=>{let n=null,o=null,i=null;try{i=new vCr(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new _Cr(n,r))}),n};kZe.exports=wCr});var zZe=x((lYn,BZe)=>{var xCr=Ef(),SCr=Bg(),CCr=(t,e,r)=>{let n=null,o=null,i=null;try{i=new SCr(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new xCr(n,r))}),n};BZe.exports=CCr});var HZe=x((cYn,qZe)=>{var k0e=Ef(),OCr=Bg(),UZe=T6(),ECr=(t,e)=>{t=new OCr(t,e);let r=new k0e("0.0.0");if(t.test(r)||(r=new k0e("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let o=t.set[n],i=null;o.forEach(a=>{let s=new k0e(a.semver.version);switch(a.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!i||UZe(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||UZe(r,i))&&(r=i)}return r&&t.test(r)?r:null};qZe.exports=ECr});var WZe=x((dYn,VZe)=>{var PCr=Bg(),TCr=(t,e)=>{try{return new PCr(t,e).range||"*"}catch{return null}};VZe.exports=TCr});var AQ=x((fYn,ZZe)=>{var ACr=Ef(),JZe=A6(),{ANY:ICr}=JZe,MCr=Bg(),RCr=M6(),KZe=T6(),GZe=CQ(),NCr=EQ(),jCr=OQ(),DCr=(t,e,r,n)=>{t=new ACr(t,n),e=new MCr(e,n);let o,i,a,s,u;switch(r){case">":o=KZe,i=NCr,a=GZe,s=">",u=">=";break;case"<":o=GZe,i=jCr,a=KZe,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(RCr(t,e,n))return!1;for(let l=0;l<e.set.length;++l){let c=e.set[l],d=null,f=null;if(c.forEach(p=>{p.semver===ICr&&(p=new JZe(">=0.0.0")),d=d||p,f=f||p,o(p.semver,d.semver,n)?d=p:a(p.semver,f.semver,n)&&(f=p)}),d.operator===s||d.operator===u||(!f.operator||f.operator===s)&&i(t,f.semver))return!1;if(f.operator===u&&a(t,f.semver))return!1}return!0};ZZe.exports=DCr});var XZe=x((pYn,YZe)=>{var LCr=AQ(),FCr=(t,e,r)=>LCr(t,e,">",r);YZe.exports=FCr});var eYe=x((mYn,QZe)=>{var kCr=AQ(),$Cr=(t,e,r)=>kCr(t,e,"<",r);QZe.exports=$Cr});var nYe=x((hYn,rYe)=>{var tYe=Bg(),BCr=(t,e,r)=>(t=new tYe(t,r),e=new tYe(e,r),t.intersects(e,r));rYe.exports=BCr});var iYe=x((gYn,oYe)=>{var zCr=M6(),UCr=$g();oYe.exports=(t,e,r)=>{let n=[],o=null,i=null,a=t.sort((c,d)=>UCr(c,d,r));for(let c of a)zCr(c,e,r)?(i=c,o||(o=c)):(i&&n.push([o,i]),i=null,o=null);o&&n.push([o,null]);let s=[];for(let[c,d]of n)c===d?s.push(c):!d&&c===a[0]?s.push("*"):d?c===a[0]?s.push(`<=${d}`):s.push(`${c} - ${d}`):s.push(`>=${c}`);let u=s.join(" || "),l=typeof e.raw=="string"?e.raw:String(e);return u.length<l.length?u:e}});var dYe=x((yYn,cYe)=>{var aYe=Bg(),B0e=A6(),{ANY:$0e}=B0e,R6=M6(),z0e=$g(),qCr=(t,e,r={})=>{if(t===e)return!0;t=new aYe(t,r),e=new aYe(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let a=VCr(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},HCr=[new B0e(">=0.0.0-0")],sYe=[new B0e(">=0.0.0")],VCr=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===$0e){if(e.length===1&&e[0].semver===$0e)return!0;r.includePrerelease?t=HCr:t=sYe}if(e.length===1&&e[0].semver===$0e){if(r.includePrerelease)return!0;e=sYe}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=uYe(o,p,r):p.operator==="<"||p.operator==="<="?i=lYe(i,p,r):n.add(p.semver);if(n.size>1)return null;let a;if(o&&i){if(a=z0e(o.semver,i.semver,r),a>0)return null;if(a===0&&(o.operator!==">="||i.operator!=="<="))return null}for(let p of n){if(o&&!R6(p,String(o),r)||i&&!R6(p,String(i),r))return null;for(let m of e)if(!R6(p,String(m),r))return!1;return!0}let s,u,l,c,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let p of e){if(c=c||p.operator===">"||p.operator===">=",l=l||p.operator==="<"||p.operator==="<=",o){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator===">"||p.operator===">="){if(s=uYe(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!R6(o.semver,String(p),r))return!1}if(i){if(d&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===d.major&&p.semver.minor===d.minor&&p.semver.patch===d.patch&&(d=!1),p.operator==="<"||p.operator==="<="){if(u=lYe(i,p,r),u===p&&u!==i)return!1}else if(i.operator==="<="&&!R6(i.semver,String(p),r))return!1}if(!p.operator&&(i||o)&&a!==0)return!1}return!(o&&l&&!i&&a!==0||i&&c&&!o&&a!==0||f||d)},uYe=(t,e,r)=>{if(!t)return e;let n=z0e(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},lYe=(t,e,r)=>{if(!t)return e;let n=z0e(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};cYe.exports=qCr});var hYe=x((bYn,mYe)=>{var U0e=wB(),fYe=E6(),WCr=Ef(),pYe=P0e(),KCr=bj(),GCr=$7e(),JCr=z7e(),ZCr=H7e(),YCr=K7e(),XCr=J7e(),QCr=Y7e(),eOr=Q7e(),tOr=tZe(),rOr=$g(),nOr=iZe(),oOr=sZe(),iOr=SQ(),aOr=dZe(),sOr=pZe(),uOr=T6(),lOr=CQ(),cOr=A0e(),dOr=I0e(),fOr=OQ(),pOr=EQ(),mOr=M0e(),hOr=xZe(),gOr=A6(),yOr=Bg(),bOr=M6(),_Or=FZe(),vOr=$Ze(),wOr=zZe(),xOr=HZe(),SOr=WZe(),COr=AQ(),OOr=XZe(),EOr=eYe(),POr=nYe(),TOr=iYe(),AOr=dYe();mYe.exports={parse:KCr,valid:GCr,clean:JCr,inc:ZCr,diff:YCr,major:XCr,minor:QCr,patch:eOr,prerelease:tOr,compare:rOr,rcompare:nOr,compareLoose:oOr,compareBuild:iOr,sort:aOr,rsort:sOr,gt:uOr,lt:lOr,eq:cOr,neq:dOr,gte:fOr,lte:pOr,cmp:mOr,coerce:hOr,Comparator:gOr,Range:yOr,satisfies:bOr,toComparators:_Or,maxSatisfying:vOr,minSatisfying:wOr,minVersion:xOr,validRange:SOr,outside:COr,gtr:OOr,ltr:EOr,intersects:POr,simplifyRange:TOr,subset:AOr,SemVer:WCr,re:U0e.re,src:U0e.src,tokens:U0e.t,SEMVER_SPEC_VERSION:fYe.SEMVER_SPEC_VERSION,RELEASE_TYPES:fYe.RELEASE_TYPES,compareIdentifiers:pYe.compareIdentifiers,rcompareIdentifiers:pYe.rcompareIdentifiers}});function vE(t){if(!t||t.split("/").length>2||t.startsWith("/")||t.endsWith("/")||t.split(":").length>2)throw new Error(`Invalid identifier format: ${t}`);let[e,r]=t.split(":"),n=r||"latest";if(e.includes("/")){let[o,i]=e.split("/",2);if(!o||!i)throw new Error(`Invalid identifier format: ${t}`);return[o,i,n]}else{if(!e)throw new Error(`Invalid identifier format: ${t}`);return["-",e,n]}}var IOr,gYe=b(()=>{IOr=j(hYe(),1)});async function cn(t,e,r){let n;if(t.ok){r&&(n=await t.text());return}n=await t.text();let o=`Failed to ${e}. Received status [${t.status}]: ${t.statusText}. Server response: ${n}`;if(t.status===409)throw new q0e(o);let i=new Error(o);throw i.status=t.status,i}function bYe(t){return typeof t=="object"&&t!==null&&t.code===yYe}var q0e,yYe,IQ,H0e=b(()=>{q0e=class extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithConflictError",this.status=409}};yYe="ERR_CONFLICTING_ENDPOINTS",IQ=class extends Error{constructor(){super("You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS."),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:yYe}),this.name="ConflictingEndpointsError"}}});function NOr(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function MQ(t){return ROr.encode(t)}function vYe(t){if(t&&typeof t=="object"&&t!==null){if(t instanceof Map)return Object.fromEntries(t);if(t instanceof Set)return Array.from(t);if(t instanceof Date)return t.toISOString();if(t instanceof RegExp)return t.toString();if(t instanceof Error)return{name:t.name,message:t.message}}else if(typeof t=="bigint")return t.toString();return t}function jOr(t){return function(e,r){if(t){let n=t.call(this,e,r);if(n!==void 0)return n}return vYe(r)}}function _m(t,e,r,n,o){try{let i=JSON.stringify(t,jOr(r),n);return MQ(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?`
Context: ${e}`:""}`),MQ("[Unserializable]");ac("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?`
Context: ${e}`:""}`),typeof o>"u"&&(o=NOr()),W0e(t,"",0,[],void 0,0,o);let a;try{SB.length===0?a=JSON.stringify(t,r,n):a=JSON.stringify(t,DOr(r),n)}catch{return MQ("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;RQ.length!==0;){let s=RQ.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return MQ(a)}}function V0e(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),RQ.push([n,r,e,o])):SB.push([e,r,t]):(n[r]=t,RQ.push([n,r,e]))}function W0e(t,e,r,n,o,i,a){i+=1;var s;if(typeof t=="object"&&t!==null){for(s=0;s<n.length;s++)if(n[s]===t){V0e(MOr,t,e,o);return}if(typeof a.depthLimit<"u"&&i>a.depthLimit){V0e(_Ye,t,e,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){V0e(_Ye,t,e,o);return}if(n.push(t),Array.isArray(t))for(s=0;s<t.length;s++)W0e(t[s],s,s,n,t,i,a);else{t=vYe(t);var u=Object.keys(t);for(s=0;s<u.length;s++){var l=u[s];W0e(t[l],l,s,n,t,i,a)}}n.pop()}}function DOr(t){return t=typeof t<"u"?t:function(e,r){return r},function(e,r){if(SB.length>0)for(var n=0;n<SB.length;n++){var o=SB[n];if(o[1]===e&&o[0]===r){r=o[2],SB.splice(n,1);break}}return t.call(this,e,r)}}var _Ye,MOr,RQ,SB,ROr,wYe=b(()=>{yE();_Ye="[...]",MOr={result:"[Circular]"},RQ=[],SB=[],ROr=new TextEncoder});function xYe(t){let e=lQ(),r=a7e(),n=t.extra??{},o=n.metadata;return t.extra={...n,runtime:{...e,...n?.runtime},metadata:{...r,...r.revision_id||"revision_id"in t&&t.revision_id?{revision_id:("revision_id"in t?t.revision_id:void 0)??r.revision_id}:{},...o}},t}async function kOr(t){let e=[];for await(let r of t)e.push(r);return e}function K0e(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function SYe(t){return typeof t=="number"?Number(t.toFixed(4)):t}function OYe(t){return"dataset_id"in t||"dataset_name"in t}var LOr,FOr,$Or,G0e,BOr,zOr,CYe,yj,o0e=b(()=>{mj();c7e();h0e();w7e();x7e();yE();uQ();S7e();C0e();gYe();H0e();aQ();wYe();LOr=t=>{let e=t?.toString()??ac("TRACING_SAMPLING_RATE");if(e===void 0)return;let r=parseFloat(e);if(r<0||r>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${r}`);return r},FOr=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};$Or=async t=>{if(t?.status===429){let e=parseInt(t.headers.get("retry-after")??"30",10)*1e3;if(e>0)return await new Promise(r=>setTimeout(r,e)),!0}return!1};G0e=class{constructor(){Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0})}peek(){return this.items[0]}push(e){let r,n=new Promise(i=>{r=i}),o=_m(e.item,`Serializing run with id: ${e.item.id}`).length;return this.items.push({action:e.action,payload:e.item,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,itemPromiseResolve:r,itemPromise:n,size:o}),this.sizeBytes+=o,n}pop(e){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");let r=[],n=0;for(;n+(this.peek()?.size??0)<e&&this.items.length>0;){let o=this.items.shift();o&&(r.push(o),n+=o.size,this.sizeBytes-=o.size)}if(r.length===0&&this.items.length>0){let o=this.items.shift();r.push(o),n+=o.size,this.sizeBytes-=o.size}return[r.map(o=>({action:o.action,item:o.payload,otelContext:o.otelContext,apiKey:o.apiKey,apiUrl:o.apiUrl})),()=>r.forEach(o=>o.itemPromiseResolve())]}},BOr=20971520,zOr=2500,CYe="https://api.smith.langchain.com",yj=class t{constructor(e={}){Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"webUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchIngestCaller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout_ms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tenantId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingSampleRate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filteredPostUuids",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"autoBatchTracing",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"autoBatchQueue",{enumerable:!0,configurable:!0,writable:!0,value:new G0e}),Object.defineProperty(this,"autoBatchTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchAggregationDelayMs",{enumerable:!0,configurable:!0,writable:!0,value:250}),Object.defineProperty(this,"batchSizeBytesLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"blockOnRootRunFinalization",{enumerable:!0,configurable:!0,writable:!0,value:Ah("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"langSmithToOTELTranslator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multipartStreamingDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:Ah("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=LOr(e.tracingSamplingRate),this.apiUrl=K0e(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=K0e(e.apiKey??r.apiKey),this.webUrl=K0e(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.timeout_ms=e.timeout_ms??9e4,this.caller=new O6({...e.callerOptions??{},debug:e.debug??this.debug}),this.traceBatchConcurrency=e.traceBatchConcurrency??this.traceBatchConcurrency,this.traceBatchConcurrency<1)throw new Error("Trace batch concurrency must be positive.");this.debug=e.debug??this.debug,this.batchIngestCaller=new O6({maxRetries:2,maxConcurrency:this.traceBatchConcurrency,...e.callerOptions??{},onFailedResponseHook:$Or,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode,cQ()&&(this.langSmithToOTELTranslator=new fQ)}static getDefaultClientConfig(){let e=ac("API_KEY"),r=ac("ENDPOINT")??CYe,n=ac("HIDE_INPUTS")==="true",o=ac("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:FOr(this.apiUrl)?(this.webUrl="http://localhost:3000",this.webUrl):this.apiUrl.endsWith("/api/v1")?(this.webUrl=this.apiUrl.replace("/api/v1",""),this.webUrl):this.apiUrl.includes("/api")&&!this.apiUrl.split(".",1)[0].endsWith("api")?(this.webUrl=this.apiUrl.replace("/api",""),this.webUrl):this.apiUrl.split(".",1)[0].includes("dev")?(this.webUrl="https://dev.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("eu")?(this.webUrl="https://eu.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("beta")?(this.webUrl="https://beta.smith.langchain.com",this.webUrl):(this.webUrl="https://smith.langchain.com",this.webUrl)}get headers(){let e={"User-Agent":`langsmith-js/${sQ}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),e}_getPlatformEndpointPath(e){return this.apiUrl.slice(-3)!=="/v1"&&this.apiUrl.slice(-4)!=="/v1/"?`/v1/platform/${e}`:`/platform/${e}`}async processInputs(e){return this.hideInputs===!1?e:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(e):e}async processOutputs(e){return this.hideOutputs===!1?e:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(e):e}async prepareRunCreateOrUpdateInputs(e){let r={...e};return r.inputs!==void 0&&(r.inputs=await this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=await this.processOutputs(r.outputs)),r}async _getResponse(e,r){let n=r?.toString()??"",o=`${this.apiUrl}${e}?${n}`,i=await this.caller.call(Wt(this.debug),o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(i,`Failed to fetch ${e}`),i}async _get(e,r){return(await this._getResponse(e,r)).json()}async*_getPaginated(e,r=new URLSearchParams,n){let o=Number(r.get("offset"))||0,i=Number(r.get("limit"))||100;for(;;){r.set("offset",String(o)),r.set("limit",String(i));let a=`${this.apiUrl}${e}?${r}`,s=await this.caller.call(Wt(this.debug),a,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(s,`Failed to fetch ${e}`);let u=n?n(await s.json()):await s.json();if(u.length===0||(yield u,u.length<i))break;o+=u.length}}async*_getCursorPaginatedList(e,r=null,n="POST",o="runs"){let i=r?{...r}:{};for(;;){let s=await(await this.caller.call(Wt(this.debug),`${this.apiUrl}${e}`,{method:n,headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)})).json();if(!s||!s[o])break;yield s[o];let u=s.cursors;if(!u||!u.next)break;i.cursor=u.next}}_shouldSample(){return this.tracingSampleRate===void 0?!0:Math.random()<this.tracingSampleRate}_filterForSampling(e,r=!1){if(this.tracingSampleRate===void 0)return e;if(r){let n=[];for(let o of e)this.filteredPostUuids.has(o.trace_id)?o.id===o.trace_id&&this.filteredPostUuids.delete(o.trace_id):n.push(o);return n}else{let n=[];for(let o of e){let i=o.trace_id??o.id;this.filteredPostUuids.has(i)||(o.id===i?this._shouldSample()?n.push(o):this.filteredPostUuids.add(i):n.push(o))}return n}}async _getBatchSizeLimitBytes(){let e=await this._ensureServerInfo();return this.batchSizeBytesLimit??e.batch_ingest_config?.size_limit_bytes??BOr}async _getMultiPartSupport(){return(await this._ensureServerInfo()).instance_flags?.dataset_examples_multipart_enabled??!1}drainAutoBatchQueue(e){let r=[];for(;this.autoBatchQueue.items.length>0;){let[n,o]=this.autoBatchQueue.pop(e);if(!n.length){o();break}let i=n.reduce((u,l)=>{let c=l.apiUrl??this.apiUrl,d=l.apiKey??this.apiKey,p=l.apiKey===this.apiKey&&l.apiUrl===this.apiUrl?"default":`${c}|${d}`;return u[p]||(u[p]=[]),u[p].push(l),u},{}),a=[];for(let[u,l]of Object.entries(i)){let c=this._processBatch(l,{apiUrl:u==="default"?void 0:u.split("|")[0],apiKey:u==="default"?void 0:u.split("|")[1]});a.push(c)}let s=Promise.all(a).finally(o);r.push(s)}return Promise.all(r)}async _processBatch(e,r){if(e.length)try{if(this.langSmithToOTELTranslator!==void 0)this._sendBatchToOTELTranslator(e);else{let n={runCreates:e.filter(i=>i.action==="create").map(i=>i.item),runUpdates:e.filter(i=>i.action==="update").map(i=>i.item)};(await this._ensureServerInfo())?.batch_ingest_config?.use_multipart_endpoint?await this.multipartIngestRuns(n,r):await this.batchIngestRuns(n,r)}}catch(n){console.error("Error exporting batch:",n)}}_sendBatchToOTELTranslator(e){if(this.langSmithToOTELTranslator!==void 0){let r=new Map,n=[];for(let o of e)o.item.id&&o.otelContext&&(r.set(o.item.id,o.otelContext),o.action==="create"?n.push({operation:"post",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}):n.push({operation:"patch",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}));this.langSmithToOTELTranslator.exportBatch(n,r)}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.item=xYe(e.item);let r=this.autoBatchQueue.push(e);if(this.manualFlushMode)return r;let n=await this._getBatchSizeLimitBytes();return this.autoBatchQueue.sizeBytes>n&&this.drainAutoBatchQueue(n),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this.drainAutoBatchQueue(n)},this.autoBatchAggregationDelayMs)),r}async _getServerInfo(){let e=await this.caller.call(Wt(this.debug),`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(zOr),...this.fetchOptions});await cn(e,"get server info");let r=await e.json();return this.debug&&console.log(`
=== LangSmith Server Configuration ===
`+JSON.stringify(r,null,2)+`
`),r}async _ensureServerInfo(){return this._getServerInfoPromise===void 0&&(this._getServerInfoPromise=(async()=>{if(this._serverInfo===void 0)try{this._serverInfo=await this._getServerInfo()}catch(e){console.warn(`[WARNING]: LangSmith failed to fetch info on supported operations with status code ${e.status}. Falling back to batch operations and default limits.`)}return this._serverInfo??{}})()),this._getServerInfoPromise.then(e=>(this._serverInfo===void 0&&(this._getServerInfoPromise=void 0),e))}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){let e=await this._getBatchSizeLimitBytes();await this.drainAutoBatchQueue(e)}_cloneCurrentOTELContext(){let e=dQ(),r=u7e();if(this.langSmithToOTELTranslator!==void 0){let n=e.getActiveSpan();if(n)return e.setSpan(r.active(),n)}}async createRun(e,r){if(!this._filterForSampling([e]).length)return;let n={...this.headers,"Content-Type":"application/json"},o=e.project_name;delete e.project_name;let i=await this.prepareRunCreateOrUpdateInputs({session_name:o,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&i.trace_id!==void 0&&i.dotted_order!==void 0){let u=this._cloneCurrentOTELContext();this.processRunOperation({action:"create",item:i,otelContext:u,apiKey:r?.apiKey,apiUrl:r?.apiUrl}).catch(console.error);return}let a=xYe(i);r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey);let s=await this.caller.call(Wt(this.debug),`${r?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,body:_m(a,`Creating run with id: ${a.id}`),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(s,"create run",!0)}async batchIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o=await Promise.all(e?.map(u=>this.prepareRunCreateOrUpdateInputs(u))??[]),i=await Promise.all(r?.map(u=>this.prepareRunCreateOrUpdateInputs(u))??[]);if(o.length>0&&i.length>0){let u=o.reduce((c,d)=>(d.id&&(c[d.id]=d),c),{}),l=[];for(let c of i)c.id!==void 0&&u[c.id]?u[c.id]={...u[c.id],...c}:l.push(c);o=Object.values(u),i=l}let a={post:o,patch:i};if(!a.post.length&&!a.patch.length)return;let s={post:[],patch:[]};for(let u of["post","patch"]){let l=u,c=a[l].reverse(),d=c.pop();for(;d!==void 0;)s[l].push(d),d=c.pop()}if(s.post.length>0||s.patch.length>0){let u=s.post.map(l=>l.id).concat(s.patch.map(l=>l.id)).join(",");await this._postBatchIngestRuns(_m(s,`Ingesting runs with ids: ${u}`),n)}}async _postBatchIngestRuns(e,r){let n={...this.headers,"Content-Type":"application/json",Accept:"application/json"};r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey);let o=await this.batchIngestCaller.call(Wt(this.debug),`${r?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,body:e,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(o,"batch create run",!0)}async multipartIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o={},i=[];for(let d of e??[]){let f=await this.prepareRunCreateOrUpdateInputs(d);f.id!==void 0&&f.attachments!==void 0&&(o[f.id]=f.attachments),delete f.attachments,i.push(f)}let a=[];for(let d of r??[])a.push(await this.prepareRunCreateOrUpdateInputs(d));if(i.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(a.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(i.length>0&&a.length>0){let d=i.reduce((p,m)=>(m.id&&(p[m.id]=m),p),{}),f=[];for(let p of a)p.id!==void 0&&d[p.id]?d[p.id]={...d[p.id],...p}:f.push(p);i=Object.values(d),a=f}if(i.length===0&&a.length===0)return;let l=[],c=[];for(let[d,f]of[["post",i],["patch",a]])for(let p of f){let{inputs:m,outputs:h,events:y,attachments:g,..._}=p,w={inputs:m,outputs:h,events:y},S=_m(_,`Serializing for multipart ingestion of run with id: ${_.id}`);c.push({name:`${d}.${_.id}`,payload:new Blob([S],{type:`application/json; length=${S.length}`})});for(let[C,E]of Object.entries(w)){if(E===void 0)continue;let P=_m(E,`Serializing ${C} for multipart ingestion of run with id: ${_.id}`);c.push({name:`${d}.${_.id}.${C}`,payload:new Blob([P],{type:`application/json; length=${P.length}`})})}if(_.id!==void 0){let C=o[_.id];if(C){delete o[_.id];for(let[E,P]of Object.entries(C)){let T,I;if(Array.isArray(P)?[T,I]=P:(T=P.mimeType,I=P.data),E.includes(".")){console.warn(`Skipping attachment '${E}' for run ${_.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}c.push({name:`attachment.${_.id}.${E}`,payload:new Blob([I],{type:`${T}; length=${I.byteLength}`})})}}}l.push(`trace=${_.trace_id},id=${_.id}`)}await this._sendMultipartRequest(c,l.join("; "),n)}async _createNodeFetchBody(e,r){let n=[];for(let a of e)n.push(new Blob([`--${r}\r
`])),n.push(new Blob([`Content-Disposition: form-data; name="${a.name}"\r
`,`Content-Type: ${a.payload.type}\r
\r
`])),n.push(a.payload),n.push(new Blob([`\r
`]));return n.push(new Blob([`--${r}--\r
`])),await new Blob(n).arrayBuffer()}async _createMultipartStream(e,r){let n=new TextEncoder;return new ReadableStream({async start(i){let a=async s=>{typeof s=="string"?i.enqueue(n.encode(s)):i.enqueue(s)};for(let s of e){await a(`--${r}\r
`),await a(`Content-Disposition: form-data; name="${s.name}"\r
`),await a(`Content-Type: ${s.payload.type}\r
\r
`);let l=s.payload.stream().getReader();try{let c;for(;!(c=await l.read()).done;)i.enqueue(c.value)}finally{l.releaseLock()}await a(`\r
`)}await a(`--${r}--\r
`),i.close()}})}async _sendMultipartRequest(e,r,n){let o="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),i=o7e(),a=()=>this._createNodeFetchBody(e,o),s=()=>this._createMultipartStream(e,o),u=async l=>{let c={...this.headers,"Content-Type":`multipart/form-data; boundary=${o}`};return n?.apiKey!==void 0&&(c["x-api-key"]=n.apiKey),this.batchIngestCaller.call(Wt(this.debug),`${n?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:c,body:l,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})};try{let l,c=!1;!i&&!this.multipartStreamingDisabled?(c=!0,l=await u(await s())):l=await u(await a()),(!this.multipartStreamingDisabled||c)&&l.status===422&&(n?.apiUrl??this.apiUrl)!==CYe&&(console.warn(`Streaming multipart upload to ${n?.apiUrl??this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${r}".`),this.multipartStreamingDisabled=!0,l=await u(await a())),await cn(l,"ingest multipart runs",!0)}catch(l){console.warn(`${l.message.trim()}
Context: ${r}`)}}async updateRun(e,r,n){nn(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let o={...r,id:e};if(!this._filterForSampling([o],!0).length)return;if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){let s=this._cloneCurrentOTELContext();if(r.end_time!==void 0&&o.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:o,otelContext:s,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}else this.processRunOperation({action:"update",item:o,otelContext:s,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}let i={...this.headers,"Content-Type":"application/json"};n?.apiKey!==void 0&&(i["x-api-key"]=n.apiKey);let a=await this.caller.call(Wt(this.debug),`${n?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,body:_m(r,`Serializing payload to update run with id: ${e}`),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(a,"update run",!0)}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){nn(e);let n=await this._get(`/runs/${e}`);return r&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:r,projectOpts:n}){if(r!==void 0){let o;r.session_id?o=r.session_id:n?.projectName?o=(await this.readProject({projectName:n?.projectName})).id:n?.projectId?o=n?.projectId:o=(await this.readProject({projectName:ac("PROJECT")||"default"})).id;let i=await this._getTenantId();return`${this.getHostUrl()}/o/${i}/projects/p/${o}/r/${r.id}?poll=true`}else if(e!==void 0){let o=await this.readRun(e);if(!o.app_path)throw new Error(`Run ${e} has no app_path`);return`${this.getHostUrl()}${o.app_path}`}else throw new Error("Must provide either runId or run")}async _loadChildRuns(e){let r=await kOr(this.listRuns({isRoot:!1,projectId:e.session_id,traceId:e.trace_id})),n={},o={};r.sort((i,a)=>(i?.dotted_order??"").localeCompare(a?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.dotted_order?.startsWith(e.dotted_order??"")&&i.id!==e.id&&(i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i)}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:a,startTime:s,executionOrder:u,isRoot:l,runType:c,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:y,limit:g,select:_,order:w}=e,S=[];if(r&&(S=Array.isArray(r)?r:[r]),n){let T=Array.isArray(n)?n:[n],I=await Promise.all(T.map(N=>this.readProject({projectName:N}).then(M=>M.id)));S.push(...I)}let C=["app_path","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],E={session:S.length?S:null,run_type:c,reference_example:a,query:p,filter:m,trace_filter:h,tree_filter:y,execution_order:u,parent_run:o,start_time:s?s.toISOString():null,error:d,id:f,limit:g,trace:i,select:_||C,is_root:l,order:w},P=0;for await(let T of this._getCursorPaginatedList("/runs/query",E))if(g){if(P>=g)break;if(T.length+P>g){yield*T.slice(0,g-P);break}P+=T.length,yield*T}else yield*T}async*listGroupRuns(e){let{projectId:r,projectName:n,groupBy:o,filter:i,startTime:a,endTime:s,limit:u,offset:l}=e,d={session_id:r||(await this.readProject({projectName:n})).id,group_by:o,filter:i,start_time:a?a.toISOString():null,end_time:s?s.toISOString():null,limit:Number(u)||100},f=Number(l)||0,p="/runs/group",m=`${this.apiUrl}${p}`;for(;;){let h={...d,offset:f},y=Object.fromEntries(Object.entries(h).filter(([C,E])=>E!==void 0)),g=await this.caller.call(Wt(),m,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(y),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(g,`Failed to fetch ${p}`);let _=await g.json(),{groups:w,total:S}=_;if(w.length===0)break;for(let C of w)yield C;if(f+=w.length,f>=S)break}}async getRunStats({id:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:a,referenceExampleIds:s,startTime:u,endTime:l,error:c,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:y}){let g=a||[];i&&(g=[...a||[],...await Promise.all(i.map(E=>this.readProject({projectName:E}).then(P=>P.id)))]);let w=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:g,reference_example:s,start_time:u,end_time:l,error:c,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:y}).filter(([E,P])=>P!==void 0));return await(await this.caller.call(Wt(this.debug),`${this.apiUrl}/runs/stats`,{method:"POST",headers:this.headers,body:JSON.stringify(w),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||Rs()};nn(e);let i=await(await this.caller.call(Wt(this.debug),`${this.apiUrl}/runs/${e}/share`,{method:"PUT",headers:this.headers,body:JSON.stringify(n),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();if(i===null||!("share_token"in i))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${i.share_token}/r`}async unshareRun(e){nn(e);let r=await this.caller.call(Wt(this.debug),`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(r,"unshare run",!0)}async readRunSharedLink(e){nn(e);let n=await(await this.caller.call(Wt(this.debug),`${this.apiUrl}/runs/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();if(!(n===null||!("share_token"in n)))return`${this.getHostUrl()}/public/${n.share_token}/r`}async listSharedRuns(e,{runIds:r}={}){let n=new URLSearchParams({share_token:e});if(r!==void 0)for(let a of r)n.append("id",a);return nn(e),await(await this.caller.call(Wt(this.debug),`${this.apiUrl}/public/${e}/runs${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async readDatasetSharedSchema(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id),nn(e);let o=await(await this.caller.call(Wt(this.debug),`${this.apiUrl}/datasets/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();return o.url=`${this.getHostUrl()}/public/${o.share_token}/d`,o}async shareDataset(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id);let n={dataset_id:e};nn(e);let i=await(await this.caller.call(Wt(this.debug),`${this.apiUrl}/datasets/${e}/share`,{method:"PUT",headers:this.headers,body:JSON.stringify(n),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();return i.url=`${this.getHostUrl()}/public/${i.share_token}/d`,i}async unshareDataset(e){nn(e);let r=await this.caller.call(Wt(this.debug),`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(r,"unshare dataset",!0)}async readSharedDataset(e){return nn(e),await(await this.caller.call(Wt(this.debug),`${this.apiUrl}/public/${e}/datasets`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async listSharedExamples(e,r){let n={};r?.exampleIds&&(n.id=r.exampleIds);let o=new URLSearchParams;Object.entries(n).forEach(([s,u])=>{Array.isArray(u)?u.forEach(l=>o.append(s,l)):o.append(s,u)});let i=await this.caller.call(Wt(this.debug),`${this.apiUrl}/public/${e}/examples?${o.toString()}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions}),a=await i.json();if(!i.ok)throw"detail"in a?new Error(`Failed to list shared examples.
Status: ${i.status}
Message: ${Array.isArray(a.detail)?a.detail.join(`
`):"Unspecified error"}`):new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`);return a.map(s=>({...s,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:r=null,metadata:n=null,upsert:o=!1,projectExtra:i=null,referenceDatasetId:a=null}){let s=o?"?upsert=true":"",u=`${this.apiUrl}/sessions${s}`,l=i||{};n&&(l.metadata=n);let c={name:e,extra:l,description:r};a!==null&&(c.reference_dataset_id=a);let d=await this.caller.call(Wt(this.debug),u,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(c),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(d,"create project"),await d.json()}async updateProject(e,{name:r=null,description:n=null,metadata:o=null,projectExtra:i=null,endTime:a=null}){let s=`${this.apiUrl}/sessions/${e}`,u=i;o&&(u={...u||{},metadata:o});let l={name:r,extra:u,description:n,end_time:a?new Date(a).toISOString():null},c=await this.caller.call(Wt(this.debug),s,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(l),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(c,"update project"),await c.json()}async hasProject({projectId:e,projectName:r}){let n="/sessions",o=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)nn(e),n+=`/${e}`;else if(r!==void 0)o.append("name",r);else throw new Error("Must provide projectName or projectId");let i=await this.caller.call(Wt(this.debug),`${this.apiUrl}${n}?${o}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});try{let a=await i.json();return i.ok?Array.isArray(a)?a.length>0:!0:!1}catch{return!1}}async readProject({projectId:e,projectName:r,includeStats:n}){let o="/sessions",i=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)nn(e),o+=`/${e}`;else if(r!==void 0)i.append("name",r);else throw new Error("Must provide projectName or projectId");n!==void 0&&i.append("include_stats",n.toString());let a=await this._get(o,i),s;if(Array.isArray(a)){if(a.length===0)throw new Error(`Project[id=${e}, name=${r}] not found`);s=a[0]}else s=a;return s}async getProjectUrl({projectId:e,projectName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either projectName or projectId");let n=await this.readProject({projectId:e,projectName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/projects/p/${n.id}`}async getDatasetUrl({datasetId:e,datasetName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");let n=await this.readDataset({datasetId:e,datasetName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/datasets/${n.id}`}async _getTenantId(){if(this._tenantId!==null)return this._tenantId;let e=new URLSearchParams({limit:"1"});for await(let r of this._getPaginated("/sessions",e))return this._tenantId=r[0].tenant_id,r[0].tenant_id;throw new Error("No projects found to resolve tenant.")}async*listProjects({projectIds:e,name:r,nameContains:n,referenceDatasetId:o,referenceDatasetName:i,referenceFree:a,metadata:s}={}){let u=new URLSearchParams;if(e!==void 0)for(let l of e)u.append("id",l);if(r!==void 0&&u.append("name",r),n!==void 0&&u.append("name_contains",n),o!==void 0)u.append("reference_dataset",o);else if(i!==void 0){let l=await this.readDataset({datasetName:i});u.append("reference_dataset",l.id)}a!==void 0&&u.append("reference_free",a.toString()),s!==void 0&&u.append("metadata",JSON.stringify(s));for await(let l of this._getPaginated("/sessions",u))yield*l}async deleteProject({projectId:e,projectName:r}){let n;if(e===void 0&&r===void 0)throw new Error("Must provide projectName or projectId");if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");e===void 0?n=(await this.readProject({projectName:r})).id:n=e,nn(n);let o=await this.caller.call(Wt(this.debug),`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(o,`delete session ${n} (${r})`,!0)}async uploadCsv({csvFile:e,fileName:r,inputKeys:n,outputKeys:o,description:i,dataType:a,name:s}){let u=`${this.apiUrl}/datasets/upload`,l=new FormData;l.append("file",e,r),n.forEach(f=>{l.append("input_keys",f)}),o.forEach(f=>{l.append("output_keys",f)}),i&&l.append("description",i),a&&l.append("data_type",a),s&&l.append("name",s);let c=await this.caller.call(Wt(this.debug),u,{method:"POST",headers:this.headers,body:l,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(c,"upload CSV"),await c.json()}async createDataset(e,{description:r,dataType:n,inputsSchema:o,outputsSchema:i,metadata:a}={}){let s={name:e,description:r,extra:a?{metadata:a}:void 0};n&&(s.data_type=n),o&&(s.inputs_schema_definition=o),i&&(s.outputs_schema_definition=i);let u=await this.caller.call(Wt(this.debug),`${this.apiUrl}/datasets`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(s),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(u,"create dataset"),await u.json()}async readDataset({datasetId:e,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(e&&r)throw new Error("Must provide either datasetName or datasetId, not both");if(e)nn(e),n+=`/${e}`;else if(r)o.append("name",r);else throw new Error("Must provide datasetName or datasetId");let i=await this._get(n,o),a;if(Array.isArray(i)){if(i.length===0)throw new Error(`Dataset[id=${e}, name=${r}] not found`);a=i[0]}else a=i;return a}async hasDataset({datasetId:e,datasetName:r}){try{return await this.readDataset({datasetId:e,datasetName:r}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:e,datasetName:r,fromVersion:n,toVersion:o}){let i=e;if(i===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");if(i!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");i===void 0&&(i=(await this.readDataset({datasetName:r})).id);let a=new URLSearchParams({from_version:typeof n=="string"?n:n.toISOString(),to_version:typeof o=="string"?o:o.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,a)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:r}){let n="/datasets";if(e===void 0)if(r!==void 0)e=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide either datasetName or datasetId");return(await(await this._getResponse(`${n}/${e}/openai_ft`)).text()).trim().split(`
`).map(s=>JSON.parse(s))}async*listDatasets({limit:e=100,offset:r=0,datasetIds:n,datasetName:o,datasetNameContains:i,metadata:a}={}){let s="/datasets",u=new URLSearchParams({limit:e.toString(),offset:r.toString()});if(n!==void 0)for(let l of n)u.append("id",l);o!==void 0&&u.append("name",o),i!==void 0&&u.append("name_contains",i),a!==void 0&&u.append("metadata",JSON.stringify(a));for await(let l of this._getPaginated(s,u))yield*l}async updateDataset(e){let{datasetId:r,datasetName:n,...o}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let i=r??(await this.readDataset({datasetName:n})).id;nn(i);let a=await this.caller.call(Wt(this.debug),`${this.apiUrl}/datasets/${i}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(o),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(a,"update dataset"),await a.json()}async updateDatasetTag(e){let{datasetId:r,datasetName:n,asOf:o,tag:i}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let a=r??(await this.readDataset({datasetName:n})).id;nn(a);let s=await this.caller.call(Wt(this.debug),`${this.apiUrl}/datasets/${a}/tags`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify({as_of:typeof o=="string"?o:o.toISOString(),tag:i}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(s,"update dataset tags")}async deleteDataset({datasetId:e,datasetName:r}){let n="/datasets",o=e;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(r!==void 0&&(o=(await this.readDataset({datasetName:r})).id),o!==void 0)nn(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");let i=await this.caller.call(Wt(this.debug),this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(i,`delete ${n}`),await i.json()}async indexDataset({datasetId:e,datasetName:r,tag:n}){let o=e;if(!o&&!r)throw new Error("Must provide either datasetName or datasetId");if(o&&r)throw new Error("Must provide either datasetName or datasetId, not both");o||(o=(await this.readDataset({datasetName:r})).id),nn(o);let i={tag:n},a=await this.caller.call(Wt(this.debug),`${this.apiUrl}/datasets/${o}/index`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(a,"index dataset"),await a.json()}async similarExamples(e,r,n,{filter:o}={}){let i={limit:n,inputs:e};o!==void 0&&(i.filter=o),nn(r);let a=await this.caller.call(Wt(this.debug),`${this.apiUrl}/datasets/${r}/search`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(a,"fetch similar examples"),(await a.json()).examples}async createExample(e,r,n){if(OYe(e)&&(r!==void 0||n!==void 0))throw new Error("Cannot provide outputs or options when using ExampleCreate object");let o=r?n?.datasetId:e.dataset_id,i=r?n?.datasetName:e.dataset_name;if(o===void 0&&i===void 0)throw new Error("Must provide either datasetName or datasetId");if(o!==void 0&&i!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");o===void 0&&(o=(await this.readDataset({datasetName:i})).id);let a=(r?n?.createdAt:e.created_at)||new Date,s;OYe(e)?s=e:s={inputs:e,outputs:r,created_at:a?.toISOString(),id:n?.exampleId,metadata:n?.metadata,split:n?.split,source_run_id:n?.sourceRunId,use_source_run_io:n?.useSourceRunIO,use_source_run_attachments:n?.useSourceRunAttachments,attachments:n?.attachments};let u=await this._uploadExamplesMultipart(o,[s]);return await this.readExample(u.example_ids?.[0]??Rs())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let _=e,w=_[0].dataset_id,S=_[0].dataset_name;if(w===void 0&&S===void 0)throw new Error("Must provide either datasetName or datasetId");if(w!==void 0&&S!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");w===void 0&&(w=(await this.readDataset({datasetName:S})).id);let C=await this._uploadExamplesMultipart(w,_);return await Promise.all(C.example_ids.map(P=>this.readExample(P)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:a,useSourceRunIOs:s,useSourceRunAttachments:u,attachments:l,exampleIds:c,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((_,w)=>({dataset_id:p,inputs:_,outputs:n?.[w],metadata:o?.[w],split:i?.[w],id:c?.[w],attachments:l?.[w],source_run_id:a?.[w],use_source_run_io:s?.[w],use_source_run_attachments:u?.[w]})),y=await this._uploadExamplesMultipart(p,h);return await Promise.all(y.example_ids.map(_=>this.readExample(_)))}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(a=>x0e(a)?S0e(a):a),i=x0e(r)?S0e(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){nn(e);let r=`/examples/${e}`,n=await this._get(r),{attachment_urls:o,...i}=n,a=i;return o&&(a.attachments=Object.entries(o).reduce((s,[u,l])=>(s[u.slice(11)]={presigned_url:l.presigned_url,mime_type:l.mime_type},s),{})),a}async*listExamples({datasetId:e,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:a,metadata:s,limit:u,offset:l,filter:c,includeAttachments:d}={}){let f;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),m=o?typeof o=="string"?o:o?.toISOString():void 0;m&&p.append("as_of",m);let h=a??!0;if(p.append("inline_s3_urls",h.toString()),n!==void 0)for(let g of n)p.append("id",g);if(i!==void 0)for(let g of i)p.append("splits",g);if(s!==void 0){let g=JSON.stringify(s);p.append("metadata",g)}u!==void 0&&p.append("limit",u.toString()),l!==void 0&&p.append("offset",l.toString()),c!==void 0&&p.append("filter",c),d===!0&&["attachment_urls","outputs","metadata"].forEach(g=>p.append("select",g));let y=0;for await(let g of this._getPaginated("/examples",p)){for(let _ of g){let{attachment_urls:w,...S}=_,C=S;w&&(C.attachments=Object.entries(w).reduce((E,[P,T])=>(E[P.slice(11)]={presigned_url:T.presigned_url,mime_type:T.mime_type||void 0},E),{})),yield C,y++}if(u!==void 0&&y>=u)break}}async deleteExample(e){nn(e);let r=`/examples/${e}`,n=await this.caller.call(Wt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(n,`delete ${r}`),await n.json()}async updateExample(e,r){let n;r?n=e:n=e.id,nn(n);let o;r?o={id:n,...r}:o=e;let i;return o.dataset_id!==void 0?i=o.dataset_id:i=(await this.readExample(n)).dataset_id,this._updateExamplesMultipart(i,[o])}async updateExamples(e){let r;return e[0].dataset_id===void 0?r=(await this.readExample(e[0].id)).dataset_id:r=e[0].dataset_id,this._updateExamplesMultipart(r,e)}async readDatasetVersion({datasetId:e,datasetName:r,asOf:n,tag:o}){let i;if(e?i=e:i=(await this.readDataset({datasetName:r})).id,nn(i),n&&o||!n&&!o)throw new Error("Exactly one of asOf and tag must be specified.");let a=new URLSearchParams;n!==void 0&&a.append("as_of",typeof n=="string"?n:n.toISOString()),o!==void 0&&a.append("tag",o);let s=await this.caller.call(Wt(this.debug),`${this.apiUrl}/datasets/${i}/version?${a.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(s,"read dataset version"),await s.json()}async listDatasetSplits({datasetId:e,datasetName:r,asOf:n}){let o;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?o=(await this.readDataset({datasetName:r})).id:o=e,nn(o);let i=new URLSearchParams,a=n?typeof n=="string"?n:n?.toISOString():void 0;return a&&i.append("as_of",a),await this._get(`/datasets/${o}/splits`,i)}async updateDatasetSplits({datasetId:e,datasetName:r,splitName:n,exampleIds:o,remove:i=!1}){let a;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?a=(await this.readDataset({datasetName:r})).id:a=e,nn(a);let s={split_name:n,examples:o.map(l=>(nn(l),l)),remove:i},u=await this.caller.call(Wt(this.debug),`${this.apiUrl}/datasets/${a}/splits`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(s),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(u,"update dataset splits",!0)}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){_Q("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let a;if(typeof e=="string")a=await this.readRun(e,{loadChildRuns:o});else if(typeof e=="object"&&"id"in e)a=e;else throw new Error(`Invalid run type: ${typeof e}`);a.reference_example_id!==null&&a.reference_example_id!==void 0&&(i=await this.readExample(a.reference_example_id));let s=await r.evaluateRun(a,i),[u,l]=await this._logEvaluationFeedback(s,a,n);return l[0]}async createFeedback(e,r,{score:n,value:o,correction:i,comment:a,sourceInfo:s,feedbackSourceType:u="api",sourceRunId:l,feedbackId:c,feedbackConfig:d,projectId:f,comparativeExperimentId:p}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let m={type:u??"api",metadata:s??{}};l!==void 0&&m?.metadata!==void 0&&!m.metadata.__run&&(m.metadata.__run={run_id:l}),m?.metadata!==void 0&&m.metadata.__run?.run_id!==void 0&&nn(m.metadata.__run.run_id);let h={id:c??Rs(),run_id:e,key:r,score:SYe(n),value:o,correction:i,comment:a,feedback_source:m,comparative_experiment_id:p,feedbackConfig:d,session_id:f},y=`${this.apiUrl}/feedback`,g=await this.caller.call(Wt(this.debug),y,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(h),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(g,"create feedback",!0),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let a={};r!=null&&(a.score=SYe(r)),n!=null&&(a.value=n),o!=null&&(a.correction=o),i!=null&&(a.comment=i),nn(e);let s=await this.caller.call(Wt(this.debug),`${this.apiUrl}/feedback/${e}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(a),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(s,"update feedback",!0)}async readFeedback(e){nn(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){nn(e);let r=`/feedback/${e}`,n=await this.caller.call(Wt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(n,`delete ${r}`),await n.json()}async*listFeedback({runIds:e,feedbackKeys:r,feedbackSourceTypes:n}={}){let o=new URLSearchParams;if(e&&o.append("run",e.join(",")),r)for(let i of r)o.append("key",i);if(n)for(let i of n)o.append("source",i);for await(let i of this._getPaginated("/feedback",o))yield*i}async createPresignedFeedbackToken(e,r,{expiration:n,feedbackConfig:o}={}){let i={run_id:e,feedback_key:r,feedback_config:o};return n?typeof n=="string"?i.expires_at=n:(n?.hours||n?.minutes||n?.days)&&(i.expires_in=n):i.expires_in={hours:3},await(await this.caller.call(Wt(this.debug),`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async createComparativeExperiment({name:e,experimentIds:r,referenceDatasetId:n,createdAt:o,description:i,metadata:a,id:s}){if(r.length===0)throw new Error("At least one experiment is required");if(n||(n=(await this.readProject({projectId:r[0]})).reference_dataset_id),!n==null)throw new Error("A reference dataset is required");let u={id:s,name:e,experiment_ids:r,reference_dataset_id:n,description:i,created_at:(o??new Date)?.toISOString(),extra:{}};return a&&(u.extra.metadata=a),await(await this.caller.call(Wt(this.debug),`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(u),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async*listPresignedFeedbackTokens(e){nn(e);let r=new URLSearchParams({run_id:e});for await(let n of this._getPaginated("/feedback/tokens",r))yield*n}_selectEvalResults(e){let r;return"results"in e?r=e.results:Array.isArray(e)?r=e:r=[e],r}async _logEvaluationFeedback(e,r,n){let o=this._selectEvalResults(e),i=[];for(let a of o){let s=n||{};a.evaluatorInfo&&(s={...a.evaluatorInfo,...s});let u=null;a.targetRunId?u=a.targetRunId:r&&(u=r.id),i.push(await this.createFeedback(u,a.key,{score:a.score,value:a.value,comment:a.comment,correction:a.correction,sourceInfo:s,sourceRunId:a.sourceRunId,feedbackConfig:a.feedbackConfig,feedbackSourceType:"model"}))}return[o,i]}async logEvaluationFeedback(e,r,n){let[o]=await this._logEvaluationFeedback(e,r,n);return o}async*listAnnotationQueues(e={}){let{queueIds:r,name:n,nameContains:o,limit:i}=e,a=new URLSearchParams;r&&r.forEach((u,l)=>{nn(u,`queueIds[${l}]`),a.append("ids",u)}),n&&a.append("name",n),o&&a.append("name_contains",o),a.append("limit",(i!==void 0?Math.min(i,100):100).toString());let s=0;for await(let u of this._getPaginated("/annotation-queues",a))if(yield*u,s++,i!==void 0&&s>=i)break}async createAnnotationQueue(e){let{name:r,description:n,queueId:o,rubricInstructions:i}=e,a={name:r,description:n,id:o||Rs(),rubric_instructions:i},s=await this.caller.call(Wt(this.debug),`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(Object.fromEntries(Object.entries(a).filter(([l,c])=>c!==void 0))),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(s,"create annotation queue"),await s.json()}async readAnnotationQueue(e){let r=await this.caller.call(Wt(this.debug),`${this.apiUrl}/annotation-queues/${nn(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(r,"read annotation queue"),await r.json()}async updateAnnotationQueue(e,r){let{name:n,description:o,rubricInstructions:i}=r,a=await this.caller.call(Wt(this.debug),`${this.apiUrl}/annotation-queues/${nn(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify({name:n,description:o,rubric_instructions:i}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(a,"update annotation queue")}async deleteAnnotationQueue(e){let r=await this.caller.call(Wt(this.debug),`${this.apiUrl}/annotation-queues/${nn(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(r,"delete annotation queue")}async addRunsToAnnotationQueue(e,r){let n=await this.caller.call(Wt(this.debug),`${this.apiUrl}/annotation-queues/${nn(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(r.map((o,i)=>nn(o,`runIds[${i}]`).toString())),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(n,"add runs to annotation queue")}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${nn(e,"queueId")}/run`,o=await this.caller.call(Wt(this.debug),`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(o,"get run from annotation queue"),await o.json()}async deleteRunFromAnnotationQueue(e,r){let n=await this.caller.call(Wt(this.debug),`${this.apiUrl}/annotation-queues/${nn(e,"queueId")}/runs/${nn(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(n,"delete run from annotation queue")}async getSizeFromAnnotationQueue(e){let r=await this.caller.call(Wt(this.debug),`${this.apiUrl}/annotation-queues/${nn(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(r,"get size from annotation queue"),await r.json()}async _currentTenantIsOwner(e){let r=await this._getSettings();return e=="-"||r.tenant_handle===e}async _ownerConflictError(e,r){let n=await this._getSettings();return new Error(`Cannot ${e} for another tenant.
Current tenant: ${n.tenant_handle}
Requested tenant: ${r}`)}async _getLatestCommitHash(e){let r=await this.caller.call(Wt(this.debug),`${this.apiUrl}/commits/${e}/?limit=1&offset=0`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions}),n=await r.json();if(!r.ok){let o=typeof n.detail=="string"?n.detail:JSON.stringify(n.detail),i=new Error(`Error ${r.status}: ${r.statusText}
${o}`);throw i.statusCode=r.status,i}if(n.commits.length!==0)return n.commits[0].commit_hash}async _likeOrUnlikePrompt(e,r){let[n,o,i]=vE(e),a=await this.caller.call(Wt(this.debug),`${this.apiUrl}/likes/${n}/${o}`,{method:"POST",body:JSON.stringify({like:r}),headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(a,`${r?"like":"unlike"} prompt`),await a.json()}async _getPromptUrl(e){let[r,n,o]=vE(e);if(await this._currentTenantIsOwner(r)){let i=await this._getSettings();return o!=="latest"?`${this.getHostUrl()}/prompts/${n}/${o.substring(0,8)}?organizationId=${i.id}`:`${this.getHostUrl()}/prompts/${n}?organizationId=${i.id}`}else return o!=="latest"?`${this.getHostUrl()}/hub/${r}/${n}/${o.substring(0,8)}`:`${this.getHostUrl()}/hub/${r}/${n}`}async promptExists(e){return!!await this.getPrompt(e)}async likePrompt(e){return this._likeOrUnlikePrompt(e,!0)}async unlikePrompt(e){return this._likeOrUnlikePrompt(e,!1)}async*listCommits(e){for await(let r of this._getPaginated(`/commits/${e}/`,new URLSearchParams,n=>n.commits))yield*r}async*listPrompts(e){let r=new URLSearchParams;r.append("sort_field",e?.sortField??"updated_at"),r.append("sort_direction","desc"),r.append("is_archived",(!!e?.isArchived).toString()),e?.isPublic!==void 0&&r.append("is_public",e.isPublic.toString()),e?.query&&r.append("query",e.query);for await(let n of this._getPaginated("/repos",r,o=>o.repos))yield*n}async getPrompt(e){let[r,n,o]=vE(e),i=await this.caller.call(Wt(this.debug),`${this.apiUrl}/repos/${r}/${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});if(i.status===404)return null;await cn(i,"get prompt");let a=await i.json();return a.repo?a.repo:null}async createPrompt(e,r){let n=await this._getSettings();if(r?.isPublic&&!n.tenant_handle)throw new Error(`Cannot create a public prompt without first
creating a LangChain Hub handle.
You can add a handle by creating a public prompt at:
https://smith.langchain.com/prompts`);let[o,i,a]=vE(e);if(!await this._currentTenantIsOwner(o))throw await this._ownerConflictError("create a prompt",o);let s={repo_handle:i,...r?.description&&{description:r.description},...r?.readme&&{readme:r.readme},...r?.tags&&{tags:r.tags},is_public:!!r?.isPublic},u=await this.caller.call(Wt(this.debug),`${this.apiUrl}/repos/`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(s),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(u,"create prompt");let{repo:l}=await u.json();return l}async createCommit(e,r,n){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[o,i,a]=vE(e),s=n?.parentCommitHash==="latest"||!n?.parentCommitHash?await this._getLatestCommitHash(`${o}/${i}`):n?.parentCommitHash,u={manifest:JSON.parse(JSON.stringify(r)),parent_commit:s},l=await this.caller.call(Wt(this.debug),`${this.apiUrl}/commits/${o}/${i}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(u),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(l,"create commit");let c=await l.json();return this._getPromptUrl(`${o}/${i}${c.commit_hash?`:${c.commit_hash}`:""}`)}async updateExamplesMultipart(e,r=[]){return this._updateExamplesMultipart(e,r)}async _updateExamplesMultipart(e,r=[]){if(!await this._getMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let s of r){let u=s.id,l={...s.metadata&&{metadata:s.metadata},...s.split&&{split:s.split}},c=_m(l,`Serializing body for example with id: ${u}`),d=new Blob([c],{type:"application/json"});if(n.append(u,d),s.inputs){let f=_m(s.inputs,`Serializing inputs for example with id: ${u}`),p=new Blob([f],{type:"application/json"});n.append(`${u}.inputs`,p)}if(s.outputs){let f=_m(s.outputs,`Serializing outputs whle updating example with id: ${u}`),p=new Blob([f],{type:"application/json"});n.append(`${u}.outputs`,p)}if(s.attachments)for(let[f,p]of Object.entries(s.attachments)){let m,h;Array.isArray(p)?[m,h]=p:(m=p.mimeType,h=p.data);let y=new Blob([h],{type:`${m}; length=${h.byteLength}`});n.append(`${u}.attachment.${f}`,y)}if(s.attachments_operations){let f=_m(s.attachments_operations,`Serializing attachments while updating example with id: ${u}`),p=new Blob([f],{type:"application/json"});n.append(`${u}.attachments_operations`,p)}}let o=e??r[0]?.dataset_id;return await(await this.caller.call(Wt(this.debug),`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${o}/examples`)}`,{method:"PATCH",headers:this.headers,body:n})).json()}async uploadExamplesMultipart(e,r=[]){return this._uploadExamplesMultipart(e,r)}async _uploadExamplesMultipart(e,r=[]){if(!await this._getMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let a of r){let s=(a.id??Rs()).toString(),u={created_at:a.created_at,...a.metadata&&{metadata:a.metadata},...a.split&&{split:a.split},...a.source_run_id&&{source_run_id:a.source_run_id},...a.use_source_run_io&&{use_source_run_io:a.use_source_run_io},...a.use_source_run_attachments&&{use_source_run_attachments:a.use_source_run_attachments}},l=_m(u,`Serializing body for uploaded example with id: ${s}`),c=new Blob([l],{type:"application/json"});if(n.append(s,c),a.inputs){let d=_m(a.inputs,`Serializing inputs for uploaded example with id: ${s}`),f=new Blob([d],{type:"application/json"});n.append(`${s}.inputs`,f)}if(a.outputs){let d=_m(a.outputs,`Serializing outputs for uploaded example with id: ${s}`),f=new Blob([d],{type:"application/json"});n.append(`${s}.outputs`,f)}if(a.attachments)for(let[d,f]of Object.entries(a.attachments)){let p,m;Array.isArray(f)?[p,m]=f:(p=f.mimeType,m=f.data);let h=new Blob([m],{type:`${p}; length=${m.byteLength}`});n.append(`${s}.attachment.${d}`,h)}}let o=await this.caller.call(Wt(this.debug),`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${e}/examples`)}`,{method:"POST",headers:this.headers,body:n});return await cn(o,"upload examples"),await o.json()}async updatePrompt(e,r){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[n,o]=vE(e);if(!await this._currentTenantIsOwner(n))throw await this._ownerConflictError("update a prompt",n);let i={};if(r?.description!==void 0&&(i.description=r.description),r?.readme!==void 0&&(i.readme=r.readme),r?.tags!==void 0&&(i.tags=r.tags),r?.isPublic!==void 0&&(i.is_public=r.isPublic),r?.isArchived!==void 0&&(i.is_archived=r.isArchived),Object.keys(i).length===0)throw new Error("No valid update options provided");let a=await this.caller.call(Wt(this.debug),`${this.apiUrl}/repos/${n}/${o}`,{method:"PATCH",body:JSON.stringify(i),headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(a,"update prompt"),a.json()}async deletePrompt(e){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[r,n,o]=vE(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return await(await this.caller.call(Wt(this.debug),`${this.apiUrl}/repos/${r}/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async pullPromptCommit(e,r){let[n,o,i]=vE(e),a=await this.caller.call(Wt(this.debug),`${this.apiUrl}/commits/${n}/${o}/${i}${r?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(a,"pull prompt commit");let s=await a.json();return{owner:n,repo:o,commit_hash:s.commit_hash,manifest:s.manifest,examples:s.examples}}async _pullPrompt(e,r){let n=await this.pullPromptCommit(e,{includeModel:r?.includeModel});return JSON.stringify(n.manifest)}async pushPrompt(e,r){return await this.promptExists(e)?r&&Object.keys(r).some(o=>o!=="object")&&await this.updatePrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}):await this.createPrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}),r?.object?await this.createCommit(e,r?.object,{parentCommitHash:r?.parentCommitHash}):await this._getPromptUrl(e)}async clonePublicDataset(e,r={}){let{sourceApiUrl:n=this.apiUrl,datasetName:o}=r,[i,a]=this.parseTokenOrUrl(e,n),s=new t({apiUrl:i,apiKey:"placeholder"}),u=await s.readSharedDataset(a),l=o||u.name;try{if(await this.hasDataset({datasetId:l})){console.log(`Dataset ${l} already exists in your tenant. Skipping.`);return}}catch{}let c=await s.listSharedExamples(a),d=await this.createDataset(l,{description:u.description,dataType:u.data_type||"kv",inputsSchema:u.inputs_schema_definition??void 0,outputsSchema:u.outputs_schema_definition??void 0});try{await this.createExamples({inputs:c.map(f=>f.inputs),outputs:c.flatMap(f=>f.outputs?[f.outputs]:[]),datasetId:d.id})}catch(f){throw console.error(`An error occurred while creating dataset ${l}. You should delete it manually.`),f}}parseTokenOrUrl(e,r,n=2,o="dataset"){try{return nn(e),[r,e]}catch{}try{let a=new URL(e).pathname.split("/").filter(s=>s!=="");if(a.length>=n){let s=a[a.length-n];return[r,s]}else throw new Error(`Invalid public ${o} URL: ${e}`)}catch{throw new Error(`Invalid public ${o} URL or token: ${e}`)}}async awaitPendingTraceBatches(){if(this.manualFlushMode)return console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve();await Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()]),this.langSmithToOTELTranslator!==void 0&&await l7e()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}}});var EYe,PYe=b(()=>{yE();EYe=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>ac(r)==="true")});var NQ,TYe=b(()=>{NQ=Symbol.for("lc:context_variables")});function UOr(t){return t.replace(/[-:.]/g,"")}function J0e(t,e,r=1){let n=r.toFixed(0).slice(0,3).padStart(3,"0"),o=`${new Date(t).toISOString().slice(0,-1)}${n}Z`;return{dottedOrder:UOr(o)+e,microsecondPrecisionDatestring:o}}function IYe(t){return t!==void 0&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function MYe(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function AYe(t){return Array.isArray(t)&&t.some(e=>MYe(e))}function qOr(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function HOr(t){return t!==void 0&&typeof t.callbacks=="object"&&(AYe(t.callbacks?.handlers)||AYe(t.callbacks))}function VOr(t){return t.split(".").map(r=>{let n=r.slice(0,-36),o=r.slice(-36),i=parseInt(n.slice(0,4)),a=parseInt(n.slice(4,6))-1,s=parseInt(n.slice(6,8)),u=parseInt(n.slice(9,11)),l=parseInt(n.slice(11,13)),c=parseInt(n.slice(13,15)),d=parseInt(n.slice(15,21));return[new Date(i,a,s,u,l,c,d/1e3),o]})}function WOr(){let t=Ah("LANGSMITH_RUNS_ENDPOINTS");if(!t)return[];try{let e=JSON.parse(t);if(Array.isArray(e)){let r=[];for(let n of e){if(typeof n!="object"||n===null){console.warn(`Invalid item type in LANGSMITH_RUNS_ENDPOINTS: expected object, got ${typeof n}`);continue}if(typeof n.api_url!="string"){console.warn(`Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_url}`);continue}if(typeof n.api_key!="string"){console.warn(`Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_key}`);continue}r.push({apiUrl:n.api_url.replace(/\/$/,""),apiKey:n.api_key})}return r}else if(typeof e=="object"&&e!==null){GOr(e);let r=[];for(let[n,o]of Object.entries(e)){let i=n.replace(/\/$/,"");if(typeof o=="string")r.push({apiUrl:i,apiKey:o});else{console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${n}: expected string, got ${typeof o}`);continue}}return r}else return console.warn(`Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey, got ${typeof e}`),[]}catch(e){if(bYe(e))throw e;return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey"),[]}}function KOr(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):WOr()}function GOr(t){if(Object.keys(t).length>0&&ac("ENDPOINT"))throw new IQ}var jQ,Nb,i0e=b(()=>{mj();o0e();PYe();H0e();TYe();yE();n0e();yE();C0e();jQ=class t{constructor(e,r,n,o){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=r,this.project_name=n,this.replicas=o}static fromHeader(e){let r=e.split(","),n={},o=[],i,a;for(let s of r){let[u,l]=s.split("="),c=decodeURIComponent(l);u==="langsmith-metadata"?n=JSON.parse(c):u==="langsmith-tags"?o=c.split(","):u==="langsmith-project"?i=c:u==="langsmith-replicas"&&(a=JSON.parse(c))}return new t(n,o,i,a)}toHeader(){let e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}},Nb=class t{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serialized_start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),IYe(e)){Object.assign(this,{...e});return}let r=t.getDefaultConfig(),{metadata:n,...o}=e,i=o.client??t.getSharedClient(),a={...n,...o?.extra?.metadata};if(o.extra={...o.extra,metadata:a},Object.assign(this,{...r,...o,client:i}),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.replicas=KOr(this.replicas),this.execution_order??(this.execution_order=1),this.child_execution_order??(this.child_execution_order=1),!this.dotted_order){let{dottedOrder:s,microsecondPrecisionDatestring:u}=J0e(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+s:this.dotted_order=s,this._serialized_start_time=u}}set metadata(e){this.extra={...this.extra,metadata:{...this.extra?.metadata,...e}}}get metadata(){return this.extra?.metadata}static getDefaultConfig(){return{id:Rs(),run_type:"chain",project_name:S6(),child_runs:[],api_url:Ah("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Ah("LANGCHAIN_API_KEY"),caller_options:{},start_time:Date.now(),serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new yj),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=new t({...e,parent_run:this,project_name:this.project_name,replicas:this.replicas,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});NQ in this&&(n[NQ]=this[NQ]);let o=Symbol.for("lc:child_config"),i=e.extra?.[o]??this.extra[o];if(HOr(i)){let u={...i},l=qOr(u.callbacks)?u.callbacks.copy?.():void 0;l&&(Object.assign(l,{_parentRunId:n.id}),l.handlers?.find(MYe)?.updateFromRunTree?.(n),u.callbacks=l),n.extra[o]=u}let a=new Set,s=this;for(;s!=null&&!a.has(s.id);)a.add(s.id),s.child_execution_order=Math.max(s.child_execution_order,r),s=s.parent_run;return this.child_runs.push(n),n}async end(e,r,n=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??r,this.end_time=this.end_time??n,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,r,n=!0){let o=e.extra??{};if(o?.runtime?.library===void 0&&(o.runtime||(o.runtime={}),r))for(let[s,u]of Object.entries(r))o.runtime[s]||(o.runtime[s]=u);let i,a;return n?(a=e.parent_run?.id??e.parent_run_id,i=[]):(i=e.child_runs.map(s=>this._convertToCreate(s,r,n)),a=void 0),{id:e.id,name:e.name,start_time:e._serialized_start_time??e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:o,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:i,parent_run_id:a,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments,events:e.events}}_remapForProject(e,r,n=!0){let o=this._convertToCreate(this,r,n);if(e===this.project_name)return o;let i=d=>ZX(`${d}:${e}`,ZX.DNS),a=i(o.id),s=o.trace_id?i(o.trace_id):void 0,u=o.parent_run_id?i(o.parent_run_id):void 0,l;if(o.dotted_order){let d=VOr(o.dotted_order),f=[];for(let m=0;m<d.length-1;m++){let[h,y]=d[m],g=i(y);f.push(h.toISOString().replace(/[-:]/g,"").replace(".","")+g)}let[p]=d[d.length-1];f.push(p.toISOString().replace(/[-:]/g,"").replace(".","")+a),l=f.join(".")}else l=void 0;return{...o,id:a,trace_id:s,parent_run_id:u,dotted_order:l,session_name:e}}async postRun(e=!0){try{let r=lQ();if(this.replicas&&this.replicas.length>0)for(let{projectName:n,apiKey:o,apiUrl:i}of this.replicas){let a=this._remapForProject(n??this.project_name,r,!0);await this.client.createRun(a,{apiKey:o,apiUrl:i})}else{let n=this._convertToCreate(this,r,e);await this.client.createRun(n)}if(!e){_Q("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let n of this.child_runs)await n.postRun(!1)}}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(){if(this.replicas&&this.replicas.length>0)for(let{projectName:e,apiKey:r,apiUrl:n,updates:o}of this.replicas){let i=this._remapForProject(e??this.project_name);await this.client.updateRun(i.id,{inputs:i.inputs,outputs:i.outputs,error:i.error,parent_run_id:i.parent_run_id,session_name:i.session_name,reference_example_id:i.reference_example_id,end_time:i.end_time,dotted_order:i.dotted_order,trace_id:i.trace_id,events:i.events,tags:i.tags,extra:i.extra,attachments:this.attachments,...o},{apiKey:r,apiUrl:n})}else try{let e={end_time:this.end_time,error:this.error,inputs:this.inputs,outputs:this.outputs,parent_run_id:this.parent_run?.id??this.parent_run_id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};await this.client.updateRun(this.id,e)}catch(e){console.error(`Error in patchRun for run ${this.id}`,e)}}toJSON(){return this._convertToCreate(this,void 0,!1)}addEvent(e){this.events||(this.events=[]),typeof e=="string"?this.events.push({name:"event",time:new Date().toISOString(),message:e}):this.events.push({...e,time:e.time??new Date().toISOString()})}static fromRunnableConfig(e,r){let n=e?.callbacks,o,i,a,s=EYe();if(n){let l=n?.getParentRunId?.()??"",c=n?.handlers?.find(d=>d?.name=="langchain_tracer");o=c?.getRun?.(l),i=c?.projectName,a=c?.client,s=s||!!c}return o?new t({name:o.name,id:o.id,trace_id:o.trace_id,dotted_order:o.dotted_order,client:a,tracingEnabled:s,project_name:i,tags:[...new Set((o?.tags??[]).concat(e?.tags??[]))],extra:{metadata:{...o?.extra?.metadata,...e?.metadata}}}).createChild(r):new t({...r,client:a,tracingEnabled:s,project_name:i})}static fromDottedOrder(e){return this.fromHeaders({"langsmith-trace":e})}static fromHeaders(e,r){let n="get"in e&&typeof e.get=="function"?{"langsmith-trace":e.get("langsmith-trace"),baggage:e.get("baggage")}:e,o=n["langsmith-trace"];if(!o||typeof o!="string")return;let i=o.trim(),a=i.split(".").map(l=>{let[c,d]=l.split("Z");return{strTime:c,time:Date.parse(c+"Z"),uuid:d}}),s=a[0].uuid,u={...r,name:r?.name??"parent",run_type:r?.run_type??"chain",start_time:r?.start_time??Date.now(),id:a.at(-1)?.uuid,trace_id:s,dotted_order:i};if(n.baggage&&typeof n.baggage=="string"){let l=jQ.fromHeader(n.baggage);u.metadata=l.metadata,u.tags=l.tags,u.project_name=l.project_name,u.replicas=l.replicas}return new t(u)}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new jQ(this.extra?.metadata,this.tags,this.project_name,this.replicas).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(Nb,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});var DQ=b(()=>{i0e()});var NYe=x((ZYn,RYe)=>{"use strict";RYe.exports=function(t,e){if(typeof t!="string")throw new TypeError("Expected a string");return e=typeof e>"u"?"_":e,t.replace(/([a-z\d])([A-Z])/g,"$1"+e+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+e+"$2").toLowerCase()}});var BYe=x((YYn,Z0e)=>{"use strict";var JOr=/[\p{Lu}]/u,ZOr=/[\p{Ll}]/u,jYe=/^[\p{Lu}](?![\p{Lu}])/gu,FYe=/([\p{Alpha}\p{N}_]|$)/u,kYe=/[_.\- ]+/,YOr=new RegExp("^"+kYe.source),DYe=new RegExp(kYe.source+FYe.source,"gu"),LYe=new RegExp("\\d+"+FYe.source,"gu"),XOr=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a<t.length;a++){let s=t[a];n&&JOr.test(s)?(t=t.slice(0,a)+"-"+t.slice(a),n=!1,i=o,o=!0,a++):o&&i&&ZOr.test(s)?(t=t.slice(0,a-1)+"-"+t.slice(a-1),i=o,o=!1,n=!0):(n=e(s)===s&&r(s)!==s,i=o,o=r(s)===s&&e(s)!==s)}return t},QOr=(t,e)=>(jYe.lastIndex=0,t.replace(jYe,r=>e(r))),eEr=(t,e)=>(DYe.lastIndex=0,LYe.lastIndex=0,t.replace(DYe,(r,n)=>e(n)).replace(LYe,r=>e(r))),$Ye=(t,e)=>{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(t)?t=t.map(i=>i.trim()).filter(i=>i.length).join("-"):t=t.trim(),t.length===0)return"";let r=e.locale===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(e.locale),n=e.locale===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(e.locale);return t.length===1?e.pascalCase?n(t):r(t):(t!==r(t)&&(t=XOr(t,r,n)),t=t.replace(YOr,""),e.preserveConsecutiveUppercase?t=QOr(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),eEr(t,n))};Z0e.exports=$Ye;Z0e.exports.default=$Ye});function UYe(t,e){return e?.[t]||(0,zYe.default)(t)}function qYe(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var zYe,tEr,HYe=b(()=>{zYe=j(NYe(),1),tEr=j(BYe(),1)});function VYe(t){return Array.isArray(t)?[...t]:{...t}}function rEr(t,e){let r=VYe(t);for(let[n,o]of Object.entries(e)){let[i,...a]=n.split(".").reverse(),s=r;for(let u of a.reverse()){if(s[u]===void 0)break;s[u]=VYe(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function Y0e(t){let e=Object.getPrototypeOf(t);return typeof t.lc_name=="function"&&(typeof e.lc_name!="function"||t.lc_name()!==e.lc_name())?t.lc_name():t.name}var vm,_j=b(()=>{HYe();vm=class t{static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Y0e(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...r){Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof t||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((o,i)=>(o[i]=i in this?this[i]:this.lc_kwargs[i],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(e,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));return Object.keys(r).forEach(o=>{let i=this,a=n,[s,...u]=o.split(".").reverse();for(let l of u.reverse()){if(!(l in i)||i[l]===void 0)return;(!(l in a)||a[l]===void 0)&&(typeof i[l]=="object"&&i[l]!=null?a[l]={}:Array.isArray(i[l])&&(a[l]=[])),i=i[l],a=a[l]}s in i&&i[s]!==void 0&&(a[s]=a[s]||i[s])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:qYe(Object.keys(r).length?rEr(n,r):n,UYe,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});function WYe(){return X0e===void 0&&(X0e={library:"langchain-js",runtime:LQ()}),X0e}function lt(t){try{return typeof process<"u"?process.env?.[t]:Q0e()?Deno?.env.get(t):void 0}catch{return}}var nEr,oEr,iEr,Q0e,aEr,LQ,X0e,vj=b(()=>{nEr=()=>typeof window<"u"&&typeof window.document<"u",oEr=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",iEr=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),Q0e=()=>typeof Deno<"u",aEr=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!Q0e(),LQ=()=>{let t;return nEr()?t="browser":aEr()?t="node":oEr()?t="webworker":iEr()?t="jsdom":Q0e()?t="deno":t="other",t}});function txe(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var exe,wj,KYe,N6=b(()=>{mj();_j();vj();exe=class{};wj=class t extends exe{get lc_namespace(){return["langchain_core","callbacks",this.name]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Y0e(this.constructor)]}constructor(e){super(),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ignoreLLM",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreChain",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreAgent",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreRetriever",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreCustomEvent",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"raiseError",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"awaitHandlers",{enumerable:!0,configurable:!0,writable:!0,value:lt("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"}),this.lc_kwargs=e||{},e&&(this.ignoreLLM=e.ignoreLLM??this.ignoreLLM,this.ignoreChain=e.ignoreChain??this.ignoreChain,this.ignoreAgent=e.ignoreAgent??this.ignoreAgent,this.ignoreRetriever=e.ignoreRetriever??this.ignoreRetriever,this.ignoreCustomEvent=e.ignoreCustomEvent??this.ignoreCustomEvent,this.raiseError=e.raiseError??this.raiseError,this.awaitHandlers=this.raiseError||(e._awaitHandler??this.awaitHandlers))}copy(){return new this.constructor(this)}toJSON(){return vm.prototype.toJSON.call(this)}toJSONNotImplemented(){return vm.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class r extends t{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:Rs()}),Object.assign(this,e)}}return new r}},KYe=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});function nxe(t,e){if(t)return new Nb({...t,start_time:t._serialized_start_time??t.start_time,parent_run:nxe(e),child_runs:t.child_runs.map(r=>nxe(r)).filter(r=>r!==void 0),extra:{...t.extra,runtime:WYe()},tracingEnabled:!1})}function rxe(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function CB(t){return typeof t._addRunToRunMap=="function"}var sEr,zg,xj=b(()=>{DQ();N6();vj();sEr=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};zg=class extends wj{constructor(e){super(...arguments),Object.defineProperty(this,"runMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"runTreeMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"usesRunTreeMap",{enumerable:!0,configurable:!0,writable:!0,value:!1})}copy(){return this}getRunById(e){if(e!==void 0)return this.usesRunTreeMap?sEr(this.runTreeMap.get(e)):this.runMap.get(e)}stringifyError(e){return e instanceof Error?e.message+(e?.stack?`
${e.stack}`:""):typeof e=="string"?e:`${e}`}_addChildRun(e,r){e.child_runs.push(r)}_addRunToRunMap(e){let{dottedOrder:r,microsecondPrecisionDatestring:n}=J0e(new Date(e.start_time).getTime(),e.id,e.execution_order),o={...e},i=this.getRunById(o.parent_run_id);if(o.parent_run_id!==void 0?i&&(this._addChildRun(i,o),i.child_execution_order=Math.max(i.child_execution_order,o.child_execution_order),o.trace_id=i.trace_id,i.dotted_order!==void 0&&(o.dotted_order=[i.dotted_order,r].join("."),o._serialized_start_time=n)):(o.trace_id=o.id,o.dotted_order=r,o._serialized_start_time=n),this.usesRunTreeMap){let a=nxe(o,i);a!==void 0&&this.runTreeMap.set(o.id,a)}else this.runMap.set(o.id,o);return o}async _endTrace(e){let r=e.parent_run_id!==void 0&&this.getRunById(e.parent_run_id);r?r.child_execution_order=Math.max(r.child_execution_order,e.child_execution_order):await this.persistRun(e),await this.onRunUpdate?.(e),this.usesRunTreeMap?this.runTreeMap.delete(e.id):this.runMap.delete(e.id)}_getExecutionOrder(e){let r=e!==void 0&&this.getRunById(e);return r?r.child_execution_order+1:1}_createRunForLLMStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d=s?{...i,metadata:s}:i,f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{prompts:r},execution_order:l,child_runs:[],child_execution_order:l,run_type:"llm",extra:d??{},tags:a||[]};return this._addRunToRunMap(f)}async handleLLMStart(e,r,n,o,i,a,s,u){let l=this.getRunById(n)??this._createRunForLLMStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}_createRunForChatModelStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d=s?{...i,metadata:s}:i,f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{messages:r},execution_order:l,child_runs:[],child_execution_order:l,run_type:"llm",extra:d??{},tags:a||[]};return this._addRunToRunMap(f)}async handleChatModelStart(e,r,n,o,i,a,s,u){let l=this.getRunById(n)??this._createRunForChatModelStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}async handleLLMEnd(e,r,n,o,i){let a=this.getRunById(r);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.outputs=e,a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMEnd?.(a),await this._endTrace(a),a}async handleLLMError(e,r,n,o,i){let a=this.getRunById(r);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMError?.(a),await this._endTrace(a),a}_createRunForChainStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:r,execution_order:l,child_execution_order:l,run_type:s??"chain",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(d)}async handleChainStart(e,r,n,o,i,a,s,u){let l=this.getRunById(n)??this._createRunForChainStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onChainStart?.(l),l}async handleChainEnd(e,r,n,o,i){let a=this.getRunById(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.outputs=rxe(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=rxe(i.inputs,"input")),await this.onChainEnd?.(a),await this._endTrace(a),a}async handleChainError(e,r,n,o,i){let a=this.getRunById(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=rxe(i.inputs,"input")),await this.onChainError?.(a),await this._endTrace(a),a}_createRunForToolStart(e,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??e.id[e.id.length-1],parent_run_id:o,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{input:r},execution_order:u,child_execution_order:u,run_type:"tool",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(c)}async handleToolStart(e,r,n,o,i,a,s){let u=this.getRunById(n)??this._createRunForToolStart(e,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onToolStart?.(u),u}async handleToolEnd(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="tool")throw new Error("No tool run to end");return n.end_time=Date.now(),n.outputs={output:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onToolEnd?.(n),await this._endTrace(n),n}async handleToolError(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="tool")throw new Error("No tool run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onToolError?.(n),await this._endTrace(n),n}async handleAgentAction(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="chain")return;let o=n;o.actions=o.actions||[],o.actions.push(e),o.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentAction?.(n)}async handleAgentEnd(e,r){let n=this.getRunById(r);!n||n?.run_type!=="chain"||(n.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentEnd?.(n))}_createRunForRetrieverStart(e,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??e.id[e.id.length-1],parent_run_id:o,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{query:r},execution_order:u,child_execution_order:u,run_type:"retriever",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(c)}async handleRetrieverStart(e,r,n,o,i,a,s){let u=this.getRunById(n)??this._createRunForRetrieverStart(e,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onRetrieverStart?.(u),u}async handleRetrieverEnd(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="retriever")throw new Error("No retriever run to end");return n.end_time=Date.now(),n.outputs={documents:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onRetrieverEnd?.(n),await this._endTrace(n),n}async handleRetrieverError(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="retriever")throw new Error("No retriever run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onRetrieverError?.(n),await this._endTrace(n),n}async handleText(e,r){let n=this.getRunById(r);!n||n?.run_type!=="chain"||(n.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:e}}),await this.onText?.(n))}async handleLLMNewToken(e,r,n,o,i,a){let s=this.getRunById(n);if(!s||s?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return s.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:e,idx:r,chunk:a?.chunk}}),await this.onLLMNewToken?.(s,e,{chunk:a?.chunk}),s}}});var YYe=x((lXn,ZYe)=>{"use strict";var GYe=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,JYe=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function uEr(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[o,i]of Object.entries(n))e[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=e[o],t.set(i[0],i[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",e.color.ansi256=GYe(),e.color.ansi16m=JYe(),e.bgColor.ansi256=GYe(10),e.bgColor.ansi16m=JYe(10),Object.defineProperties(e,{rgbToAnsi256:{value:(r,n,o)=>r===n&&n===o?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5),enumerable:!1},hexToRgb:{value:r=>{let n=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!n)return[0,0,0];let{colorString:o}=n.groups;o.length===3&&(o=o.split("").map(a=>a+a).join(""));let i=Number.parseInt(o,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:r=>e.rgbToAnsi256(...e.hexToRgb(r)),enumerable:!1}}),e}Object.defineProperty(ZYe,"exports",{enumerable:!0,get:uEr})});function Op(t,e){return`${t.open}${e}${t.close}`}function Ug(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function XYe(t){return typeof t=="string"?t.trim():t==null?t:Ug(t,t.toString())}function UA(t){if(!t.end_time)return"";let e=t.end_time-t.start_time;return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}var oxe,wm,j6,QYe=b(()=>{oxe=j(YYe(),1);xj();({color:wm}=oxe.default),j6=class extends zg{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"console_callback_handler"})}persistRun(e){return Promise.resolve()}getParents(e){let r=[],n=e;for(;n.parent_run_id;){let o=this.runMap.get(n.parent_run_id);if(o)r.push(o),n=o;else break}return r}getBreadcrumbs(e){let n=[...this.getParents(e).reverse(),e].map((o,i,a)=>{let s=`${o.execution_order}:${o.run_type}:${o.name}`;return i===a.length-1?Op(oxe.default.bold,s):s}).join(" > ");return Op(wm.grey,n)}onChainStart(e){let r=this.getBreadcrumbs(e);console.log(`${Op(wm.green,"[chain/start]")} [${r}] Entering Chain run with input: ${Ug(e.inputs,"[inputs]")}`)}onChainEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Op(wm.cyan,"[chain/end]")} [${r}] [${UA(e)}] Exiting Chain run with output: ${Ug(e.outputs,"[outputs]")}`)}onChainError(e){let r=this.getBreadcrumbs(e);console.log(`${Op(wm.red,"[chain/error]")} [${r}] [${UA(e)}] Chain run errored with error: ${Ug(e.error,"[error]")}`)}onLLMStart(e){let r=this.getBreadcrumbs(e),n="prompts"in e.inputs?{prompts:e.inputs.prompts.map(o=>o.trim())}:e.inputs;console.log(`${Op(wm.green,"[llm/start]")} [${r}] Entering LLM run with input: ${Ug(n,"[inputs]")}`)}onLLMEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Op(wm.cyan,"[llm/end]")} [${r}] [${UA(e)}] Exiting LLM run with output: ${Ug(e.outputs,"[response]")}`)}onLLMError(e){let r=this.getBreadcrumbs(e);console.log(`${Op(wm.red,"[llm/error]")} [${r}] [${UA(e)}] LLM run errored with error: ${Ug(e.error,"[error]")}`)}onToolStart(e){let r=this.getBreadcrumbs(e);console.log(`${Op(wm.green,"[tool/start]")} [${r}] Entering Tool run with input: "${XYe(e.inputs.input)}"`)}onToolEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Op(wm.cyan,"[tool/end]")} [${r}] [${UA(e)}] Exiting Tool run with output: "${XYe(e.outputs?.output)}"`)}onToolError(e){let r=this.getBreadcrumbs(e);console.log(`${Op(wm.red,"[tool/error]")} [${r}] [${UA(e)}] Tool run errored with error: ${Ug(e.error,"[error]")}`)}onRetrieverStart(e){let r=this.getBreadcrumbs(e);console.log(`${Op(wm.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${Ug(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Op(wm.cyan,"[retriever/end]")} [${r}] [${UA(e)}] Exiting Retriever run with output: ${Ug(e.outputs,"[outputs]")}`)}onRetrieverError(e){let r=this.getBreadcrumbs(e);console.log(`${Op(wm.red,"[retriever/error]")} [${r}] [${UA(e)}] Retriever run errored with error: ${Ug(e.error,"[error]")}`)}onAgentAction(e){let r=e,n=this.getBreadcrumbs(e);console.log(`${Op(wm.blue,"[agent/action]")} [${n}] Agent selected action: ${Ug(r.actions[r.actions.length-1],"[action]")}`)}}});function qA(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var D6=b(()=>{});function HA(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function eXe(t){return!!(t&&typeof t=="object"&&"toolCall"in t&&t.toolCall!=null&&typeof t.toolCall=="object"&&"id"in t.toolCall&&typeof t.toolCall.id=="string")}var Sj,FQ=b(()=>{Sj=class extends Error{constructor(e,r){super(e),Object.defineProperty(this,"output",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.output=r}}});function ixe(t,e=OB){t=t.trim();let r=t.indexOf("```");if(r===-1)return e(t);let n=t.substring(r+3);n.startsWith(`json
`)?n=n.substring(5):n.startsWith("json")?n=n.substring(4):n.startsWith(`
`)&&(n=n.substring(1));let o=n.indexOf("```"),i=n;return o!==-1&&(i=n.substring(0,o)),e(i.trim())}function OB(t){if(typeof t>"u")return null;try{return JSON.parse(t)}catch{}let e="",r=[],n=!1,o=!1;for(let i of t){if(n)i==='"'&&!o?n=!1:i===`
`&&!o?i="\\n":i==="\\"?o=!o:o=!1;else if(i==='"')n=!0,o=!1;else if(i==="{")r.push("}");else if(i==="[")r.push("]");else if(i==="}"||i==="]")if(r&&r[r.length-1]===i)r.pop();else return null;e+=i}n&&(e+='"');for(let i=r.length-1;i>=0;i-=1)e+=r[i];try{return JSON.parse(e)}catch{return null}}var axe=b(()=>{});function jb(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"source_type"in t&&(t.source_type==="url"||t.source_type==="base64"||t.source_type==="text"||t.source_type==="id")}function tXe(t){return jb(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function rXe(t){return jb(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function nXe(t){if(jb(t)){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url}};if(t.source_type==="base64"){if(!t.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${t.mime_type};base64,${t.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function sxe(t){let e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);let r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);let o={};for(let i of t.split(";").slice(1)){let a=i.split("=");if(a.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);let s=a[0].trim(),u=a[1].trim();if(s==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);o[s]=u}return{type:r,subtype:n,parameters:o}}function EB({dataUrl:t,asTypedArray:e=!1}){let r=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let o=e?Uint8Array.from(atob(r[2]),i=>i.charCodeAt(0)):r[2];return{mime_type:n,data:o}}}function L6(t,e){if(t.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(t)}if(t.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(t)}if(t.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(t)}if(t.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(t)}throw new Error(`Unable to convert content block type '${t.type}' to provider-specific format: not recognized.`)}var uxe=b(()=>{});function qg(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.some(r=>jb(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?F6(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>jb(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function oXe(t,e){return t==="error"||e==="error"?"error":"success"}function lEr(t,e){function r(n,o){if(typeof n!="object"||n===null||n===void 0)return n;if(o>=e)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(a=>r(a,o+1));let i={};for(let a of Object.keys(n))i[a]=r(n[a],o+1);return i}return JSON.stringify(r(t,0),null,2)}function Xs(t,e){let r={...t};for(let[n,o]of Object.entries(e))if(r[n]==null)r[n]=o;else{if(o==null)continue;if(typeof r[n]!=typeof o||Array.isArray(r[n])!==Array.isArray(o))throw new Error(`field[${n}] already exists in the message chunk, but with a different type.`);if(typeof r[n]=="string"){if(n==="type")continue;r[n]+=o}else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=Xs(r[n],o);else if(Array.isArray(r[n]))r[n]=F6(r[n],o);else{if(r[n]===o)continue;console.warn(`field[${n}] already exists in this message chunk and value has unsupported type.`)}}return r}function F6(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)return t||e;{let r=[...t];for(let n of e)if(typeof n=="object"&&"index"in n&&typeof n.index=="number"){let o=r.findIndex(i=>i.index===n.index);o!==-1?r[o]=Xs(r[o],n):r.push(n)}else{if(typeof n=="object"&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function iXe(t,e){if(!t&&!e)throw new Error("Cannot merge two undefined objects.");if(!t||!e)return t||e;if(typeof t!=typeof e)throw new Error(`Cannot merge objects of different types.
Left ${typeof t}
Right ${typeof e}`);if(typeof t=="string"&&typeof e=="string")return t+e;if(Array.isArray(t)&&Array.isArray(e))return F6(t,e);if(typeof t=="object"&&typeof e=="object")return Xs(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types.
Left ${t}
Right ${e}`)}function aXe(t){return typeof t.role=="string"}function Hg(t){return typeof t?._getType=="function"}function lxe(t){return Hg(t)&&typeof t.concat=="function"}var sc,xm,Vg=b(()=>{_j();uxe();sc=class extends vm{get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(e=>typeof e=="string"?e:e.type==="text"?e.text:"").join(""):""}getType(){return this._getType()}constructor(e,r){typeof e=="string"&&(e={content:e,additional_kwargs:r,response_metadata:{}}),e.additional_kwargs||(e.additional_kwargs={}),e.response_metadata||(e.response_metadata={}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","messages"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"additional_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"response_metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.content=e.content,this.additional_kwargs=e.additional_kwargs,this.response_metadata=e.response_metadata,this.id=e.id}toDict(){return{type:this._getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){if(e===null)return this;let r=lEr(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${r}`}};xm=class extends sc{}});function sXe(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function uXe(t){let e=[],r=[];for(let n of t)if(n.function){let o=n.function.name;try{let i=JSON.parse(n.function.arguments),a={name:o||"",args:i||{},id:n.id};e.push(a)}catch{r.push({name:o,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[e,r]}var wE,Wg,PB=b(()=>{Vg();wE=class extends sc{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}constructor(e,r,n){typeof e=="string"&&(e={content:e,name:n,tool_call_id:r}),super(e),Object.defineProperty(this,"lc_direct_tool_output",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tool_call_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"artifact",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status,this.metadata=e.metadata}_getType(){return"tool"}static isInstance(e){return e._getType()==="tool"}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},Wg=class t extends xm{constructor(e){super(e),Object.defineProperty(this,"tool_call_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"artifact",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}static lc_name(){return"ToolMessageChunk"}_getType(){return"tool"}concat(e){return new t({content:qg(this.content,e.content),additional_kwargs:Xs(this.additional_kwargs,e.additional_kwargs),response_metadata:Xs(this.response_metadata,e.response_metadata),artifact:iXe(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:oXe(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function Ki(t){return t._getType()==="ai"}function cxe(t){return t._getType()==="ai"}var Ln,vr,Cj=b(()=>{axe();Vg();PB();Ln=class extends sc{get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls"}}constructor(e,r){let n;if(typeof e=="string")n={content:e,tool_calls:[],invalid_tool_calls:[],additional_kwargs:r??{}};else{n=e;let o=n.additional_kwargs?.tool_calls,i=n.tool_calls;o!=null&&o.length>0&&(i===void 0||i.length===0)&&console.warn(["New LangChain packages are available that more efficiently handle",`tool calling.
Please upgrade your packages to versions that set`,"message tool calls. e.g., `yarn add @langchain/anthropic`,","yarn add @langchain/openai`, etc."].join(" "));try{if(o!=null&&i===void 0){let[a,s]=uXe(o);n.tool_calls=a??[],n.invalid_tool_calls=s??[]}else n.tool_calls=n.tool_calls??[],n.invalid_tool_calls=n.invalid_tool_calls??[]}catch{n.tool_calls=[],n.invalid_tool_calls=[]}}super(n),Object.defineProperty(this,"tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"invalid_tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"usage_metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),typeof n!="string"&&(this.tool_calls=n.tool_calls??this.tool_calls,this.invalid_tool_calls=n.invalid_tool_calls??this.invalid_tool_calls),this.usage_metadata=n.usage_metadata}static lc_name(){return"AIMessage"}_getType(){return"ai"}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}};vr=class t extends xm{constructor(e){let r;if(typeof e=="string")r={content:e,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]};else if(e.tool_call_chunks===void 0)r={...e,tool_calls:e.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0};else{let n=e.tool_call_chunks.reduce((a,s)=>{let u=s.id||`fallback-${s.index||0}`;return a[u]=a[u]??[],a[u].push(s),a},{}),o=[],i=[];for(let[a,s]of Object.entries(n)){let u={},l=s[0]?.name??"",c=s.map(p=>p.args||"").join(""),d=c.length?c:"{}",f=s[0]?.id||a;try{if(u=OB(d),u===null||typeof u!="object"||Array.isArray(u))throw new Error("Malformed tool call chunk args.");o.push({name:l,args:u,id:f,type:"tool_call"})}catch{i.push({name:l,args:d,id:f,error:"Malformed args.",type:"invalid_tool_call"})}}r={...e,tool_calls:o,invalid_tool_calls:i,usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0}}super(r),Object.defineProperty(this,"tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"invalid_tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"tool_call_chunks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"usage_metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tool_call_chunks=r.tool_call_chunks??this.tool_call_chunks,this.tool_calls=r.tool_calls??this.tool_calls,this.invalid_tool_calls=r.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=r.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks"}}static lc_name(){return"AIMessageChunk"}_getType(){return"ai"}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,tool_call_chunks:this.tool_call_chunks,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}concat(e){let r={content:qg(this.content,e.content),additional_kwargs:Xs(this.additional_kwargs,e.additional_kwargs),response_metadata:Xs(this.response_metadata,e.response_metadata),tool_call_chunks:[],id:this.id??e.id};if(this.tool_call_chunks!==void 0||e.tool_call_chunks!==void 0){let n=F6(this.tool_call_chunks,e.tool_call_chunks);n!==void 0&&n.length>0&&(r.tool_call_chunks=n)}if(this.usage_metadata!==void 0||e.usage_metadata!==void 0){let n={...(this.usage_metadata?.input_token_details?.audio!==void 0||e.usage_metadata?.input_token_details?.audio!==void 0)&&{audio:(this.usage_metadata?.input_token_details?.audio??0)+(e.usage_metadata?.input_token_details?.audio??0)},...(this.usage_metadata?.input_token_details?.cache_read!==void 0||e.usage_metadata?.input_token_details?.cache_read!==void 0)&&{cache_read:(this.usage_metadata?.input_token_details?.cache_read??0)+(e.usage_metadata?.input_token_details?.cache_read??0)},...(this.usage_metadata?.input_token_details?.cache_creation!==void 0||e.usage_metadata?.input_token_details?.cache_creation!==void 0)&&{cache_creation:(this.usage_metadata?.input_token_details?.cache_creation??0)+(e.usage_metadata?.input_token_details?.cache_creation??0)}},o={...(this.usage_metadata?.output_token_details?.audio!==void 0||e.usage_metadata?.output_token_details?.audio!==void 0)&&{audio:(this.usage_metadata?.output_token_details?.audio??0)+(e.usage_metadata?.output_token_details?.audio??0)},...(this.usage_metadata?.output_token_details?.reasoning!==void 0||e.usage_metadata?.output_token_details?.reasoning!==void 0)&&{reasoning:(this.usage_metadata?.output_token_details?.reasoning??0)+(e.usage_metadata?.output_token_details?.reasoning??0)}},i=this.usage_metadata??{input_tokens:0,output_tokens:0,total_tokens:0},a=e.usage_metadata??{input_tokens:0,output_tokens:0,total_tokens:0},s={input_tokens:i.input_tokens+a.input_tokens,output_tokens:i.output_tokens+a.output_tokens,total_tokens:i.total_tokens+a.total_tokens,...Object.keys(n).length>0&&{input_token_details:n},...Object.keys(o).length>0&&{output_token_details:o}};r.usage_metadata=s}return new t(r)}}});var Qs,Ep,kQ=b(()=>{Vg();Qs=class t extends sc{static lc_name(){return"ChatMessage"}static _chatMessageClass(){return t}constructor(e,r){typeof e=="string"&&(e={content:e,role:r}),super(e),Object.defineProperty(this,"role",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.role=e.role}_getType(){return"generic"}static isInstance(e){return e._getType()==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},Ep=class t extends xm{static lc_name(){return"ChatMessageChunk"}constructor(e,r){typeof e=="string"&&(e={content:e,role:r}),super(e),Object.defineProperty(this,"role",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.role=e.role}_getType(){return"generic"}concat(e){return new t({content:qg(this.content,e.content),additional_kwargs:Xs(this.additional_kwargs,e.additional_kwargs),response_metadata:Xs(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}get _printableFields(){return{...super._printableFields,role:this.role}}}});var Ih,$Q=b(()=>{Vg();Ih=class t extends xm{static lc_name(){return"FunctionMessageChunk"}_getType(){return"function"}concat(e){return new t({content:qg(this.content,e.content),additional_kwargs:Xs(this.additional_kwargs,e.additional_kwargs),response_metadata:Xs(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});var eu,Pp,k6=b(()=>{Vg();eu=class extends sc{static lc_name(){return"HumanMessage"}_getType(){return"human"}constructor(e,r){super(e,r)}},Pp=class t extends xm{static lc_name(){return"HumanMessageChunk"}_getType(){return"human"}constructor(e,r){super(e,r)}concat(e){return new t({content:qg(this.content,e.content),additional_kwargs:Xs(this.additional_kwargs,e.additional_kwargs),response_metadata:Xs(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});var xE,Pf,BQ=b(()=>{Vg();xE=class extends sc{static lc_name(){return"SystemMessage"}_getType(){return"system"}constructor(e,r){super(e,r)}},Pf=class t extends xm{static lc_name(){return"SystemMessageChunk"}_getType(){return"system"}constructor(e,r){super(e,r)}concat(e){return new t({content:qg(this.content,e.content),additional_kwargs:Xs(this.additional_kwargs,e.additional_kwargs),response_metadata:Xs(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});function dEr(t){return HA(t)?t:typeof t.id=="string"&&t.type==="function"&&typeof t.function=="object"&&t.function!==null&&"arguments"in t.function&&typeof t.function.arguments=="string"&&"name"in t.function&&typeof t.function.name=="string"?{id:t.id,args:JSON.parse(t.function.arguments),name:t.function.name,type:"tool_call"}:t}function fEr(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function dxe(t){let e,r;if(fEr(t)){let n=t.id.at(-1);n==="HumanMessage"||n==="HumanMessageChunk"?e="user":n==="AIMessage"||n==="AIMessageChunk"?e="assistant":n==="SystemMessage"||n==="SystemMessageChunk"?e="system":n==="FunctionMessage"||n==="FunctionMessageChunk"?e="function":n==="ToolMessage"||n==="ToolMessageChunk"?e="tool":e="unknown",r=t.kwargs}else{let{type:n,...o}=t;e=n,r=o}if(e==="human"||e==="user")return new eu(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new Ln(r);let i=n.map(dEr);return new Ln({...o,tool_calls:i})}else{if(e==="system")return new xE(r);if(e==="developer")return new xE({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new wE({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});throw qA(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported.
Received: ${JSON.stringify(t,null,2)}`),"MESSAGE_COERCION_FAILURE")}}function Db(t){if(typeof t=="string")return new eu(t);if(Hg(t))return t;if(Array.isArray(t)){let[e,r]=t;return dxe({type:e,content:r})}else if(aXe(t)){let{role:e,...r}=t;return dxe({...r,type:e})}else return dxe(t)}function Tp(t,e="Human",r="AI"){let n=[];for(let o of t){let i;if(o._getType()==="human")i=e;else if(o._getType()==="ai")i=r;else if(o._getType()==="system")i="System";else if(o._getType()==="function")i="Function";else if(o._getType()==="tool")i="Tool";else if(o._getType()==="generic")i=o.role;else throw new Error(`Got unsupported message type: ${o._getType()}`);let a=o.name?`${o.name}, `:"",s=typeof o.content=="string"?o.content:JSON.stringify(o.content,null,2);n.push(`${i}: ${a}${s}`)}return n.join(`
`)}function fxe(t){let e=t._getType();if(e==="human")return new Pp({...t});if(e==="ai"){let r={...t};return"tool_calls"in r&&(r={...r,tool_call_chunks:r.tool_calls?.map(n=>({...n,type:"tool_call_chunk",index:void 0,args:JSON.stringify(n.args)}))}),new vr({...r})}else{if(e==="system")return new Pf({...t});if(e==="function")return new Ih({...t});if(Qs.isInstance(t))return new Ep({...t});throw new Error("Unknown message type.")}}var VA=b(()=>{D6();FQ();Cj();Vg();kQ();$Q();k6();BQ();PB()});var zQ=b(()=>{uQ()});var pxe,mxe,hxe=b(()=>{zQ();vj();mxe=()=>{if(pxe===void 0){let t=lt("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};pxe=new yj(t)}return pxe}});var TB,lXe=b(()=>{zQ();DQ();Jwe();xj();hxe();TB=class t extends zg{constructor(e={}){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"langchain_tracer"}),Object.defineProperty(this,"projectName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"usesRunTreeMap",{enumerable:!0,configurable:!0,writable:!0,value:!0});let{exampleId:r,projectName:n,client:o,replicas:i}=e;this.projectName=n??S6(),this.replicas=i,this.exampleId=r,this.client=o??mxe();let a=t.getTraceableRunTree();a&&this.updateFromRunTree(a)}async persistRun(e){}async onRunCreate(e){await this.getRunTreeWithTracingConfig(e.id)?.postRun()}async onRunUpdate(e){await this.getRunTreeWithTracingConfig(e.id)?.patchRun()}getRun(e){return this.runTreeMap.get(e)}updateFromRunTree(e){let r=e,n=new Set;for(;r.parent_run&&!(n.has(r.id)||(n.add(r.id),!r.parent_run));)r=r.parent_run;n.clear();let o=[r];for(;o.length>0;){let i=o.shift();!i||n.has(i.id)||(n.add(i.id),this.runTreeMap.set(i.id,i),i.child_runs&&o.push(...i.child_runs))}this.client=e.client??this.client,this.replicas=e.replicas??this.replicas,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}getRunTreeWithTracingConfig(e){let r=this.runTreeMap.get(e);if(r)return new Nb({...r,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return xJe(!0)}catch{return}}}});var cXe,Oj,dXe,WA,$6=b(()=>{cXe=Symbol.for("ls:tracing_async_local_storage"),Oj=Symbol.for("lc:context_variables"),dXe=t=>{globalThis[cXe]=t},WA=()=>globalThis[cXe]});function pEr(){let t="default"in UQ.default?UQ.default.default:UQ.default;return new t({autoStart:!0,concurrency:1})}function mEr(){return typeof B6>"u"&&(B6=pEr()),B6}async function tu(t,e){if(e===!0){let r=WA();r!==void 0?await r.run(void 0,async()=>t()):await t()}else B6=mEr(),B6.add(async()=>{let r=WA();r!==void 0?await r.run(void 0,async()=>t()):await t()})}var UQ,B6,fXe=b(()=>{UQ=j(yQ(),1);$6();hxe()});var pXe=b(()=>{fXe()});var mXe,hXe=b(()=>{vj();mXe=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>lt(r)==="true")});function gxe(t){let e=WA();return e===void 0?void 0:e.getStore()?.[Oj]?.[t]}var hEr,gXe,yXe=b(()=>{DQ();$6();hEr=Symbol("lc:configure_hooks"),gXe=()=>gxe(hEr)||[]});function U6(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function z6(t){return"name"in t?t:wj.fromMethods(t)}var yxe,AB,bxe,qQ,_xe,vxe,_u,KA=b(()=>{mj();N6();QYe();VA();vj();lXe();pXe();hXe();xj();yXe();yxe=class{setHandler(e){return this.setHandlers([e])}},AB=class{constructor(e,r,n,o,i,a,s,u){Object.defineProperty(this,"runId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"inheritableHandlers",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"inheritableTags",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"inheritableMetadata",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_parentRunId",{enumerable:!0,configurable:!0,writable:!0,value:u})}get parentRunId(){return this._parentRunId}async handleText(e){await Promise.all(this.handlers.map(r=>tu(async()=>{try{await r.handleText?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleText: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}async handleCustomEvent(e,r,n,o,i){await Promise.all(this.handlers.map(a=>tu(async()=>{try{await a.handleCustomEvent?.(e,r,this.runId,this.tags,this.metadata)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleCustomEvent: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}},bxe=class extends AB{getChild(e){let r=new _u(this.runId);return r.setHandlers(this.inheritableHandlers),r.addTags(this.inheritableTags),r.addMetadata(this.inheritableMetadata),e&&r.addTags([e],!1),r}async handleRetrieverEnd(e){await Promise.all(this.handlers.map(r=>tu(async()=>{if(!r.ignoreRetriever)try{await r.handleRetrieverEnd?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleRetriever`),r.raiseError)throw n}},r.awaitHandlers)))}async handleRetrieverError(e){await Promise.all(this.handlers.map(r=>tu(async()=>{if(!r.ignoreRetriever)try{await r.handleRetrieverError?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleRetrieverError: ${n}`),r.raiseError)throw e}},r.awaitHandlers)))}},qQ=class extends AB{async handleLLMNewToken(e,r,n,o,i,a){await Promise.all(this.handlers.map(s=>tu(async()=>{if(!s.ignoreLLM)try{await s.handleLLMNewToken?.(e,r??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,a)}catch(u){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleLLMNewToken: ${u}`),s.raiseError)throw u}},s.awaitHandlers)))}async handleLLMError(e,r,n,o,i){await Promise.all(this.handlers.map(a=>tu(async()=>{if(!a.ignoreLLM)try{await a.handleLLMError?.(e,this.runId,this._parentRunId,this.tags,i)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleLLMError: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}async handleLLMEnd(e,r,n,o,i){await Promise.all(this.handlers.map(a=>tu(async()=>{if(!a.ignoreLLM)try{await a.handleLLMEnd?.(e,this.runId,this._parentRunId,this.tags,i)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleLLMEnd: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}},_xe=class extends AB{getChild(e){let r=new _u(this.runId);return r.setHandlers(this.inheritableHandlers),r.addTags(this.inheritableTags),r.addMetadata(this.inheritableMetadata),e&&r.addTags([e],!1),r}async handleChainError(e,r,n,o,i){await Promise.all(this.handlers.map(a=>tu(async()=>{if(!a.ignoreChain)try{await a.handleChainError?.(e,this.runId,this._parentRunId,this.tags,i)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleChainError: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}async handleChainEnd(e,r,n,o,i){await Promise.all(this.handlers.map(a=>tu(async()=>{if(!a.ignoreChain)try{await a.handleChainEnd?.(e,this.runId,this._parentRunId,this.tags,i)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleChainEnd: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}async handleAgentAction(e){await Promise.all(this.handlers.map(r=>tu(async()=>{if(!r.ignoreAgent)try{await r.handleAgentAction?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleAgentAction: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}async handleAgentEnd(e){await Promise.all(this.handlers.map(r=>tu(async()=>{if(!r.ignoreAgent)try{await r.handleAgentEnd?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleAgentEnd: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}},vxe=class extends AB{getChild(e){let r=new _u(this.runId);return r.setHandlers(this.inheritableHandlers),r.addTags(this.inheritableTags),r.addMetadata(this.inheritableMetadata),e&&r.addTags([e],!1),r}async handleToolError(e){await Promise.all(this.handlers.map(r=>tu(async()=>{if(!r.ignoreAgent)try{await r.handleToolError?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleToolError: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}async handleToolEnd(e){await Promise.all(this.handlers.map(r=>tu(async()=>{if(!r.ignoreAgent)try{await r.handleToolEnd?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleToolEnd: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}},_u=class t extends yxe{constructor(e,r){super(),Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"inheritableHandlers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"inheritableTags",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"inheritableMetadata",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"callback_manager"}),Object.defineProperty(this,"_parentRunId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.handlers=r?.handlers??this.handlers,this.inheritableHandlers=r?.inheritableHandlers??this.inheritableHandlers,this.tags=r?.tags??this.tags,this.inheritableTags=r?.inheritableTags??this.inheritableTags,this.metadata=r?.metadata??this.metadata,this.inheritableMetadata=r?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=e}getParentRunId(){return this._parentRunId}async handleLLMStart(e,r,n=void 0,o=void 0,i=void 0,a=void 0,s=void 0,u=void 0){return Promise.all(r.map(async(l,c)=>{let d=c===0&&n?n:Rs();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return CB(f)&&f._createRunForLLMStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),tu(async()=>{try{await f.handleLLMStart?.(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u)}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new qQ(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(e,r,n=void 0,o=void 0,i=void 0,a=void 0,s=void 0,u=void 0){return Promise.all(r.map(async(l,c)=>{let d=c===0&&n?n:Rs();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return CB(f)&&f._createRunForChatModelStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),tu(async()=>{try{if(f.handleChatModelStart)await f.handleChatModelStart?.(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u);else if(f.handleLLMStart){let p=Tp(l);await f.handleLLMStart?.(e,[p],d,this._parentRunId,i,this.tags,this.metadata,u)}}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new qQ(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,r,n=Rs(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreChain)return CB(u)&&u._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,s),tu(async()=>{try{await u.handleChainStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,o,s)}catch(l){if((u.raiseError?console.error:console.warn)(`Error in handler ${u.constructor.name}, handleChainStart: ${l}`),u.raiseError)throw l}},u.awaitHandlers)})),new _xe(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,r,n=Rs(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreAgent)return CB(u)&&u._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),tu(async()=>{try{await u.handleToolStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,s)}catch(l){if((u.raiseError?console.error:console.warn)(`Error in handler ${u.constructor.name}, handleToolStart: ${l}`),u.raiseError)throw l}},u.awaitHandlers)})),new vxe(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,r,n=Rs(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreRetriever)return CB(u)&&u._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),tu(async()=>{try{await u.handleRetrieverStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,s)}catch(l){if((u.raiseError?console.error:console.warn)(`Error in handler ${u.constructor.name}, handleRetrieverStart: ${l}`),u.raiseError)throw l}},u.awaitHandlers)})),new bxe(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(e,r,n,o,i){await Promise.all(this.handlers.map(a=>tu(async()=>{if(!a.ignoreCustomEvent)try{await a.handleCustomEvent?.(e,r,n,this.tags,this.metadata)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleCustomEvent: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}addHandler(e,r=!0){this.handlers.push(e),r&&this.inheritableHandlers.push(e)}removeHandler(e){this.handlers=this.handlers.filter(r=>r!==e),this.inheritableHandlers=this.inheritableHandlers.filter(r=>r!==e)}setHandlers(e,r=!0){this.handlers=[],this.inheritableHandlers=[];for(let n of e)this.addHandler(n,r)}addTags(e,r=!0){this.removeTags(e),this.tags.push(...e),r&&this.inheritableTags.push(...e)}removeTags(e){this.tags=this.tags.filter(r=>!e.includes(r)),this.inheritableTags=this.inheritableTags.filter(r=>!e.includes(r))}addMetadata(e,r=!0){this.metadata={...this.metadata,...e},r&&(this.inheritableMetadata={...this.inheritableMetadata,...e})}removeMetadata(e){for(let r of Object.keys(e))delete this.metadata[r],delete this.inheritableMetadata[r]}copy(e=[],r=!0){let n=new t(this._parentRunId);for(let o of this.handlers){let i=this.inheritableHandlers.includes(o);n.addHandler(o,i)}for(let o of this.tags){let i=this.inheritableTags.includes(o);n.addTags([o],i)}for(let o of Object.keys(this.metadata)){let i=Object.keys(this.inheritableMetadata).includes(o);n.addMetadata({[o]:this.metadata[o]},i)}for(let o of e)n.handlers.filter(i=>i.name==="console_callback_handler").some(i=>i.name===o.name)||n.addHandler(o,r);return n}static fromHandlers(e){class r extends wj{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:Rs()}),Object.assign(this,e)}}let n=new this;return n.addHandler(new r),n}static configure(e,r,n,o,i,a,s){return this._configureSync(e,r,n,o,i,a,s)}static _configureSync(e,r,n,o,i,a,s){let u;(e||r)&&(Array.isArray(e)||!e?(u=new t,u.setHandlers(e?.map(z6)??[],!0)):u=e,u=u.copy(Array.isArray(r)?r.map(z6):r?.handlers,!1));let l=lt("LANGCHAIN_VERBOSE")==="true"||s?.verbose,c=TB.getTraceableRunTree()?.tracingEnabled||mXe(),d=c||(lt("LANGCHAIN_TRACING")??!1);if(l||d){if(u||(u=new t),l&&!u.handlers.some(f=>f.name===j6.prototype.name)){let f=new j6;u.addHandler(f,!0)}if(d&&!u.handlers.some(f=>f.name==="langchain_tracer")&&c){let f=new TB;u.addHandler(f,!0),u._parentRunId=TB.getTraceableRunTree()?.id??u._parentRunId}}for(let{contextVar:f,inheritable:p=!0,handlerClass:m,envVar:h}of gXe()){let y=h&&lt(h)==="true"&&m,g,_=f!==void 0?gxe(f):void 0;_&&KYe(_)?g=_:y&&(g=new m({})),g!==void 0&&(u||(u=new t),u.handlers.some(w=>w.name===g.name)||u.addHandler(g,p))}return(n||o)&&u&&(u.addTags(n??[]),u.addTags(o??[],!1)),(i||a)&&u&&(u.addMetadata(i??{}),u.addMetadata(a??{},!1)),u}}});var HQ,gEr,bXe,wxe,Ap,_Xe=b(()=>{zQ();$6();KA();HQ=class{getStore(){}run(e,r){return r()}enterWith(e){}},gEr=new HQ,bXe=Symbol.for("lc:child_config"),wxe=class{getInstance(){return WA()??gEr}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[bXe]}runWithConfig(e,r,n){let o=_u._configureSync(e?.callbacks,void 0,e?.tags,void 0,e?.metadata),i=this.getInstance(),a=i.getStore(),s=o?.getParentRunId(),u=o?.handlers?.find(c=>c?.name==="langchain_tracer"),l;return u&&s?l=u.getRunTreeWithTracingConfig(s):n||(l=new Nb({name:"<runnable_lambda>",tracingEnabled:!1})),l&&(l.extra={...l.extra,[bXe]:e}),a!==void 0&&a[Oj]!==void 0&&(l===void 0&&(l={}),l[Oj]=a[Oj]),i.run(l,r)}initializeGlobalInstance(e){WA()===void 0&&dXe(e)}},Ap=new wxe});var Ej=b(()=>{_Xe();$6()});async function Sm(t){return _u._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function IB(...t){let e={};for(let r of t.filter(n=>!!n))for(let n of Object.keys(r))if(n==="metadata")e[n]={...e[n],...r[n]};else if(n==="tags"){let o=e[n]??[];e[n]=[...new Set(o.concat(r[n]??[]))]}else if(n==="configurable")e[n]={...e[n],...r[n]};else if(n==="timeout")e.timeout===void 0?e.timeout=r.timeout:r.timeout!==void 0&&(e.timeout=Math.min(e.timeout,r.timeout));else if(n==="signal")e.signal===void 0?e.signal=r.signal:r.signal!==void 0&&("any"in AbortSignal?e.signal=AbortSignal.any([e.signal,r.signal]):e.signal=r.signal);else if(n==="callbacks"){let o=e.callbacks,i=r.callbacks;if(Array.isArray(i))if(!o)e.callbacks=i;else if(Array.isArray(o))e.callbacks=o.concat(i);else{let a=o.copy();for(let s of i)a.addHandler(z6(s),!0);e.callbacks=a}else if(i)if(!o)e.callbacks=i;else if(Array.isArray(o)){let a=i.copy();for(let s of o)a.addHandler(z6(s),!0);e.callbacks=a}else e.callbacks=new _u(i._parentRunId,{handlers:o.handlers.concat(i.handlers),inheritableHandlers:o.inheritableHandlers.concat(i.inheritableHandlers),tags:Array.from(new Set(o.tags.concat(i.tags))),inheritableTags:Array.from(new Set(o.inheritableTags.concat(i.inheritableTags))),metadata:{...o.metadata,...i.metadata}})}else{let o=n;e[o]=r[o]??e[o]}return e}function Tn(t){let e=Ap.getRunnableConfig(),r={tags:[],metadata:{},recursionLimit:25,runId:void 0};if(e){let{runId:n,runName:o,...i}=e;r=Object.entries(i).reduce((a,[s,u])=>(u!==void 0&&(a[s]=u),a),r)}if(t&&(r=Object.entries(t).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),r)),r?.configurable)for(let n of Object.keys(r.configurable))yEr.has(typeof r.configurable[n])&&!r.metadata?.[n]&&(r.metadata||(r.metadata={}),r.metadata[n]=r.configurable[n]);if(r.timeout!==void 0){if(r.timeout<=0)throw new Error("Timeout must be a positive number");let n=AbortSignal.timeout(r.timeout);r.signal!==void 0?"any"in AbortSignal&&(r.signal=AbortSignal.any([r.signal,n])):r.signal=n,delete r.timeout}return r}function ru(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=Tn(t);return e!==void 0&&(delete s.runName,s.callbacks=e),n!==void 0&&(s.recursionLimit=n),r!==void 0&&(s.maxConcurrency=r),o!==void 0&&(s.runName=o),i!==void 0&&(s.configurable={...s.configurable,...i}),a!==void 0&&delete s.runId,s}function Kg(t){return t?{configurable:t.configurable,recursionLimit:t.recursionLimit,callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,maxConcurrency:t.maxConcurrency,timeout:t.timeout,signal:t.signal}:void 0}var VQ,yEr,Ov=b(()=>{KA();Ej();VQ=25;yEr=new Set(["string","number","boolean"])});async function Ev(t,e){if(e===void 0)return t;let r;return Promise.race([t.catch(n=>{if(!e?.aborted)throw n}),new Promise((n,o)=>{r=()=>{o(new Error("Aborted"))},e.addEventListener("abort",r),e.aborted&&o(new Error("Aborted"))})]).finally(()=>e.removeEventListener("abort",r))}var xxe=b(()=>{});function Sxe(t,e=2){let r=Array.from({length:e},()=>[]);return r.map(async function*(o){for(;;)if(o.length===0){let i=await t.next();for(let a of r)a.push(i)}else{if(o[0].done)return;yield o.shift().value}})}function Dc(t,e){if(Array.isArray(t)&&Array.isArray(e))return t.concat(e);if(typeof t=="string"&&typeof e=="string")return t+e;if(typeof t=="number"&&typeof e=="number")return t+e;if("concat"in t&&typeof t.concat=="function")return t.concat(e);if(typeof t=="object"&&typeof e=="object"){let r={...t};for(let[n,o]of Object.entries(e))n in r&&!Array.isArray(r[n])?r[n]=Dc(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}async function vXe(t,e,r,n,...o){let i=new SE({generator:e,startSetup:r,signal:n}),a=await i.setup;return{output:t(i,a,...o),setup:a}}var Tf,SE,Pv=b(()=>{Ov();Ej();xxe();Tf=class t extends ReadableStream{constructor(){super(...arguments),Object.defineProperty(this,"reader",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let e=await this.reader.read();return e.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:e.value}}catch(e){throw this.reader.releaseLock(),e}}async return(){if(this.ensureReader(),this.locked){let e=this.reader.cancel();this.reader.releaseLock(),await e}return{done:!0,value:void 0}}async throw(e){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}throw e}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(e){let r=e.getReader();return new t({start(n){return o();function o(){return r.read().then(({done:i,value:a})=>{if(i){n.close();return}return n.enqueue(a),o()})}},cancel(){r.releaseLock()}})}static fromAsyncGenerator(e){return new t({async pull(r){let{value:n,done:o}=await e.next();o&&r.close(),r.enqueue(n)},async cancel(r){await e.return(r)}})}};SE=class{constructor(e){Object.defineProperty(this,"generator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"setup",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signal",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"firstResult",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"firstResultUsed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.generator=e.generator,this.config=e.config,this.signal=e.signal??this.config?.signal,this.setup=new Promise((r,n)=>{Ap.runWithConfig(Kg(e.config),async()=>{this.firstResult=e.generator.next(),e.startSetup?this.firstResult.then(e.startSetup).then(r,n):this.firstResult.then(o=>r(void 0),n)},!0)})}async next(...e){return this.signal?.throwIfAborted(),this.firstResultUsed?Ap.runWithConfig(Kg(this.config),this.signal?async()=>Ev(this.generator.next(...e),this.signal):async()=>this.generator.next(...e),!0):(this.firstResultUsed=!0,this.firstResult)}async return(e){return this.generator.return(e)}async throw(e){return this.generator.throw(e)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}}});async function wXe(t,e){if(e==="original")throw new Error("Do not assign inputs with original schema drop the key for now. When inputs are added to streamLog they should be added with standardized schema for streaming events.");let{inputs:r}=t;if(["retriever","llm","prompt"].includes(t.run_type))return r;if(!(Object.keys(r).length===1&&r?.input===""))return r.input}async function xXe(t,e){let{outputs:r}=t;return e==="original"||["retriever","llm","prompt"].includes(t.run_type)?r:r!==void 0&&Object.keys(r).length===1&&r?.output!==void 0?r.output:r}function bEr(t){return t!==void 0&&t.message!==void 0}var Lb,q6,SXe,H6,CXe=b(()=>{Ywe();xj();Pv();Cj();Lb=class{constructor(e){Object.defineProperty(this,"ops",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.ops=e.ops??[]}concat(e){let r=this.ops.concat(e.ops),n=zA({},r);return new q6({ops:r,state:n[n.length-1].newDocument})}},q6=class t extends Lb{constructor(e){super(e),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.state=e.state}concat(e){let r=this.ops.concat(e.ops),n=zA(this.state,e.ops);return new t({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=zA({},e.ops);return new t({ops:e.ops,state:r[r.length-1].newDocument})}},SXe=t=>t.name==="log_stream_tracer";H6=class extends zg{constructor(e){super({_awaitHandler:!0,...e}),Object.defineProperty(this,"autoClose",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"includeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_schemaFormat",{enumerable:!0,configurable:!0,writable:!0,value:"original"}),Object.defineProperty(this,"rootId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"keyMapByRunId",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"counterMapByRunName",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"transformStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"writer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"receiveStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"log_stream_tracer"}),Object.defineProperty(this,"lc_prefer_streaming",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.autoClose=e?.autoClose??!0,this.includeNames=e?.includeNames,this.includeTypes=e?.includeTypes,this.includeTags=e?.includeTags,this.excludeNames=e?.excludeNames,this.excludeTypes=e?.excludeTypes,this.excludeTags=e?.excludeTags,this._schemaFormat=e?._schemaFormat??this._schemaFormat,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=Tf.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){if(e.id===this.rootId)return!1;let r=e.tags??[],n=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(n=n||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(e.run_type)),this.includeTags!==void 0&&(n=n||r.find(o=>this.includeTags?.includes(o))!==void 0),this.excludeNames!==void 0&&(n=n&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(e.run_type)),this.excludeTags!==void 0&&(n=n&&r.every(o=>!this.excludeTags?.includes(o))),n}async*tapOutputIterable(e,r){for await(let n of r){if(e!==this.rootId){let o=this.keyMapByRunId[e];o&&await this.writer.write(new Lb({ops:[{op:"add",path:`/logs/${o}/streamed_output/-`,value:n}]}))}yield n}}async onRunCreate(e){if(this.rootId===void 0&&(this.rootId=e.id,await this.writer.write(new Lb({ops:[{op:"replace",path:"",value:{id:e.id,name:e.name,type:e.run_type,streamed_output:[],final_output:void 0,logs:{}}}]}))),!this._includeRun(e))return;this.counterMapByRunName[e.name]===void 0&&(this.counterMapByRunName[e.name]=0),this.counterMapByRunName[e.name]+=1;let r=this.counterMapByRunName[e.name];this.keyMapByRunId[e.id]=r===1?e.name:`${e.name}:${r}`;let n={id:e.id,name:e.name,type:e.run_type,tags:e.tags??[],metadata:e.extra?.metadata??{},start_time:new Date(e.start_time).toISOString(),streamed_output:[],streamed_output_str:[],final_output:void 0,end_time:void 0};this._schemaFormat==="streaming_events"&&(n.inputs=await wXe(e,this._schemaFormat)),await this.writer.write(new Lb({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[e.id]}`,value:n}]}))}async onRunUpdate(e){try{let r=this.keyMapByRunId[e.id];if(r===void 0)return;let n=[];this._schemaFormat==="streaming_events"&&n.push({op:"replace",path:`/logs/${r}/inputs`,value:await wXe(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await xXe(e,this._schemaFormat)}),e.end_time!==void 0&&n.push({op:"add",path:`/logs/${r}/end_time`,value:new Date(e.end_time).toISOString()});let o=new Lb({ops:n});await this.writer.write(o)}finally{if(e.id===this.rootId){let r=new Lb({ops:[{op:"replace",path:"/final_output",value:await xXe(e,this._schemaFormat)}]});await this.writer.write(r),this.autoClose&&await this.writer.close()}}}async onLLMNewToken(e,r,n){let o=this.keyMapByRunId[e.id];if(o===void 0)return;let i=e.inputs.messages!==void 0,a;i?bEr(n?.chunk)?a=n?.chunk:a=new vr({id:`run-${e.id}`,content:r}):a=r;let s=new Lb({ops:[{op:"add",path:`/logs/${o}/streamed_output_str/-`,value:r},{op:"add",path:`/logs/${o}/streamed_output/-`,value:a}]});await this.writer.write(s)}}});var V6,Cm,co,MB=b(()=>{V6="__run",Cm=class t{constructor(e){Object.defineProperty(this,"text",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"generationInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new t({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},co=class t extends Cm{constructor(e){super(e),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.message=e.message}concat(e){return new t({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo},message:this.message.concat(e.message)})}}});function WQ({name:t,serialized:e}){return t!==void 0?t:e?.name!==void 0?e.name:e?.id!==void 0&&Array.isArray(e?.id)?e.id[e.id.length-1]:"Unnamed"}var OXe,KQ,EXe=b(()=>{xj();Pv();Cj();MB();OXe=t=>t.name==="event_stream_tracer",KQ=class extends zg{constructor(e){super({_awaitHandler:!0,...e}),Object.defineProperty(this,"autoClose",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"includeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"runInfoMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"tappedPromises",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"transformStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"writer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"receiveStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"event_stream_tracer"}),Object.defineProperty(this,"lc_prefer_streaming",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.autoClose=e?.autoClose??!0,this.includeNames=e?.includeNames,this.includeTypes=e?.includeTypes,this.includeTags=e?.includeTags,this.excludeNames=e?.excludeNames,this.excludeTypes=e?.excludeTypes,this.excludeTags=e?.excludeTags,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=Tf.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){let r=e.tags??[],n=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(n=n||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(e.runType)),this.includeTags!==void 0&&(n=n||r.find(o=>this.includeTags?.includes(o))!==void 0),this.excludeNames!==void 0&&(n=n&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(e.runType)),this.excludeTags!==void 0&&(n=n&&r.every(o=>!this.excludeTags?.includes(o))),n}async*tapOutputIterable(e,r){let n=await r.next();if(n.done)return;let o=this.runInfoMap.get(e);if(o===void 0){yield n.value;return}function i(s,u){return s==="llm"&&typeof u=="string"?new Cm({text:u}):u}let a=this.tappedPromises.get(e);if(a===void 0){let s;a=new Promise(u=>{s=u}),this.tappedPromises.set(e,a);try{let u={event:`on_${o.runType}_stream`,run_id:e,name:o.name,tags:o.tags,metadata:o.metadata,data:{}};await this.send({...u,data:{chunk:i(o.runType,n.value)}},o),yield n.value;for await(let l of r)o.runType!=="tool"&&o.runType!=="retriever"&&await this.send({...u,data:{chunk:i(o.runType,l)}},o),yield l}finally{s()}}else{yield n.value;for await(let s of r)yield s}}async send(e,r){this._includeRun(r)&&await this.writer.write(e)}async sendEndEvent(e,r){let n=this.tappedPromises.get(e.run_id);n!==void 0?n.then(()=>{this.send(e,r)}):await this.send(e,r)}async onLLMStart(e){let r=WQ(e),n=e.inputs.messages!==void 0?"chat_model":"llm",o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:n,inputs:e.inputs};this.runInfoMap.set(e.id,o);let i=`on_${n}_start`;await this.send({event:i,data:{input:e.inputs},name:r,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onLLMNewToken(e,r,n){let o=this.runInfoMap.get(e.id),i,a;if(o===void 0)throw new Error(`onLLMNewToken: Run ID ${e.id} not found in run map.`);if(this.runInfoMap.size!==1){if(o.runType==="chat_model")a="on_chat_model_stream",n?.chunk===void 0?i=new vr({content:r,id:`run-${e.id}`}):i=n.chunk.message;else if(o.runType==="llm")a="on_llm_stream",n?.chunk===void 0?i=new Cm({text:r}):i=n.chunk;else throw new Error(`Unexpected run type ${o.runType}`);await this.send({event:a,data:{chunk:i},run_id:e.id,name:o.name,tags:o.tags,metadata:o.metadata},o)}}async onLLMEnd(e){let r=this.runInfoMap.get(e.id);this.runInfoMap.delete(e.id);let n;if(r===void 0)throw new Error(`onLLMEnd: Run ID ${e.id} not found in run map.`);let o=e.outputs?.generations,i;if(r.runType==="chat_model"){for(let a of o??[]){if(i!==void 0)break;i=a[0]?.message}n="on_chat_model_end"}else if(r.runType==="llm")i={generations:o?.map(a=>a.map(s=>({text:s.text,generationInfo:s.generationInfo}))),llmOutput:e.outputs?.llmOutput??{}},n="on_llm_end";else throw new Error(`onLLMEnd: Unexpected run type: ${r.runType}`);await this.sendEndEvent({event:n,data:{output:i,input:r.inputs},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async onChainStart(e){let r=WQ(e),n=e.run_type??"chain",o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:e.run_type},i={};e.inputs.input===""&&Object.keys(e.inputs).length===1?(i={},o.inputs={}):e.inputs.input!==void 0?(i.input=e.inputs.input,o.inputs=e.inputs.input):(i.input=e.inputs,o.inputs=e.inputs),this.runInfoMap.set(e.id,o),await this.send({event:`on_${n}_start`,data:i,name:r,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onChainEnd(e){let r=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),r===void 0)throw new Error(`onChainEnd: Run ID ${e.id} not found in run map.`);let n=`on_${e.run_type}_end`,o=e.inputs??r.inputs??{},a={output:e.outputs?.output??e.outputs,input:o};o.input&&Object.keys(o).length===1&&(a.input=o.input,r.inputs=o.input),await this.sendEndEvent({event:n,data:a,run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata??{}},r)}async onToolStart(e){let r=WQ(e),n={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:"tool",inputs:e.inputs??{}};this.runInfoMap.set(e.id,n),await this.send({event:"on_tool_start",data:{input:e.inputs??{}},name:r,run_id:e.id,tags:e.tags??[],metadata:e.extra?.metadata??{}},n)}async onToolEnd(e){let r=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),r===void 0)throw new Error(`onToolEnd: Run ID ${e.id} not found in run map.`);if(r.inputs===void 0)throw new Error(`onToolEnd: Run ID ${e.id} is a tool call, and is expected to have traced inputs.`);let n=e.outputs?.output===void 0?e.outputs:e.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:n,input:r.inputs},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async onRetrieverStart(e){let r=WQ(e),o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:"retriever",inputs:{query:e.inputs.query}};this.runInfoMap.set(e.id,o),await this.send({event:"on_retriever_start",data:{input:{query:e.inputs.query}},name:r,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onRetrieverEnd(e){let r=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),r===void 0)throw new Error(`onRetrieverEnd: Run ID ${e.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:e.outputs?.documents??e.outputs,input:r.inputs},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async handleCustomEvent(e,r,n){let o=this.runInfoMap.get(n);if(o===void 0)throw new Error(`handleCustomEvent: Run ID ${n} not found in run map.`);await this.send({event:"on_custom_event",run_id:n,name:e,tags:o.tags,metadata:o.metadata,data:r},o)}async finish(){let e=[...this.tappedPromises.values()];Promise.all(e).finally(()=>{this.writer.close()})}}});var PXe,GQ,_Er,vEr,Mh,RB=b(()=>{PXe=j(WX(),1),GQ=j(yQ(),1),_Er=[400,401,402,403,404,405,406,407,409],vEr=t=>{if(t.message.startsWith("Cancel")||t.message.startsWith("AbortError")||t.name==="AbortError"||t?.code==="ECONNABORTED")throw t;let e=t?.response?.status??t?.status;if(e&&_Er.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},Mh=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedAttempt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.onFailedAttempt=e.onFailedAttempt??vEr;let r="default"in GQ.default?GQ.default.default:GQ.default;this.queue=new r({concurrency:this.maxConcurrency})}call(e,...r){return this.queue.add(()=>(0,PXe.default)(()=>e(...r).catch(n=>{throw n instanceof Error?n:new Error(n)}),{onFailedAttempt:this.onFailedAttempt,retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(e,r,...n){return e.signal?Promise.race([this.call(r,...n),new Promise((o,i)=>{e.signal?.addEventListener("abort",()=>{i(new Error("AbortError"))})})]):this.call(r,...n)}fetch(...e){return this.call(()=>fetch(...e).then(r=>r.ok?r:Promise.reject(r)))}}});var W6,TXe=b(()=>{xj();W6=class extends zg{constructor({config:e,onStart:r,onEnd:n,onError:o}){super({_awaitHandler:!0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RootListenersTracer"}),Object.defineProperty(this,"rootId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"argOnStart",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"argOnEnd",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"argOnError",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.config=e,this.argOnStart=r,this.argOnEnd=n,this.argOnError=o}persistRun(e){return Promise.resolve()}async onRunCreate(e){this.rootId||(this.rootId=e.id,this.argOnStart&&await this.argOnStart(e,this.config))}async onRunUpdate(e){e.id===this.rootId&&(e.error?this.argOnError&&await this.argOnError(e,this.config):this.argOnEnd&&await this.argOnEnd(e,this.config))}}});function K6(t){return t?t.lc_runnable:!1}var JQ,Cxe=b(()=>{JQ=class{constructor(e){Object.defineProperty(this,"includeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.includeNames=e.includeNames,this.includeTypes=e.includeTypes,this.includeTags=e.includeTags,this.excludeNames=e.excludeNames,this.excludeTypes=e.excludeTypes,this.excludeTags=e.excludeTags}includeEvent(e,r){let n=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,o=e.tags??[];return this.includeNames!==void 0&&(n=n||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(r)),this.includeTags!==void 0&&(n=n||o.some(i=>this.includeTags?.includes(i))),this.excludeNames!==void 0&&(n=n&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(r)),this.excludeTags!==void 0&&(n=n&&o.every(i=>!this.excludeTags?.includes(i))),n}}});function Oxe(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function xEr(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n};
`;return e}function AXe(t,e,r){let{firstNode:n,lastNode:o,nodeColors:i,withStyles:a=!0,curveStyle:s="linear",wrapLabelNWords:u=9}=r??{},l=a?`%%{init: {'flowchart': {'curve': '${s}'}}}%%
graph TD;
`:`graph TD;
`;if(a){let p="default",m={[p]:"{0}({1})"};n!==void 0&&(m[n]="{0}([{1}]):::first"),o!==void 0&&(m[o]="{0}([{1}]):::last");for(let[h,y]of Object.entries(t)){let g=y.name.split(":").pop()??"",w=wEr.some(C=>g.startsWith(C)&&g.endsWith(C))?`<p>${g}</p>`:g;Object.keys(y.metadata??{}).length&&(w+=`<hr/><small><em>${Object.entries(y.metadata??{}).map(([C,E])=>`${C} = ${E}`).join(`
`)}</em></small>`);let S=(m[h]??m[p]).replace("{0}",Oxe(h)).replace("{1}",w);l+=` ${S}
`}}let c={};for(let p of e){let m=p.source.split(":"),h=p.target.split(":"),y=m.filter((g,_)=>g===h[_]).join(":");c[y]||(c[y]=[]),c[y].push(p)}let d=new Set;function f(p,m){let h=p.length===1&&p[0].source===p[0].target;if(m&&!h){let y=m.split(":").pop();if(d.has(y))throw new Error(`Found duplicate subgraph '${y}' -- this likely means that you're reusing a subgraph node with the same name. Please adjust your graph to have subgraph nodes with unique names.`);d.add(y),l+=` subgraph ${y}
`}for(let y of p){let{source:g,target:_,data:w,conditional:S}=y,C="";if(w!==void 0){let E=w,P=E.split(" ");P.length>u&&(E=Array.from({length:Math.ceil(P.length/u)},(T,I)=>P.slice(I*u,(I+1)*u).join(" ")).join("&nbsp;<br>&nbsp;")),C=S?` -. &nbsp;${E}&nbsp; .-> `:` -- &nbsp;${E}&nbsp; --> `}else C=S?" -.-> ":" --> ";l+=` ${Oxe(g)}${C}${Oxe(_)};
`}for(let y in c)y.startsWith(`${m}:`)&&y!==m&&f(c[y],y);m&&!h&&(l+=` end
`)}f(c[""]??[],"");for(let p in c)!p.includes(":")&&p!==""&&f(c[p],p);return a&&(l+=xEr(i??{})),l}async function IXe(t,e){let{backgroundColor:r="white"}=e??{},n=btoa(t);r!==void 0&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(r)||(r=`!${r}`));let o=`https://mermaid.ink/img/${n}?bgColor=${r}`,i=await fetch(o);if(!i.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${i.status}`,`Status text: ${i.statusText}`].join(`
`));return await i.blob()}var wEr,MXe=b(()=>{wEr=["*","_","`"]});function NB(t,e,r){function n(s,u){var l;Object.defineProperty(s,"_zod",{value:s._zod??{},enumerable:!1}),(l=s._zod).traits??(l.traits=new Set),s._zod.traits.add(t),e(s,u);for(let c in a.prototype)c in s||Object.defineProperty(s,c,{value:a.prototype[c].bind(s)});s._zod.constr=a,s._zod.def=u}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:t});function a(s){var u;let l=r?.Parent?new i:this;n(l,s),(u=l._zod).deferred??(u.deferred=[]);for(let c of l._zod.deferred)c();return l}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}function jB(t){return t&&Object.assign(Exe,t),Exe}var eeo,teo,GA,Exe,G6=b(()=>{eeo=Object.freeze({status:"aborted"});teo=Symbol("zod_brand"),GA=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Exe={}});function Pxe(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function NXe(t,e){return typeof e=="bigint"?e.toString():e}function jXe(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function DB(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function DXe(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function YQ(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function ZQ(t){return typeof t=="string"?t:t?.message}function LB(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=ZQ(t.inst?._zod.def?.error?.(t))??ZQ(e?.error?.(t))??ZQ(r.customError?.(t))??ZQ(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}var Txe,SEr,reo,JA=b(()=>{Txe=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{},SEr=jXe(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});reo={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}});var LXe,FXe,J6,Axe=b(()=>{G6();JA();LXe=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,NXe,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},FXe=NB("$ZodError",LXe),J6=NB("$ZodError",LXe,{Parent:Error})});var OEr,XQ,EEr,kXe,PEr,$Xe,TEr,BXe,Ixe=b(()=>{G6();Axe();JA();OEr=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new GA;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(u=>LB(u,i,jB())));throw Txe(s,o?.callee),s}return a.value},XQ=OEr(J6),EEr=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??t)(a.issues.map(u=>LB(u,i,jB())));throw Txe(s,o?.callee),s}return a.value},kXe=EEr(J6),PEr=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new GA;return i.issues.length?{success:!1,error:new(t??FXe)(i.issues.map(a=>LB(a,o,jB())))}:{success:!0,data:i.value}},$Xe=PEr(J6),TEr=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(a=>LB(a,o,jB())))}:{success:!0,data:i.value}},BXe=TEr(J6)});var AEr,ieo,zXe=b(()=>{AEr="(?:(?:\\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])))",ieo=new RegExp(`^${AEr}$`)});var UXe=b(()=>{});var qXe=b(()=>{});var HXe,Mxe=b(()=>{HXe={major:4,minor:0,patch:0}});var MEr,VXe,WXe=b(()=>{G6();Ixe();JA();Mxe();JA();MEr=NB("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=HXe;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(i,a,s)=>{let u=YQ(i),l;for(let c of a){if(c._zod.def.when){if(!c._zod.def.when(i))continue}else if(u)continue;let d=i.issues.length,f=c._zod.check(i);if(f instanceof Promise&&s?.async===!1)throw new GA;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==d&&(u||(u=YQ(i,d)))});else{if(i.issues.length===d)continue;u||(u=YQ(i,d))}}return l?l.then(()=>i):i};t._zod.run=(i,a)=>{let s=t._zod.parse(i,a);if(s instanceof Promise){if(a.async===!1)throw new GA;return s.then(u=>o(u,n,a))}return o(s,n,a)}}t["~standard"]={validate:o=>{try{let i=$Xe(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return BXe(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),VXe=NB("$ZodNever",(t,e)=>{MEr.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)})});var KXe=b(()=>{});function NEr(){return new Z6}var Ceo,Oeo,Z6,Tv,Rxe=b(()=>{Ceo=Symbol("ZodOutput"),Oeo=Symbol("ZodInput"),Z6=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};Tv=NEr()});function GXe(t,e){return new t({type:"never",...DXe(e)})}var JXe=b(()=>{JA()});var ZXe=b(()=>{});function Y6(t,e){if(t instanceof Z6){let n=new QQ(e),o={};for(let s of t._idmap.entries()){let[u,l]=s;n.process(l)}let i={},a={registry:t,uri:e?.uri,defs:o};for(let s of t._idmap.entries()){let[u,l]=s;i[u]=n.emit(l,{...e,external:a})}if(Object.keys(o).length>0){let s=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[s]:o}}return{schemas:i}}let r=new QQ(e);return r.process(t),r.emit(t,e)}function uc(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;switch(o.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 uc(o.element,r);case"object":{for(let i in o.shape)if(uc(o.shape[i],r))return!0;return!1}case"union":{for(let i of o.options)if(uc(i,r))return!0;return!1}case"intersection":return uc(o.left,r)||uc(o.right,r);case"tuple":{for(let i of o.items)if(uc(i,r))return!0;return!!(o.rest&&uc(o.rest,r))}case"record":return uc(o.keyType,r)||uc(o.valueType,r);case"map":return uc(o.keyType,r)||uc(o.valueType,r);case"set":return uc(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return uc(o.innerType,r);case"lazy":return uc(o.getter(),r);case"default":return uc(o.innerType,r);case"prefault":return uc(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return uc(o.in,r)||uc(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var QQ,YXe=b(()=>{Rxe();JA();QQ=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Tv,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},a=this.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,s);let u=e._zod.toJSONSchema?.();if(u)s.schema=u;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},f=e._zod.parent;if(f)s.ref=f,this.process(f,d),this.seen.get(f).isParent=!0;else{let p=s.schema;switch(o.type){case"string":{let m=p;m.type="string";let{minimum:h,maximum:y,format:g,patterns:_,contentEncoding:w}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof y=="number"&&(m.maxLength=y),g&&(m.format=i[g]??g,m.format===""&&delete m.format),w&&(m.contentEncoding=w),_&&_.size>0){let S=[..._];S.length===1?m.pattern=S[0].source:S.length>1&&(s.schema.allOf=[...S.map(C=>({...this.target==="draft-7"?{type:"string"}:{},pattern:C.source}))])}break}case"number":{let m=p,{minimum:h,maximum:y,format:g,multipleOf:_,exclusiveMaximum:w,exclusiveMinimum:S}=e._zod.bag;typeof g=="string"&&g.includes("int")?m.type="integer":m.type="number",typeof S=="number"&&(m.exclusiveMinimum=S),typeof h=="number"&&(m.minimum=h,typeof S=="number"&&(S>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof w=="number"&&(m.exclusiveMaximum=w),typeof y=="number"&&(m.maximum=y,typeof w=="number"&&(w<=y?delete m.maximum:delete m.exclusiveMaximum)),typeof _=="number"&&(m.multipleOf=_);break}case"boolean":{let m=p;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{p.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{p.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let m=p,{minimum:h,maximum:y}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof y=="number"&&(m.maxItems=y),m.type="array",m.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let m=p;m.type="object",m.properties={};let h=o.shape;for(let _ in h)m.properties[_]=this.process(h[_],{...d,path:[...d.path,"properties",_]});let y=new Set(Object.keys(h)),g=new Set([...y].filter(_=>{let w=o.shape[_]._zod;return this.io==="input"?w.optin===void 0:w.optout===void 0}));g.size>0&&(m.required=Array.from(g)),o.catchall?._zod.def.type==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{let m=p;m.anyOf=o.options.map((h,y)=>this.process(h,{...d,path:[...d.path,"anyOf",y]}));break}case"intersection":{let m=p,h=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),y=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),g=w=>"allOf"in w&&Object.keys(w).length===1,_=[...g(h)?h.allOf:[h],...g(y)?y.allOf:[y]];m.allOf=_;break}case"tuple":{let m=p;m.type="array";let h=o.items.map((_,w)=>this.process(_,{...d,path:[...d.path,"prefixItems",w]}));if(this.target==="draft-2020-12"?m.prefixItems=h:m.items=h,o.rest){let _=this.process(o.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?m.items=_:m.additionalItems=_}o.rest&&(m.items=this.process(o.rest,{...d,path:[...d.path,"items"]}));let{minimum:y,maximum:g}=e._zod.bag;typeof y=="number"&&(m.minItems=y),typeof g=="number"&&(m.maxItems=g);break}case"record":{let m=p;m.type="object",m.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),m.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=p,h=Pxe(o.entries);h.every(y=>typeof y=="number")&&(m.type="number"),h.every(y=>typeof y=="string")&&(m.type="string"),m.enum=h;break}case"literal":{let m=p,h=[];for(let y of o.values)if(y===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof y=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(y))}else h.push(y);if(h.length!==0)if(h.length===1){let y=h[0];m.type=y===null?"null":typeof y,m.const=y}else h.every(y=>typeof y=="number")&&(m.type="number"),h.every(y=>typeof y=="string")&&(m.type="string"),h.every(y=>typeof y=="boolean")&&(m.type="string"),h.every(y=>y===null)&&(m.type="null"),m.enum=h;break}case"file":{let m=p,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:y,maximum:g,mime:_}=e._zod.bag;y!==void 0&&(h.minLength=y),g!==void 0&&(h.maxLength=g),_?_.length===1?(h.contentMediaType=_[0],Object.assign(m,h)):m.anyOf=_.map(w=>({...h,contentMediaType:w})):Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,d);p.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"success":{let m=p;m.type="boolean";break}case"default":{this.process(o.innerType,d),s.ref=o.innerType,p.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),s.ref=o.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),s.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}p.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=p,h=e._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,d),s.ref=m;break}case"readonly":{this.process(o.innerType,d),s.ref=o.innerType,p.readOnly=!0;break}case"promise":{this.process(o.innerType,d),s.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,d),s.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let l=this.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),this.io==="input"&&uc(e)&&(delete s.schema.examples,delete s.schema.default),this.io==="input"&&s.schema._prefault&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=c=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let h=n.external.registry.get(c[0])?.id,y=n.external.uri??(_=>_);if(h)return{ref:y(h)};let g=c[1].defId??c[1].schema.id??`schema${this.counter++}`;return c[1].defId=g,{defId:g,ref:`${y("__shared")}#/${d}/${g}`}}if(c[1]===o)return{ref:"#"};let p=`#/${d}/`,m=c[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:p+m}},a=c=>{if(c[1].schema.$ref)return;let d=c[1],{ref:f,defId:p}=i(c);d.def={...d.schema},p&&(d.defId=p);let m=d.schema;for(let h in m)delete m[h];m.$ref=f};if(n.cycles==="throw")for(let c of this.seen.entries()){let d=c[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of this.seen.entries()){let d=c[1];if(e===c[0]){a(c);continue}if(n.external){let p=n.external.registry.get(c[0])?.id;if(e!==c[0]&&p){a(c);continue}}if(this.metadataRegistry.get(c[0])?.id){a(c);continue}if(d.cycle){a(c);continue}if(d.count>1&&n.reused==="ref"){a(c);continue}}let s=(c,d)=>{let f=this.seen.get(c),p=f.def??f.schema,m={...p};if(f.ref===null)return;let h=f.ref;if(f.ref=null,h){s(h,d);let y=this.seen.get(h).schema;y.$ref&&d.target==="draft-7"?(p.allOf=p.allOf??[],p.allOf.push(y)):(Object.assign(p,y),Object.assign(p,m))}f.isParent||this.override({zodSchema:c,jsonSchema:p,path:f.path??[]})};for(let c of[...this.seen.entries()].reverse())s(c[0],{target:this.target});let u={};if(this.target==="draft-2020-12"?u.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?u.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){let c=n.external.registry.get(e)?.id;if(!c)throw new Error("Schema is missing an `id` property");u.$id=n.external.uri(c)}Object.assign(u,o.def);let l=n.external?.defs??{};for(let c of this.seen.entries()){let d=c[1];d.def&&d.defId&&(l[d.defId]=d.def)}n.external||Object.keys(l).length>0&&(this.target==="draft-2020-12"?u.$defs=l:u.definitions=l);try{return JSON.parse(JSON.stringify(u))}catch{throw new Error("Error converting schema to JSON.")}}}});var XXe=b(()=>{});var eee=b(()=>{G6();Ixe();Axe();WXe();UXe();Mxe();JA();zXe();KXe();Rxe();qXe();ZXe();JXe();YXe();XXe()});var eQe,QXe,tQe,tee=b(()=>{eQe=Symbol("Let zodToJsonSchema decide on which parser to use"),QXe={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},tQe=t=>typeof t=="string"?{...QXe,name:t}:{...QXe,...t}});var rQe,Nxe=b(()=>{tee();rQe=t=>{let e=tQe(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function jxe(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function fo(t,e,r,n,o){t[e]=r,jxe(t,e,n,o)}var ZA=b(()=>{});var xd=b(()=>{_6();_6()});function nQe(){return{}}var Dxe=b(()=>{});function oQe(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==re.ZodAny&&(r.items=wr(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&fo(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&fo(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(fo(r,"minItems",t.exactLength.value,t.exactLength.message,e),fo(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var Lxe=b(()=>{xd();ZA();vu()});function iQe(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?fo(r,"minimum",n.value,n.message,e):fo(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),fo(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?fo(r,"maximum",n.value,n.message,e):fo(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),fo(r,"maximum",n.value,n.message,e));break;case"multipleOf":fo(r,"multipleOf",n.value,n.message,e);break}return r}var Fxe=b(()=>{ZA()});function aQe(){return{type:"boolean"}}var kxe=b(()=>{});function ree(t,e){return wr(t.type._def,e)}var nee=b(()=>{vu()});var sQe,$xe=b(()=>{vu();sQe=(t,e)=>wr(t.innerType._def,e)});function Bxe(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>Bxe(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return jEr(t,e)}}var jEr,zxe=b(()=>{ZA();jEr=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":fo(r,"minimum",n.value,n.message,e);break;case"max":fo(r,"maximum",n.value,n.message,e);break}return r}});function uQe(t,e){return{...wr(t.innerType._def,e),default:t.defaultValue()}}var Uxe=b(()=>{vu()});function lQe(t,e){return e.effectStrategy==="input"?wr(t.schema._def,e):{}}var qxe=b(()=>{vu()});function cQe(t){return{type:"string",enum:Array.from(t.values)}}var Hxe=b(()=>{});function dQe(t,e){let r=[wr(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),wr(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(DEr(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:s,...u}=i;a=u}else n=void 0;o.push(a)}}),o.length?{allOf:o,...n}:void 0}var DEr,Vxe=b(()=>{vu();DEr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function fQe(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var Wxe=b(()=>{});function oee(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":fo(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":fo(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":kb(r,"email",n.message,e);break;case"format:idn-email":kb(r,"idn-email",n.message,e);break;case"pattern:zod":Ip(r,Fb.email,n.message,e);break}break;case"url":kb(r,"uri",n.message,e);break;case"uuid":kb(r,"uuid",n.message,e);break;case"regex":Ip(r,n.regex,n.message,e);break;case"cuid":Ip(r,Fb.cuid,n.message,e);break;case"cuid2":Ip(r,Fb.cuid2,n.message,e);break;case"startsWith":Ip(r,RegExp(`^${Gxe(n.value,e)}`),n.message,e);break;case"endsWith":Ip(r,RegExp(`${Gxe(n.value,e)}$`),n.message,e);break;case"datetime":kb(r,"date-time",n.message,e);break;case"date":kb(r,"date",n.message,e);break;case"time":kb(r,"time",n.message,e);break;case"duration":kb(r,"duration",n.message,e);break;case"length":fo(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),fo(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Ip(r,RegExp(Gxe(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&kb(r,"ipv4",n.message,e),n.version!=="v4"&&kb(r,"ipv6",n.message,e);break}case"base64url":Ip(r,Fb.base64url,n.message,e);break;case"jwt":Ip(r,Fb.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Ip(r,Fb.ipv4Cidr,n.message,e),n.version!=="v4"&&Ip(r,Fb.ipv6Cidr,n.message,e);break}case"emoji":Ip(r,Fb.emoji(),n.message,e);break;case"ulid":{Ip(r,Fb.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{kb(r,"binary",n.message,e);break}case"contentEncoding:base64":{fo(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Ip(r,Fb.base64,n.message,e);break}}break}case"nanoid":Ip(r,Fb.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Gxe(t,e){return e.patternStrategy==="escape"?FEr(t):t}function FEr(t){let e="";for(let r=0;r<t.length;r++)LEr.has(t[r])||(e+="\\"),e+=t[r];return e}function kb(t,e,r,n){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):fo(t,"format",e,r,n)}function Ip(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:pQe(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):fo(t,"pattern",pQe(e,n),r,n)}function pQe(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",i=!1,a=!1,s=!1;for(let u=0;u<n.length;u++){if(i){o+=n[u],i=!1;continue}if(r.i){if(a){if(n[u].match(/[a-z]/)){s?(o+=n[u],o+=`${n[u-2]}-${n[u]}`.toUpperCase(),s=!1):n[u+1]==="-"&&n[u+2]?.match(/[a-z]/)?(o+=n[u],s=!0):o+=`${n[u]}${n[u].toUpperCase()}`;continue}}else if(n[u].match(/[a-z]/)){o+=`[${n[u]}${n[u].toUpperCase()}]`;continue}}if(r.m){if(n[u]==="^"){o+=`(^|(?<=[\r
]))`;continue}else if(n[u]==="$"){o+=`($|(?=[\r
]))`;continue}}if(r.s&&n[u]==="."){o+=a?`${n[u]}\r
`:`[${n[u]}\r
]`;continue}o+=n[u],n[u]==="\\"?i=!0:a&&n[u]==="]"?a=!1:!a&&n[u]==="["&&(a=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return o}var Kxe,Fb,LEr,iee=b(()=>{ZA();Fb={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:()=>(Kxe===void 0&&(Kxe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Kxe),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-_]*$/};LEr=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function aee(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===re.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:wr(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:wr(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===re.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=oee(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===re.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===re.ZodBranded&&t.keyType._def.type._def.typeName===re.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=ree(t.keyType._def,e);return{...r,propertyNames:o}}}return r}var see=b(()=>{xd();vu();iee();nee()});function mQe(t,e){if(e.mapStrategy==="record")return aee(t,e);let r=wr(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=wr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}var Jxe=b(()=>{vu();see()});function hQe(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}var Zxe=b(()=>{});function gQe(){return{not:{}}}var Yxe=b(()=>{});function yQe(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Xxe=b(()=>{});function _Qe(t,e){if(e.target==="openApi3")return bQe(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in X6&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=X6[i._def.typeName];return a&&!o.includes(a)?[...o,a]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,i)=>{let a=typeof i._def.value;switch(a){case"string":case"number":case"boolean":return[...o,a];case"bigint":return[...o,"integer"];case"object":if(i._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((i,a,s)=>s.indexOf(i)===a);return{type:o.length>1?o:o[0],enum:r.reduce((i,a)=>i.includes(a._def.value)?i:[...i,a._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return bQe(t,e)}var X6,bQe,uee=b(()=>{vu();X6={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};bQe=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>wr(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0}});function vQe(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:X6[t.innerType._def.typeName],nullable:!0}:{type:[X6[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=wr(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=wr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var Qxe=b(()=>{vu();uee()});function wQe(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",jxe(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?fo(r,"minimum",n.value,n.message,e):fo(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),fo(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?fo(r,"maximum",n.value,n.message,e):fo(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),fo(r,"maximum",n.value,n.message,e));break;case"multipleOf":fo(r,"multipleOf",n.value,n.message,e);break}return r}var eSe=b(()=>{ZA()});function kEr(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":wr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":wr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function xQe(t,e){let r=e.target==="openAi",n={type:"object",...Object.entries(t.shape()).reduce((o,[i,a])=>{if(a===void 0||a._def===void 0)return o;let s=a.isOptional();s&&r&&(a instanceof gm&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=wr(a._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});return u===void 0?o:{properties:{...o.properties,[i]:u},required:s?o.required:[...o.required,i]}},{properties:{},required:[]}),additionalProperties:kEr(t,e)};return n.required.length||delete n.required,n}var tSe=b(()=>{xd();vu()});var SQe,rSe=b(()=>{vu();SQe=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return wr(t.innerType._def,e);let r=wr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var CQe,nSe=b(()=>{vu();CQe=(t,e)=>{if(e.pipeStrategy==="input")return wr(t.in._def,e);if(e.pipeStrategy==="output")return wr(t.out._def,e);let r=wr(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=wr(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function OQe(t,e){return wr(t.type._def,e)}var oSe=b(()=>{vu()});function EQe(t,e){let n={type:"array",uniqueItems:!0,items:wr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&fo(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&fo(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var iSe=b(()=>{ZA();vu()});function PQe(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>wr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:wr(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>wr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var aSe=b(()=>{vu()});function TQe(){return{not:{}}}var sSe=b(()=>{});function AQe(){return{}}var uSe=b(()=>{});var IQe,lSe=b(()=>{vu();IQe=(t,e)=>wr(t.innerType._def,e)});function wr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==eQe)return a}if(n&&!r){let a=$Er(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=zEr(t,t.typeName,e);return i&&UEr(t,e,i),o.jsonSchema=i,i}var $Er,BEr,zEr,UEr,vu=b(()=>{xd();Dxe();Lxe();Fxe();kxe();nee();$xe();zxe();Uxe();qxe();Hxe();Vxe();Wxe();Jxe();Zxe();Yxe();Xxe();Qxe();eSe();tSe();rSe();nSe();oSe();see();iSe();iee();aSe();sSe();uee();uSe();lSe();tee();$Er=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:BEr(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},BEr=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},zEr=(t,e,r)=>{switch(e){case re.ZodString:return oee(t,r);case re.ZodNumber:return wQe(t,r);case re.ZodObject:return xQe(t,r);case re.ZodBigInt:return iQe(t,r);case re.ZodBoolean:return aQe();case re.ZodDate:return Bxe(t,r);case re.ZodUndefined:return TQe();case re.ZodNull:return yQe(r);case re.ZodArray:return oQe(t,r);case re.ZodUnion:case re.ZodDiscriminatedUnion:return _Qe(t,r);case re.ZodIntersection:return dQe(t,r);case re.ZodTuple:return PQe(t,r);case re.ZodRecord:return aee(t,r);case re.ZodLiteral:return fQe(t,r);case re.ZodEnum:return cQe(t);case re.ZodNativeEnum:return hQe(t);case re.ZodNullable:return vQe(t,r);case re.ZodOptional:return SQe(t,r);case re.ZodMap:return mQe(t,r);case re.ZodSet:return EQe(t,r);case re.ZodLazy:return wr(t.getter()._def,r);case re.ZodPromise:return OQe(t,r);case re.ZodNaN:case re.ZodNever:return gQe();case re.ZodEffects:return lQe(t,r);case re.ZodAny:return nQe();case re.ZodUnknown:return AQe();case re.ZodDefault:return uQe(t,r);case re.ZodBranded:return ree(t,r);case re.ZodReadonly:return IQe(t,r);case re.ZodCatch:return sQe(t,r);case re.ZodPipeline:return CQe(t,r);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(n=>{})(e)}},UEr=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var ss,cSe=b(()=>{vu();Nxe();ss=(t,e)=>{let r=rQe(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:wr(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??{}}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=wr(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??{},a=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;a!==void 0&&(i.title=a);let s=o===void 0?n?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:i}};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in s||"oneOf"in s||"allOf"in s||"type"in s&&Array.isArray(s.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),s}});var Gg=b(()=>{tee();Nxe();ZA();vu();Dxe();Lxe();Fxe();kxe();nee();$xe();zxe();Uxe();qxe();Hxe();Vxe();Wxe();Jxe();Zxe();Yxe();Xxe();Qxe();eSe();tSe();rSe();nSe();oSe();lSe();see();iSe();iee();aSe();sSe();uee();uSe();cSe();cSe()});function CE(t,e){let r=typeof t;if(r!==typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;let n=t.length;if(n!==e.length)return!1;for(let o=0;o<n;o++)if(!CE(t[o],e[o]))return!1;return!0}if(r==="object"){if(!t||!e)return t===e;let n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(let a of n)if(!CE(t[a],e[a]))return!1;return!0}return t===e}var dSe=b(()=>{});function Rh(t){return encodeURI(qEr(t))}function qEr(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var lee=b(()=>{});function YA(t,e=Object.create(null),r=KEr,n=""){if(t&&typeof t=="object"&&!Array.isArray(t)){let i=t.$id||t.id;if(i){let a=new URL(i,r.href);a.hash.length>1?e[a.href]=t:(a.hash="",n===""?r=a:YA(t,e,r))}}else if(t!==!0&&t!==!1)return e;let o=r.href+(n?"#"+n:"");if(e[o]!==void 0)throw new Error(`Duplicate schema URI "${o}".`);if(e[o]=t,t===!0||t===!1)return e;if(t.__absolute_uri__===void 0&&Object.defineProperty(t,"__absolute_uri__",{enumerable:!1,value:o}),t.$ref&&t.__absolute_ref__===void 0){let i=new URL(t.$ref,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_ref__",{enumerable:!1,value:i.href})}if(t.$recursiveRef&&t.__absolute_recursive_ref__===void 0){let i=new URL(t.$recursiveRef,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(t.$anchor){let i=new URL("#"+t.$anchor,r.href);e[i.href]=t}for(let i in t){if(WEr[i])continue;let a=`${n}/${Rh(i)}`,s=t[i];if(Array.isArray(s)){if(HEr[i]){let u=s.length;for(let l=0;l<u;l++)YA(s[l],e,r,`${a}/${l}`)}}else if(VEr[i])for(let u in s)YA(s[u],e,r,`${a}/${Rh(u)}`);else YA(s,e,r,a)}return e}var HEr,VEr,WEr,KEr,cee=b(()=>{lee();HEr={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},VEr={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},WEr={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},KEr=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker")});function Om(t){return t.test.bind(t)}function mPr(t){return t%4===0&&(t%100!==0||t%400===0)}function MQe(t){let e=t.match(GEr);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&mPr(r)?29:JEr[n])}function RQe(t,e){let r=e.match(ZEr);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3],a=!!r[5];return(n<=23&&o<=59&&i<=59||n==23&&o==59&&i==60)&&(!t||a)}function gPr(t){let e=t.split(hPr);return e.length==2&&MQe(e[0])&&RQe(!0,e[1])}function _Pr(t){return yPr.test(t)&&bPr.test(t)}function wPr(t){if(vPr.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var GEr,JEr,ZEr,YEr,XEr,QEr,ePr,tPr,rPr,nPr,oPr,iPr,aPr,sPr,uPr,lPr,cPr,dPr,fPr,pPr,fSe,hPr,yPr,bPr,vPr,pSe=b(()=>{GEr=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,JEr=[0,31,28,31,30,31,30,31,31,30,31,30,31],ZEr=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,YEr=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,XEr=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,QEr=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,ePr=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,tPr=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,rPr=/^(?:\/(?:[^~/]|~0|~1)*)*$/,nPr=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,oPr=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,iPr=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,aPr=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,sPr=/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uPr=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,lPr=t=>{if(t[0]==='"')return!1;let[e,r,...n]=t.split("@");return!e||!r||n.length!==0||e.length>64||r.length>253||e[0]==="."||e.endsWith(".")||e.includes("..")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(e)?!1:r.split(".").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},cPr=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,dPr=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,fPr=t=>t.length>1&&t.length<80&&(/^P\d+([.,]\d+)?W$/.test(t)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(t)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(t));pPr={date:MQe,time:RQe.bind(void 0,!1),"date-time":gPr,duration:fPr,uri:_Pr,"uri-reference":Om(XEr),"uri-template":Om(QEr),url:Om(ePr),email:lPr,hostname:Om(YEr),ipv4:Om(cPr),ipv6:Om(dPr),regex:wPr,uuid:Om(tPr),"json-pointer":Om(rPr),"json-pointer-uri-fragment":Om(nPr),"relative-json-pointer":Om(oPr)},fSe={...pPr,date:Om(iPr),time:Om(aPr),"date-time":Om(sPr),"uri-reference":Om(uPr)};hPr=/t|\s/i;yPr=/\/|:/,bPr=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;vPr=/[^\\]\\Z/});var NQe,jQe=b(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(NQe||(NQe={}))});function DQe(t){let e=0,r=t.length,n=0,o;for(;n<r;)e++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<r&&(o=t.charCodeAt(n),(o&64512)==56320&&n++);return e}var mSe=b(()=>{});function wa(t,e,r="2019-09",n=YA(e),o=!0,i=null,a="#",s="#",u=Object.create(null)){if(e===!0)return{valid:!0,errors:[]};if(e===!1)return{valid:!1,errors:[{instanceLocation:a,keyword:"false",keywordLocation:a,error:"False boolean schema."}]};let l=typeof t,c;switch(l){case"boolean":case"number":case"string":c=l;break;case"object":t===null?c="null":Array.isArray(t)?c="array":c="object";break;default:throw new Error(`Instances of "${l}" type are not supported.`)}let{$ref:d,$recursiveRef:f,$recursiveAnchor:p,type:m,const:h,enum:y,required:g,not:_,anyOf:w,allOf:S,oneOf:C,if:E,then:P,else:T,format:I,properties:N,patternProperties:M,additionalProperties:D,unevaluatedProperties:k,minProperties:L,maxProperties:H,propertyNames:K,dependentRequired:G,dependentSchemas:X,dependencies:F,prefixItems:Q,items:ee,additionalItems:U,unevaluatedItems:z,contains:V,minContains:q,maxContains:W,minItems:J,maxItems:se,uniqueItems:be,minimum:ce,maximum:pe,exclusiveMinimum:Me,exclusiveMaximum:Ue,multipleOf:Et,minLength:pr,maxLength:$r,pattern:On,__absolute_ref__:Br,__absolute_recursive_ref__:Tr}=e,Ie=[];if(p===!0&&i===null&&(i=e),f==="#"){let Ne=i===null?n[Tr]:i,le=`${s}/$recursiveRef`,oe=wa(t,i===null?e:i,r,n,o,Ne,a,le,u);oe.valid||Ie.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:le,error:"A subschema had errors."},...oe.errors)}if(d!==void 0){let le=n[Br||d];if(le===void 0){let _e=`Unresolved $ref "${d}".`;throw Br&&Br!==d&&(_e+=` Absolute URI "${Br}".`),_e+=`
Known schemas:
- ${Object.keys(n).join(`
- `)}`,new Error(_e)}let oe=`${s}/$ref`,fe=wa(t,le,r,n,o,i,a,oe,u);if(fe.valid||Ie.push({instanceLocation:a,keyword:"$ref",keywordLocation:oe,error:"A subschema had errors."},...fe.errors),r==="4"||r==="7")return{valid:Ie.length===0,errors:Ie}}if(Array.isArray(m)){let Ne=m.length,le=!1;for(let oe=0;oe<Ne;oe++)if(c===m[oe]||m[oe]==="integer"&&c==="number"&&t%1===0&&t===t){le=!0;break}le||Ie.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m.join('", "')}".`})}else m==="integer"?(c!=="number"||t%1||t!==t)&&Ie.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`}):m!==void 0&&c!==m&&Ie.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`});if(h!==void 0&&(c==="object"||c==="array"?CE(t,h)||Ie.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`}):t!==h&&Ie.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`})),y!==void 0&&(c==="object"||c==="array"?y.some(Ne=>CE(t,Ne))||Ie.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(y)}.`}):y.some(Ne=>t===Ne)||Ie.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(y)}.`})),_!==void 0){let Ne=`${s}/not`;wa(t,_,r,n,o,i,a,Ne).valid&&Ie.push({instanceLocation:a,keyword:"not",keywordLocation:Ne,error:'Instance matched "not" schema.'})}let Ge=[];if(w!==void 0){let Ne=`${s}/anyOf`,le=Ie.length,oe=!1;for(let fe=0;fe<w.length;fe++){let _e=w[fe],ge=Object.create(u),Le=wa(t,_e,r,n,o,p===!0?i:null,a,`${Ne}/${fe}`,ge);Ie.push(...Le.errors),oe=oe||Le.valid,Le.valid&&Ge.push(ge)}oe?Ie.length=le:Ie.splice(le,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:Ne,error:"Instance does not match any subschemas."})}if(S!==void 0){let Ne=`${s}/allOf`,le=Ie.length,oe=!0;for(let fe=0;fe<S.length;fe++){let _e=S[fe],ge=Object.create(u),Le=wa(t,_e,r,n,o,p===!0?i:null,a,`${Ne}/${fe}`,ge);Ie.push(...Le.errors),oe=oe&&Le.valid,Le.valid&&Ge.push(ge)}oe?Ie.length=le:Ie.splice(le,0,{instanceLocation:a,keyword:"allOf",keywordLocation:Ne,error:"Instance does not match every subschema."})}if(C!==void 0){let Ne=`${s}/oneOf`,le=Ie.length,oe=C.filter((fe,_e)=>{let ge=Object.create(u),Le=wa(t,fe,r,n,o,p===!0?i:null,a,`${Ne}/${_e}`,ge);return Ie.push(...Le.errors),Le.valid&&Ge.push(ge),Le.valid}).length;oe===1?Ie.length=le:Ie.splice(le,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:Ne,error:`Instance does not match exactly one subschema (${oe} matches).`})}if((c==="object"||c==="array")&&Object.assign(u,...Ge),E!==void 0){let Ne=`${s}/if`;if(wa(t,E,r,n,o,i,a,Ne,u).valid){if(P!==void 0){let oe=wa(t,P,r,n,o,i,a,`${s}/then`,u);oe.valid||Ie.push({instanceLocation:a,keyword:"if",keywordLocation:Ne,error:'Instance does not match "then" schema.'},...oe.errors)}}else if(T!==void 0){let oe=wa(t,T,r,n,o,i,a,`${s}/else`,u);oe.valid||Ie.push({instanceLocation:a,keyword:"if",keywordLocation:Ne,error:'Instance does not match "else" schema.'},...oe.errors)}}if(c==="object"){if(g!==void 0)for(let fe of g)fe in t||Ie.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${fe}".`});let Ne=Object.keys(t);if(L!==void 0&&Ne.length<L&&Ie.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${L} properties.`}),H!==void 0&&Ne.length>H&&Ie.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${H} properties.`}),K!==void 0){let fe=`${s}/propertyNames`;for(let _e in t){let ge=`${a}/${Rh(_e)}`,Le=wa(_e,K,r,n,o,i,ge,fe);Le.valid||Ie.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:fe,error:`Property name "${_e}" does not match schema.`},...Le.errors)}}if(G!==void 0){let fe=`${s}/dependantRequired`;for(let _e in G)if(_e in t){let ge=G[_e];for(let Le of ge)Le in t||Ie.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:fe,error:`Instance has "${_e}" but does not have "${Le}".`})}}if(X!==void 0)for(let fe in X){let _e=`${s}/dependentSchemas`;if(fe in t){let ge=wa(t,X[fe],r,n,o,i,a,`${_e}/${Rh(fe)}`,u);ge.valid||Ie.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:_e,error:`Instance has "${fe}" but does not match dependant schema.`},...ge.errors)}}if(F!==void 0){let fe=`${s}/dependencies`;for(let _e in F)if(_e in t){let ge=F[_e];if(Array.isArray(ge))for(let Le of ge)Le in t||Ie.push({instanceLocation:a,keyword:"dependencies",keywordLocation:fe,error:`Instance has "${_e}" but does not have "${Le}".`});else{let Le=wa(t,ge,r,n,o,i,a,`${fe}/${Rh(_e)}`);Le.valid||Ie.push({instanceLocation:a,keyword:"dependencies",keywordLocation:fe,error:`Instance has "${_e}" but does not match dependant schema.`},...Le.errors)}}}let le=Object.create(null),oe=!1;if(N!==void 0){let fe=`${s}/properties`;for(let _e in N){if(!(_e in t))continue;let ge=`${a}/${Rh(_e)}`,Le=wa(t[_e],N[_e],r,n,o,i,ge,`${fe}/${Rh(_e)}`);if(Le.valid)u[_e]=le[_e]=!0;else if(oe=o,Ie.push({instanceLocation:a,keyword:"properties",keywordLocation:fe,error:`Property "${_e}" does not match schema.`},...Le.errors),oe)break}}if(!oe&&M!==void 0){let fe=`${s}/patternProperties`;for(let _e in M){let ge=new RegExp(_e,"u"),Le=M[_e];for(let dr in t){if(!ge.test(dr))continue;let Ii=`${a}/${Rh(dr)}`,bi=wa(t[dr],Le,r,n,o,i,Ii,`${fe}/${Rh(_e)}`);bi.valid?u[dr]=le[dr]=!0:(oe=o,Ie.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:fe,error:`Property "${dr}" matches pattern "${_e}" but does not match associated schema.`},...bi.errors))}}}if(!oe&&D!==void 0){let fe=`${s}/additionalProperties`;for(let _e in t){if(le[_e])continue;let ge=`${a}/${Rh(_e)}`,Le=wa(t[_e],D,r,n,o,i,ge,fe);Le.valid?u[_e]=!0:(oe=o,Ie.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:fe,error:`Property "${_e}" does not match additional properties schema.`},...Le.errors))}}else if(!oe&&k!==void 0){let fe=`${s}/unevaluatedProperties`;for(let _e in t)if(!u[_e]){let ge=`${a}/${Rh(_e)}`,Le=wa(t[_e],k,r,n,o,i,ge,fe);Le.valid?u[_e]=!0:Ie.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:fe,error:`Property "${_e}" does not match unevaluated properties schema.`},...Le.errors)}}}else if(c==="array"){se!==void 0&&t.length>se&&Ie.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${t.length} > ${se}).`}),J!==void 0&&t.length<J&&Ie.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${t.length} < ${J}).`});let Ne=t.length,le=0,oe=!1;if(Q!==void 0){let fe=`${s}/prefixItems`,_e=Math.min(Q.length,Ne);for(;le<_e;le++){let ge=wa(t[le],Q[le],r,n,o,i,`${a}/${le}`,`${fe}/${le}`);if(u[le]=!0,!ge.valid&&(oe=o,Ie.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:fe,error:"Items did not match schema."},...ge.errors),oe))break}}if(ee!==void 0){let fe=`${s}/items`;if(Array.isArray(ee)){let _e=Math.min(ee.length,Ne);for(;le<_e;le++){let ge=wa(t[le],ee[le],r,n,o,i,`${a}/${le}`,`${fe}/${le}`);if(u[le]=!0,!ge.valid&&(oe=o,Ie.push({instanceLocation:a,keyword:"items",keywordLocation:fe,error:"Items did not match schema."},...ge.errors),oe))break}}else for(;le<Ne;le++){let _e=wa(t[le],ee,r,n,o,i,`${a}/${le}`,fe);if(u[le]=!0,!_e.valid&&(oe=o,Ie.push({instanceLocation:a,keyword:"items",keywordLocation:fe,error:"Items did not match schema."},..._e.errors),oe))break}if(!oe&&U!==void 0){let _e=`${s}/additionalItems`;for(;le<Ne;le++){let ge=wa(t[le],U,r,n,o,i,`${a}/${le}`,_e);u[le]=!0,ge.valid||(oe=o,Ie.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:_e,error:"Items did not match additional items schema."},...ge.errors))}}}if(V!==void 0)if(Ne===0&&q===void 0)Ie.push({instanceLocation:a,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(q!==void 0&&Ne<q)Ie.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${Ne}) than minContains (${q}).`});else{let fe=`${s}/contains`,_e=Ie.length,ge=0;for(let Le=0;Le<Ne;Le++){let dr=wa(t[Le],V,r,n,o,i,`${a}/${Le}`,fe);dr.valid?(u[Le]=!0,ge++):Ie.push(...dr.errors)}ge>=(q||0)&&(Ie.length=_e),q===void 0&&W===void 0&&ge===0?Ie.splice(_e,0,{instanceLocation:a,keyword:"contains",keywordLocation:fe,error:"Array does not contain item matching schema."}):q!==void 0&&ge<q?Ie.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${q} items matching schema. Only ${ge} items were found.`}):W!==void 0&&ge>W&&Ie.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${W} items matching schema. ${ge} items were found.`})}if(!oe&&z!==void 0){let fe=`${s}/unevaluatedItems`;for(le;le<Ne;le++){if(u[le])continue;let _e=wa(t[le],z,r,n,o,i,`${a}/${le}`,fe);u[le]=!0,_e.valid||Ie.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:fe,error:"Items did not match unevaluated items schema."},..._e.errors)}}if(be)for(let fe=0;fe<Ne;fe++){let _e=t[fe],ge=typeof _e=="object"&&_e!==null;for(let Le=0;Le<Ne;Le++){if(fe===Le)continue;let dr=t[Le];(_e===dr||ge&&(typeof dr=="object"&&dr!==null)&&CE(_e,dr))&&(Ie.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${fe} and ${Le}.`}),fe=Number.MAX_SAFE_INTEGER,Le=Number.MAX_SAFE_INTEGER)}}}else if(c==="number"){if(r==="4"?(ce!==void 0&&(Me===!0&&t<=ce||t<ce)&&Ie.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${Me?"or equal to ":""} ${ce}.`}),pe!==void 0&&(Ue===!0&&t>=pe||t>pe)&&Ie.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Ue?"or equal to ":""} ${pe}.`})):(ce!==void 0&&t<ce&&Ie.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${ce}.`}),pe!==void 0&&t>pe&&Ie.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${pe}.`}),Me!==void 0&&t<=Me&&Ie.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${t} is less than ${Me}.`}),Ue!==void 0&&t>=Ue&&Ie.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${t} is greater than or equal to ${Ue}.`})),Et!==void 0){let Ne=t%Et;Math.abs(0-Ne)>=11920929e-14&&Math.abs(Et-Ne)>=11920929e-14&&Ie.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${t} is not a multiple of ${Et}.`})}}else if(c==="string"){let Ne=pr===void 0&&$r===void 0?0:DQe(t);pr!==void 0&&Ne<pr&&Ie.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${Ne} < ${pr}).`}),$r!==void 0&&Ne>$r&&Ie.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${Ne} > ${$r}).`}),On!==void 0&&!new RegExp(On,"u").test(t)&&Ie.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),I!==void 0&&fSe[I]&&!fSe[I](t)&&Ie.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${I}".`})}return{valid:Ie.length===0,errors:Ie}}var hSe=b(()=>{dSe();cee();pSe();lee();mSe()});var LQe=b(()=>{cee();hSe()});var Q6=b(()=>{dSe();cee();pSe();lee();jQe();mSe();hSe();LQe()});function Em(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_zod"in e))return!1;let r=e._zod;return typeof r=="object"&&r!==null&&"def"in r}function Nh(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_def"in e)||"_zod"in e)return!1;let r=e._def;return typeof r=="object"&&r!=null&&"typeName"in r}function Av(t){return Em(t)&&console.warn("[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior."),Nh(t)}function jh(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(Em(t)||Nh(t))}async function FQe(t,e){if(Em(t))try{return{success:!0,data:await kXe(t,e)}}catch(r){return{success:!1,error:r}}if(Nh(t))return t.safeParse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function BB(t,e){if(Em(t))return XQ(t,e);if(Nh(t))return t.parse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Pj(t){if(Em(t))return Tv.get(t)?.description;if(Nh(t)||"description"in t&&typeof t.description=="string")return t.description}function gSe(t){return jh(t)?Nh(t)?t._def.typeName==="ZodString":Em(t)?t._zod.def.type==="string":!1:!1}function $B(t){return Em(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="object":!1}function kQe(t){return Em(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="array":!1}function dee(t,e=!1){if(Nh(t))return t.strict();if($B(t)){let r=t._zod.def.shape;if(e)for(let[i,a]of Object.entries(t._zod.def.shape)){if($B(a)){let u=dee(a,e);r[i]=u}else if(kQe(a)){let u=a._zod.def.element;$B(u)&&(u=dee(u,e)),r[i]=DB(a,{...a._zod.def,element:u})}else r[i]=a;let s=Tv.get(a);s&&Tv.add(r[i],s)}let n=DB(t,{...t._zod.def,shape:r,catchall:GXe(VXe)}),o=Tv.get(t);return o&&Tv.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function xPr(t){return Nh(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function SPr(t){return Em(t)&&t._zod.def.type==="pipe"}function kB(t,e=!1){if(Nh(t))return xPr(t)?kB(t._def.schema,e):t;if(Em(t)){let r=t;if(SPr(t)&&(r=kB(t._zod.def.in,e)),e){if($B(r)){let o=r._zod.def.shape;for(let[i,a]of Object.entries(r._zod.def.shape))o[i]=kB(a,e);r=DB(r,{...r._zod.def,shape:o})}else if(kQe(r)){let o=kB(r._zod.def.element,e);r=DB(r,{...r._zod.def,element:o})}}let n=Tv.get(t);return n&&Tv.add(r,n),r}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}var OE=b(()=>{eee()});function Pm(t){if(Em(t)){let e=kB(t,!0);if($B(e)){let r=dee(e,!0);return Y6(r)}else return Y6(t)}return Nh(t)?ss(t):t}var Tj=b(()=>{eee();Gg();Q6();OE();Q6()});function CPr(t,e){if(t!==void 0&&!BA(t))return t;if(K6(e))try{let r=e.getName();return r=r.startsWith("Runnable")?r.slice(8):r,r}catch{return e.getName()}else return e.name??"UnknownSchema"}function OPr(t){return K6(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...Pm(t.data.schema),title:t.data.name}}}function $Qe(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.source)).map(o=>o.target)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function BQe(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.target)).map(o=>o.source)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}var e8,zQe=b(()=>{mj();Cxe();MXe();Tj();e8=class t{constructor(e){Object.defineProperty(this,"nodes",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"edges",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.nodes=e?.nodes??this.nodes,this.edges=e?.edges??this.edges}toJSON(){let e={};return Object.values(this.nodes).forEach((r,n)=>{e[r.id]=BA(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...OPr(r)})),edges:this.edges.map(r=>{let n={source:e[r.source],target:e[r.target]};return typeof r.data<"u"&&(n.data=r.data),typeof r.conditional<"u"&&(n.conditional=r.conditional),n})}}addNode(e,r,n){if(r!==void 0&&this.nodes[r]!==void 0)throw new Error(`Node with id ${r} already exists`);let o=r??Rs(),i={id:o,data:e,name:CPr(r,e),metadata:n};return this.nodes[o]=i,i}removeNode(e){delete this.nodes[e.id],this.edges=this.edges.filter(r=>r.source!==e.id&&r.target!==e.id)}addEdge(e,r,n,o){if(this.nodes[e.id]===void 0)throw new Error(`Source node ${e.id} not in graph`);if(this.nodes[r.id]===void 0)throw new Error(`Target node ${r.id} not in graph`);let i={source:e.id,target:r.id,data:n,conditional:o};return this.edges.push(i),i}firstNode(){return $Qe(this)}lastNode(){return BQe(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(l=>l.id).every(BA)&&(n="");let i=l=>n?`${n}:${l}`:l;Object.entries(e.nodes).forEach(([l,c])=>{this.nodes[i(l)]={...c,id:i(l)}});let a=e.edges.map(l=>({...l,source:i(l.source),target:i(l.target)}));this.edges=[...this.edges,...a];let s=e.firstNode(),u=e.lastNode();return[s?{id:i(s.id),data:s.data}:void 0,u?{id:i(u.id),data:u.data}:void 0]}trimFirstNode(){let e=this.firstNode();e&&$Qe(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&BQe(this,[e.id])&&this.removeNode(e)}reid(){let e=Object.fromEntries(Object.values(this.nodes).map(o=>[o.id,o.name])),r=new Map;Object.values(e).forEach(o=>{r.set(o,(r.get(o)||0)+1)});let n=o=>{let i=e[o];return BA(o)&&r.get(i)===1?i:o};return new t({nodes:Object.fromEntries(Object.entries(this.nodes).map(([o,i])=>[n(o),{...i,id:n(o)}])),edges:this.edges.map(o=>({...o,source:n(o.source),target:n(o.target)}))})}drawMermaid(e){let{withStyles:r,curveStyle:n,nodeColors:o={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:i}=e??{},a=this.reid(),s=a.firstNode(),u=a.lastNode();return AXe(a.nodes,a.edges,{firstNode:s?.id,lastNode:u?.id,withStyles:r,curveStyle:n,nodeColors:o,wrapLabelNWords:i})}async drawMermaidPng(e){let r=this.drawMermaid(e);return IXe(r,{backgroundColor:e?.backgroundColor})}}});function UQe(t){let e=new TextEncoder,r=new ReadableStream({async start(n){for await(let o of t)n.enqueue(e.encode(`event: data
data: ${JSON.stringify(o)}
`));n.enqueue(e.encode(`event: end
`)),n.close()}});return Tf.fromReadableStream(r)}var qQe=b(()=>{Pv()});function ySe(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function fee(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*bSe(t,e){for(;;){let{value:r,done:n}=Ap.runWithConfig(Kg(t),e.next.bind(e),!0);if(n)break;yield r}}async function*pee(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await Ap.runWithConfig(Kg(t),r.next.bind(e),!0);if(o)break;yield n}}var HQe,VQe=b(()=>{Ej();Ov();HQe=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function lc(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function EPr(t){if(YX(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function EE(t){if(typeof t=="function")return new Mp({func:t});if(zn.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=EE(n);return new XA({steps:e})}else throw new Error(`Expected a Runnable, function or object.
Instead got an unsupported type.`)}function PPr(t,e){let r=e.name??t.getName(),n=e.description??Pj(e.schema);return gSe(e.schema)?new r8({name:r,description:n,schema:dt.object({input:dt.string()}).transform(o=>o.input),bound:t}):new r8({name:r,description:n,schema:e.schema,bound:t})}var _Se,zn,Iv,mee,t8,Fi,XA,vSe,Mp,hee,zB,gee,r8,Af=b(()=>{qX();_Se=j(WX(),1);mj();Jwe();CXe();EXe();_j();Pv();xxe();Ov();RB();TXe();Cxe();Ej();zQe();qQe();VQe();FQ();OE();zn=class extends vm{constructor(){super(...arguments),Object.defineProperty(this,"lc_runnable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}getName(e){let r=this.name??this.constructor.lc_name()??this.constructor.name;return e?`${r}${e}`:r}bind(e){return new Iv({bound:this,kwargs:e,config:{}})}map(){return new mee({bound:this})}withRetry(e){return new t8({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new Iv({bound:this,config:e,kwargs:{}})}withFallbacks(e){let r=Array.isArray(e)?e:e.fallbacks;return new hee({runnable:this,fallbacks:r})}_getOptionsList(e,r=0){if(Array.isArray(e)&&e.length!==r)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${e.length} options for ${r} inputs`);if(Array.isArray(e))return e.map(Tn);if(r>1&&!Array.isArray(e)&&e.runId){console.warn("Provided runId will be used only for the first element of the batch.");let n=Object.fromEntries(Object.entries(e).filter(([o])=>o!=="runId"));return Array.from({length:r},(o,i)=>Tn(i===0?e:n))}return Array.from({length:r},()=>Tn(e))}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=o[0]?.maxConcurrency??n?.maxConcurrency,a=new Mh({maxConcurrency:i,onFailedAttempt:u=>{throw u}}),s=e.map((u,l)=>a.call(async()=>{try{return await this.invoke(u,o[l])}catch(c){if(n?.returnExceptions)return c;throw c}}));return Promise.all(s)}async*_streamIterator(e,r){yield this.invoke(e,r)}async stream(e,r){let n=Tn(r),o=new SE({generator:this._streamIterator(e,n),config:n});return await o.setup,Tf.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let r;e===void 0?r=Tn(e):r=Tn({callbacks:e.callbacks,tags:e.tags,metadata:e.metadata,runName:e.runName,configurable:e.configurable,recursionLimit:e.recursionLimit,maxConcurrency:e.maxConcurrency,runId:e.runId,timeout:e.timeout,signal:e.signal});let n={...e};return delete n.callbacks,delete n.tags,delete n.metadata,delete n.runName,delete n.configurable,delete n.recursionLimit,delete n.maxConcurrency,delete n.runId,delete n.timeout,delete n.signal,[r,n]}async _callWithConfig(e,r,n){let o=Tn(n),a=await(await Sm(o))?.handleChainStart(this.toJSON(),lc(r,"input"),o.runId,o?.runType,void 0,void 0,o?.runName??this.getName());delete o.runId;let s;try{let u=e.call(this,r,o,a);s=await Ev(u,n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(lc(s,"output")),s}async _batchWithConfig(e,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(Sm)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),lc(r[c],"input"),i[c].runId,i[c].runType,void 0,void 0,i[c].runName??this.getName());return delete i[c].runId,d})),u;try{let l=e.call(this,r,i,s,o);u=await Ev(l,i?.[0]?.signal)}catch(l){throw await Promise.all(s.map(c=>c?.handleChainError(l))),l}return await Promise.all(s.map(l=>l?.handleChainEnd(lc(u,"output")))),u}async*_transformStreamWithConfig(e,r,n){let o,i=!0,a,s=!0,u=Tn(n),l=await Sm(u);async function*c(){for await(let f of e){if(i)if(o===void 0)o=f;else try{o=Dc(o,f)}catch{o=void 0,i=!1}yield f}}let d;try{let f=await vXe(r.bind(this),c(),async()=>l?.handleChainStart(this.toJSON(),{input:""},u.runId,u.runType,void 0,void 0,u.runName??this.getName()),n?.signal,u);delete u.runId,d=f.setup;let p=d?.handlers.find(OXe),m=f.output;p!==void 0&&d!==void 0&&(m=p.tapOutputIterable(d.runId,m));let h=d?.handlers.find(SXe);h!==void 0&&d!==void 0&&(m=h.tapOutputIterable(d.runId,m));for await(let y of m)if(yield y,s)if(a===void 0)a=y;else try{a=Dc(a,y)}catch{a=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:lc(o,"input")}),f}await d?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:lc(o,"input")})}getGraph(e){let r=new e8,n=r.addNode({name:`${this.getName()}Input`,schema:dt.any()}),o=r.addNode(this),i=r.addNode({name:`${this.getName()}Output`,schema:dt.any()});return r.addEdge(n,o),r.addEdge(o,i),r}pipe(e){return new Fi({first:this,last:EE(e)})}pick(e){return this.pipe(new gee(e))}assign(e){return this.pipe(new zB(new XA({steps:e})))}async*transform(e,r){let n;for await(let o of e)n===void 0?n=o:n=Dc(n,o);yield*this._streamIterator(n,Tn(r))}async*streamLog(e,r,n){let o=new H6({...n,autoClose:!1,_schemaFormat:"original"}),i=Tn(r);yield*this._streamLog(e,o,i)}async*_streamLog(e,r,n){let{callbacks:o}=n;if(o===void 0)n.callbacks=[r];else if(Array.isArray(o))n.callbacks=o.concat([r]);else{let u=o.copy();u.addHandler(r,!0),n.callbacks=u}let i=this.stream(e,n);async function a(){try{let u=await i;for await(let l of u){let c=new Lb({ops:[{op:"add",path:"/streamed_output/-",value:l}]});await r.writer.write(c)}}finally{await r.writer.close()}}let s=a();try{for await(let u of r)yield u}finally{await s}}streamEvents(e,r,n){let o;if(r.version==="v1")o=this._streamEventsV1(e,r,n);else if(r.version==="v2")o=this._streamEventsV2(e,r,n);else throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');return r.encoding==="text/event-stream"?UQe(o):Tf.fromAsyncGenerator(o)}async*_streamEventsV2(e,r,n){let o=new KQ({...n,autoClose:!1}),i=Tn(r),a=i.runId??Rs();i.runId=a;let s=i.callbacks;if(s===void 0)i.callbacks=[o];else if(Array.isArray(s))i.callbacks=s.concat(o);else{let m=s.copy();m.addHandler(o,!0),i.callbacks=m}let u=new AbortController,l=this;async function c(){let m,h=null;try{r?.signal?"any"in AbortSignal?m=AbortSignal.any([u.signal,r.signal]):(m=r.signal,h=()=>{u.abort()},r.signal.addEventListener("abort",h,{once:!0})):m=u.signal;let y=await l.stream(e,{...i,signal:m}),g=o.tapOutputIterable(a,y);for await(let _ of g)if(u.signal.aborted)break}finally{await o.finish(),m&&h&&m.removeEventListener("abort",h)}}let d=c(),f=!1,p;try{for await(let m of o){if(!f){m.data.input=e,f=!0,p=m.run_id,yield m;continue}m.run_id===p&&m.event.endsWith("_end")&&m.data?.input&&delete m.data.input,yield m}}finally{u.abort(),await d}}async*_streamEventsV1(e,r,n){let o,i=!1,a=Tn(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new H6({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new JQ({...n}),f=this._streamLog(e,c,a);for await(let m of f){if(o?o=o.concat(m):o=q6.fromRunLogPatch(m),o.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!i){i=!0;let _={...o.state},w={run_id:_.id,event:`on_${_.type}_start`,name:l,tags:s,metadata:u,data:{input:e}};d.includeEvent(w,_.type)&&(yield w)}let h=m.ops.filter(_=>_.path.startsWith("/logs/")).map(_=>_.path.split("/")[2]),y=[...new Set(h)];for(let _ of y){let w,S={},C=o.state.logs[_];if(C.end_time===void 0?C.streamed_output.length>0?w="stream":w="start":w="end",w==="start")C.inputs!==void 0&&(S.input=C.inputs);else if(w==="end")C.inputs!==void 0&&(S.input=C.inputs),S.output=C.final_output;else if(w==="stream"){let E=C.streamed_output.length;if(E!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${E} instead. Encountered in: "${C.name}"`);S={chunk:C.streamed_output[0]},C.streamed_output=[]}yield{event:`on_${C.type}_${w}`,name:C.name,run_id:C.id,tags:C.tags,metadata:C.metadata,data:S}}let{state:g}=o;if(g.streamed_output.length>0){let _=g.streamed_output.length;if(_!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${_} instead. Encountered in: "${g.name}"`);let w={chunk:g.streamed_output[0]};g.streamed_output=[];let S={event:`on_${g.type}_stream`,run_id:g.id,tags:s,metadata:u,name:l,data:w};d.includeEvent(S,g.type)&&(yield S)}}let p=o?.state;if(p!==void 0){let m={event:`on_${p.type}_end`,name:l,run_id:p.id,tags:s,metadata:u,data:{output:p.final_output}};d.includeEvent(m,p.type)&&(yield m)}}static isRunnable(e){return K6(e)}withListeners({onStart:e,onEnd:r,onError:n}){return new Iv({bound:this,config:{},configFactories:[o=>({callbacks:[new W6({config:o,onStart:e,onEnd:r,onError:n})]})]})}asTool(e){return PPr(this,e)}},Iv=class t extends zn{static lc_name(){return"RunnableBinding"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"bound",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"configFactories",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.bound=e.bound,this.kwargs=e.kwargs,this.config=e.config,this.configFactories=e.configFactories}getName(e){return this.bound.getName(e)}async _mergeConfig(...e){let r=IB(this.config,...e);return IB(r,...this.configFactories?await Promise.all(this.configFactories.map(async n=>await n(r))):[])}bind(e){return new this.constructor({bound:this.bound,kwargs:{...this.kwargs,...e},config:this.config})}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new t8({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:e?.stopAfterAttempt,...e})}async invoke(e,r){return this.bound.invoke(e,await this._mergeConfig(Tn(r),this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(Tn(i),this.kwargs))):await this._mergeConfig(Tn(r),this.kwargs);return this.bound.batch(e,o,n)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(Tn(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(Tn(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(Tn(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(Tn(r),o.kwargs),version:r.version},n)};return Tf.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&zn.isRunnable(e.bound)}withListeners({onStart:e,onEnd:r,onError:n}){return new t({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[o=>({callbacks:[new W6({config:o,onStart:e,onEnd:r,onError:n})]})]})}},mee=class t extends zn{static lc_name(){return"RunnableEach"}constructor(e){super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"bound",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.bound=e.bound}bind(e){return new t({bound:this.bound.bind(e)})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async _invoke(e,r,n){return this.bound.batch(e,ru(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new t({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},t8=class extends Iv{static lc_name(){return"RunnableRetry"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"maxAttemptNumber",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"onFailedAttempt",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),this.maxAttemptNumber=e.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=e.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(e,r,n){let o=e>1?`retry:attempt:${e}`:void 0;return ru(r,{callbacks:n?.getChild(o)})}async _invoke(e,r,n){return(0,_Se.default)(o=>super.invoke(e,this._patchConfigForRetry(o,r,n)),{onFailedAttempt:o=>this.onFailedAttempt(o,e),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async _batch(e,r,n,o){let i={};try{await(0,_Se.default)(async a=>{let s=e.map((f,p)=>p).filter(f=>i[f.toString()]===void 0||i[f.toString()]instanceof Error),u=s.map(f=>e[f]),l=s.map(f=>this._patchConfigForRetry(a,r?.[f],n?.[f])),c=await super.batch(u,l,{...o,returnExceptions:!0}),d;for(let f=0;f<c.length;f+=1){let p=c[f],m=s[f];p instanceof Error&&d===void 0&&(d=p,d.input=u[f]),i[m.toString()]=p}if(d)throw d;return c},{onFailedAttempt:a=>this.onFailedAttempt(a,a.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(a){if(o?.returnExceptions!==!0)throw a}return Object.keys(i).sort((a,s)=>parseInt(a,10)-parseInt(s,10)).map(a=>i[parseInt(a,10)])}async batch(e,r,n){return this._batchWithConfig(this._batch.bind(this),e,r,n)}},Fi=class t extends zn{static lc_name(){return"RunnableSequence"}constructor(e){super(e),Object.defineProperty(this,"first",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"middle",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"last",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"omitSequenceTags",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),this.first=e.first,this.middle=e.middle??this.middle,this.last=e.last,this.name=e.name,this.omitSequenceTags=e.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(e,r){let n=Tn(r),i=await(await Sm(n))?.handleChainStart(this.toJSON(),lc(e,"input"),n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let a=e,s;try{let u=[this.first,...this.middle];for(let l=0;l<u.length;l+=1){let d=u[l].invoke(a,ru(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${l+1}`)}));a=await Ev(d,r?.signal)}if(r?.signal?.aborted)throw new Error("Aborted");s=await this.last.invoke(a,ru(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${this.steps.length}`)}))}catch(u){throw await i?.handleChainError(u),u}return await i?.handleChainEnd(lc(s,"output")),s}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(Sm)),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),lc(e[l],"input"),o[l].runId,void 0,void 0,void 0,o[l].runName);return delete o[l].runId,c})),s=e;try{for(let u=0;u<this.steps.length;u+=1){let c=this.steps[u].batch(s,a.map((d,f)=>{let p=d?.getChild(this.omitSequenceTags?void 0:`seq:step:${u+1}`);return ru(o[f],{callbacks:p})}),n);s=await Ev(c,o[0]?.signal)}}catch(u){throw await Promise.all(a.map(l=>l?.handleChainError(u))),u}return await Promise.all(a.map(u=>u?.handleChainEnd(lc(s,"output")))),s}async*_streamIterator(e,r){let n=await Sm(r),{runId:o,...i}=r??{},a=await n?.handleChainStart(this.toJSON(),lc(e,"input"),o,void 0,void 0,void 0,i?.runName),s=[this.first,...this.middle,this.last],u=!0,l;async function*c(){yield e}try{let d=s[0].transform(c(),ru(i,{callbacks:a?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let f=1;f<s.length;f+=1)d=await s[f].transform(d,ru(i,{callbacks:a?.getChild(this.omitSequenceTags?void 0:`seq:step:${f+1}`)}));for await(let f of d)if(r?.signal?.throwIfAborted(),yield f,u)if(l===void 0)l=f;else try{l=Dc(l,f)}catch{l=void 0,u=!1}}catch(d){throw await a?.handleChainError(d),d}await a?.handleChainEnd(lc(l,"output"))}getGraph(e){let r=new e8,n=null;return this.steps.forEach((o,i)=>{let a=o.getGraph(e);i!==0&&a.trimFirstNode(),i!==this.steps.length-1&&a.trimLastNode(),r.extend(a);let s=a.firstNode();if(!s)throw new Error(`Runnable ${o} has no first node`);n&&r.addEdge(n,s),n=a.lastNode()}),r}pipe(e){return t.isRunnableSequence(e)?new t({first:this.first,middle:this.middle.concat([this.last,e.first,...e.middle]),last:e.last,name:this.name??e.name}):new t({first:this.first,middle:[...this.middle,this.last],last:EE(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&zn.isRunnable(e)}static from([e,...r],n){let o={};return typeof n=="string"?o.name=n:n!==void 0&&(o=n),new t({...o,first:EE(e),middle:r.slice(0,-1).map(EE),last:EE(r[r.length-1])})}},XA=class t extends zn{static lc_name(){return"RunnableMap"}getStepsKeys(){return Object.keys(this.steps)}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"steps",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.steps={};for(let[r,n]of Object.entries(e.steps))this.steps[r]=EE(n)}static from(e){return new t({steps:e})}async invoke(e,r){let n=Tn(r),i=await(await Sm(n))?.handleChainStart(this.toJSON(),{input:e},n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let a={};try{let s=Object.entries(this.steps).map(async([u,l])=>{a[u]=await l.invoke(e,ru(n,{callbacks:i?.getChild(`map:key:${u}`)}))});await Ev(Promise.all(s),r?.signal)}catch(s){throw await i?.handleChainError(s),s}return await i?.handleChainEnd(a),a}async*_transform(e,r,n){let o={...this.steps},i=Sxe(e,Object.keys(o).length),a=new Map(Object.entries(o).map(([s,u],l)=>{let c=u.transform(i[l],ru(n,{callbacks:r?.getChild(`map:key:${s}`)}));return[s,c.next().then(d=>({key:s,gen:c,result:d}))]}));for(;a.size;){let s=Promise.race(a.values()),{key:u,result:l,gen:c}=await Ev(s,n?.signal);a.delete(u),l.done||(yield{[u]:l.value},a.set(u,c.next().then(d=>({key:u,gen:c,result:d}))))}}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Tn(r),i=new SE({generator:this.transform(n(),o),config:o});return await i.setup,Tf.fromAsyncGenerator(i)}},vSe=class t extends zn{constructor(e){if(super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!YX(e.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=e.func}async invoke(e,r){let[n]=this._getOptionsList(r??{},1),o=await Sm(n),i=this.func(ru(n,{callbacks:o}),e);return Ev(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(fee(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(HQe(o)){for(;;){n?.signal?.throwIfAborted();let i=o.next();if(i.done)break;yield i.value}return}yield o}static from(e){return new t({func:e})}};Mp=class t extends zn{static lc_name(){return"RunnableLambda"}constructor(e){if(YX(e.func))return vSe.from(e.func);super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),EPr(e.func),this.func=e.func}static from(e){return new t({func:e})}async _invoke(e,r,n){return new Promise((o,i)=>{let a=ru(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??VQ)-1});Ap.runWithConfig(Kg(a),async()=>{try{let s=await this.func(e,{...a});if(s&&zn.isRunnable(s)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");s=await s.invoke(e,{...a,recursionLimit:(a.recursionLimit??VQ)-1})}else if(fee(s)){let u;for await(let l of pee(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=Dc(u,l)}catch{u=l}s=u}else if(ySe(s)){let u;for(let l of bSe(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=Dc(u,l)}catch{u=l}s=u}o(s)}catch(s){i(s)}})})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async*_transform(e,r,n){let o;for await(let s of e)if(o===void 0)o=s;else try{o=Dc(o,s)}catch{o=s}let i=ru(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??VQ)-1}),a=await new Promise((s,u)=>{Ap.runWithConfig(Kg(i),async()=>{try{let l=await this.func(o,{...i,config:i});s(l)}catch(l){u(l)}})});if(a&&zn.isRunnable(a)){if(n?.recursionLimit===0)throw new Error("Recursion limit reached.");let s=await a.stream(o,i);for await(let u of s)yield u}else if(fee(a))for await(let s of pee(i,a))n?.signal?.throwIfAborted(),yield s;else if(ySe(a))for(let s of bSe(i,a))n?.signal?.throwIfAborted(),yield s;else yield a}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Tn(r),i=new SE({generator:this.transform(n(),o),config:o});return await i.setup,Tf.fromAsyncGenerator(i)}},hee=class extends zn{static lc_name(){return"RunnableWithFallbacks"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"runnable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fallbacks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.runnable=e.runnable,this.fallbacks=e.fallbacks}*runnables(){yield this.runnable;for(let e of this.fallbacks)yield e}async invoke(e,r){let n=Tn(r),o=await Sm(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),lc(e,"input"),i,void 0,void 0,void 0,a?.runName),u=ru(a,{callbacks:s?.getChild()});return await Ap.runWithConfig(u,async()=>{let c;for(let d of this.runnables()){n?.signal?.throwIfAborted();try{let f=await d.invoke(e,u);return await s?.handleChainEnd(lc(f,"output")),f}catch(f){c===void 0&&(c=f)}}throw c===void 0?new Error("No error stored at end of fallback."):(await s?.handleChainError(c),c)})}async*_streamIterator(e,r){let n=Tn(r),o=await Sm(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),lc(e,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=ru(a,{callbacks:s?.getChild()});try{let p=await d.stream(e,f);l=pee(f,p);break}catch(p){u===void 0&&(u=p)}}if(l===void 0){let d=u??new Error("No error stored at end of fallback.");throw await s?.handleChainError(d),d}let c;try{for await(let d of l){yield d;try{c=c===void 0?c:Dc(c,d)}catch{c=void 0}}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd(lc(c,"output"))}async batch(e,r,n){if(n?.returnExceptions)throw new Error("Not implemented.");let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(u=>Sm(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),lc(e[l],"input"),o[l].runId,void 0,void 0,void 0,o[l].runName);return delete o[l].runId,c})),s;for(let u of this.runnables()){o[0].signal?.throwIfAborted();try{let l=await u.batch(e,a.map((c,d)=>ru(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd(lc(l[d],"output")))),l}catch(l){s===void 0&&(s=l)}}throw s?(await Promise.all(a.map(u=>u?.handleChainError(s))),s):new Error("No error stored at end of fallbacks.")}};zB=class extends zn{static lc_name(){return"RunnableAssign"}constructor(e){e instanceof XA&&(e={mapper:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"mapper",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.mapper=e.mapper}async invoke(e,r){let n=await this.mapper.invoke(e,r);return{...e,...n}}async*_transform(e,r,n){let o=this.mapper.getStepsKeys(),[i,a]=Sxe(e),s=this.mapper.transform(a,ru(n,{callbacks:r?.getChild()})),u=s.next();for await(let l of i){if(typeof l!="object"||Array.isArray(l))throw new Error(`RunnableAssign can only be used with objects as input, got ${typeof l}`);let c=Object.fromEntries(Object.entries(l).filter(([d])=>!o.includes(d)));Object.keys(c).length>0&&(yield c)}yield(await u).value;for await(let l of s)yield l}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Tn(r),i=new SE({generator:this.transform(n(),o),config:o});return await i.setup,Tf.fromAsyncGenerator(i)}},gee=class extends zn{static lc_name(){return"RunnablePick"}constructor(e){(typeof e=="string"||Array.isArray(e))&&(e={keys:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"keys",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keys=e.keys}async _pick(e){if(typeof this.keys=="string")return e[this.keys];{let r=this.keys.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0);return r.length===0?void 0:Object.fromEntries(r)}}async invoke(e,r){return this._callWithConfig(this._pick.bind(this),e,r)}async*_transform(e){for await(let r of e){let n=await this._pick(r);n!==void 0&&(yield n)}}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Tn(r),i=new SE({generator:this.transform(n(),o),config:o});return await i.setup,Tf.fromAsyncGenerator(i)}},r8=class extends Iv{constructor(e){let r=Fi.from([Mp.from(async n=>{let o;if(HA(n))try{o=await BB(this.schema,n.args)}catch{throw new Sj("Received tool input did not match expected schema",JSON.stringify(n.args))}else o=n;return o}).withConfig({runName:`${e.name}:parse_input`}),e.bound]).withConfig({runName:e.name});super({bound:r,config:e.config??{}}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.schema=e.schema}static lc_name(){return"RunnableToolLike"}}});var Fo,yee=b(()=>{Pv();Af();Ov();Fo=class extends zn{static lc_name(){return"RunnablePassthrough"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e&&(this.func=e.func)}async invoke(e,r){let n=Tn(r);return this.func&&await this.func(e,n),this._callWithConfig(o=>Promise.resolve(o),e,n)}async*transform(e,r){let n=Tn(r),o,i=!0;for await(let a of this._transformStreamWithConfig(e,s=>s,n))if(yield a,i)if(o===void 0)o=a;else try{o=Dc(o,a)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,n)}static assign(e){return new zB(new XA({steps:e}))}}});var WQe=b(()=>{Af();Ov()});var KQe=b(()=>{Af();Ov();Pv()});var wSe=b(()=>{Vg()});var GQe=b(()=>{Af();Cj();Vg();kQ();$Q();k6();wSe();BQ();PB();VA()});var Aj=b(()=>{Cj();Vg();kQ();$Q();k6();BQ();VA();GQe();wSe();uxe();PB()});var JQe=b(()=>{Aj();Af();yee()});var xSe=b(()=>{Af();Ov();yee();WQe();KQe();JQe()});var Ij,Mj,Dh,UB=b(()=>{xSe();D6();Ij=class extends zn{parseResultWithPrompt(e,r,n){return this.parseResult(e,n)}_baseMessageToString(e){return typeof e.content=="string"?e.content:this._baseMessageContentToString(e.content)}_baseMessageContentToString(e){return JSON.stringify(e)}async invoke(e,r){return typeof e=="string"?this._callWithConfig(async(n,o)=>this.parseResult([{text:n}],o?.callbacks),e,{...r,runType:"parser"}):this._callWithConfig(async(n,o)=>this.parseResult([{message:n,text:this._baseMessageToString(n)}],o?.callbacks),e,{...r,runType:"parser"})}},Mj=class extends Ij{parseResult(e,r){return this.parse(e[0].text,r)}async parseWithPrompt(e,r,n){return this.parse(e,n)}_type(){throw new Error("_type not implemented")}},Dh=class extends Error{constructor(e,r,n,o=!1){if(super(e),Object.defineProperty(this,"llmOutput",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"observation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sendToLLM",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.llmOutput=r,this.observation=n,this.sendToLLM=o,o&&(n===void 0||r===void 0))throw new Error("Arguments 'observation' & 'llmOutput' are required if 'sendToLlm' is true");qA(this,"OUTPUT_PARSING_FAILURE")}}});var Rj,Nj,QA=b(()=>{Q6();UB();Vg();VA();MB();Rj=class extends Mj{async*_transform(e){for await(let r of e)typeof r=="string"?yield this.parseResult([{text:r}]):yield this.parseResult([{message:r,text:this._baseMessageToString(r)}])}async*transform(e,r){yield*this._transformStreamWithConfig(e,this._transform.bind(this),{...r,runType:"parser"})}},Nj=class extends Rj{constructor(e){super(e),Object.defineProperty(this,"diff",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.diff=e?.diff??this.diff}async*_transform(e){let r,n;for await(let o of e){if(typeof o!="string"&&typeof o.content!="string")throw new Error("Cannot handle non-string output.");let i;if(lxe(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new co({message:o,text:o.content})}else if(Hg(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new co({message:fxe(o),text:o.content})}else i=new Cm({text:o});n===void 0?n=i:n=n.concat(i);let a=await this.parsePartialResult([n]);a!=null&&!CE(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var ZQe=b(()=>{QA()});var YQe=b(()=>{UB();QA()});var bee,XQe=b(()=>{QA();bee=class extends Rj{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","output_parsers","string"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0})}static lc_name(){return"StrOutputParser"}parse(e){return Promise.resolve(e)}getFormatInstructions(){return""}_textContentToString(e){return e.text}_imageUrlContentToString(e){throw new Error('Cannot coerce a multimodal "image_url" message part into a string.')}_messageContentComplexToString(e){switch(e.type){case"text":case"text_delta":if("text"in e)return this._textContentToString(e);break;case"image_url":if("image_url"in e)return this._imageUrlContentToString(e);break;default:throw new Error(`Cannot coerce "${e.type}" message part into a string.`)}throw new Error(`Invalid content type: ${e.type}`)}_baseMessageContentToString(e){return e.reduce((r,n)=>r+this._messageContentComplexToString(n),"")}}});var Sd,QQe=b(()=>{qX();UB();OE();Tj();Sd=class extends Mj{static lc_name(){return"StructuredOutputParser"}toJSON(){return this.toJSONNotImplemented()}constructor(e){super(e),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","structured"]})}static fromZodSchema(e){return new this(e)}static fromNamesAndDescriptions(e){let r=dt.object(Object.fromEntries(Object.entries(e).map(([n,o])=>[n,dt.string().describe(o)])));return new this(r)}getFormatInstructions(){return`You must format your output as a JSON value that adheres to a given "JSON Schema" instance.
"JSON Schema" is a declarative language that allows you to annotate and validate JSON documents.
For example, the example "JSON Schema" instance {{"properties": {{"foo": {{"description": "a list of test words", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}}
would match an object with one required property, "foo". The "type" property specifies "foo" must be an "array", and the "description" property semantically describes it as "a list of test words". The items within "foo" must be strings.
Thus, the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of this example "JSON Schema". The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted.
Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas!
Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock:
\`\`\`json
${JSON.stringify(Pm(this.schema))}
\`\`\`
`}async parse(e){try{let n=(e.includes("```")?e.trim().split(/```(?:json)?/)[1]:e.trim()).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(o,i)=>`"${i.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await BB(this.schema,JSON.parse(n))}catch(r){throw new Dh(`Failed to parse. Text: "${e}". Error: ${r}`,e)}}}});var SSe=b(()=>{Ywe()});var Cd,CSe=b(()=>{QA();SSe();axe();Cd=class extends Nj{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","output_parsers"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0})}static lc_name(){return"JsonOutputParser"}_diff(e,r){if(r)return e?iQ(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return ixe(e[0].text)}async parse(e){return ixe(e,JSON.parse)}getFormatInstructions(){return""}}});var eet=b(()=>{});var tet=b(()=>{QA();SSe();eet()});var ret=b(()=>{UB();ZQe();YQe();XQe();QQe();QA();CSe();tet()});var $b=b(()=>{ret()});var n8,qB,HB,_ee,o8=b(()=>{_j();k6();VA();n8=class extends vm{},qB=class extends n8{static lc_name(){return"StringPromptValue"}constructor(e){super({value:e}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompt_values"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.value=e}toString(){return this.value}toChatMessages(){return[new eu(this.value)]}},HB=class extends n8{static lc_name(){return"ChatPromptValue"}constructor(e){Array.isArray(e)&&(e={messages:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompt_values"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"messages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.messages=e.messages}toString(){return Tp(this.messages)}toChatMessages(){return this.messages}},_ee=class extends n8{static lc_name(){return"ImagePromptValue"}constructor(e){"imageUrl"in e||(e={imageUrl:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompt_values"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"imageUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.imageUrl=e.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new eu({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var PE,i8=b(()=>{o8();VB();PE=class extends Mv{async formatPromptValue(e){let r=await this.format(e);return new qB(r)}}});function ESe(t){return typeof t=="function"}function APr(t){return KB(t)?"array":typeof t}function OSe(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function net(t,e){return t!=null&&typeof t=="object"&&e in t}function IPr(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}function RPr(t,e){return MPr.call(t,e)}function jPr(t){return!RPr(NPr,t)}function LPr(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return DPr[r]})}function zPr(t,e){if(!t)return[];var r=!1,n=[],o=[],i=[],a=!1,s=!1,u="",l=0;function c(){if(a&&!s)for(;i.length;)delete o[i.pop()];else i=[];a=!1,s=!1}var d,f,p;function m(T){if(typeof T=="string"&&(T=T.split(kPr,2)),!KB(T)||T.length!==2)throw new Error("Invalid tags: "+T);d=new RegExp(OSe(T[0])+"\\s*"),f=new RegExp("\\s*"+OSe(T[1])),p=new RegExp("\\s*"+OSe("}"+T[1]))}m(e||Jg.tags);for(var h=new s8(t),y,g,_,w,S,C;!h.eos();){if(y=h.pos,_=h.scanUntil(d),_)for(var E=0,P=_.length;E<P;++E)w=_.charAt(E),jPr(w)?(i.push(o.length),u+=w):(s=!0,r=!0,u+=" "),o.push(["text",w,y,y+1]),y+=1,w===`
`&&(c(),u="",l=0,r=!1);if(!h.scan(d))break;if(a=!0,g=h.scan(BPr)||"name",h.scan(FPr),g==="="?(_=h.scanUntil(oet),h.scan(oet),h.scanUntil(f)):g==="{"?(_=h.scanUntil(p),h.scan($Pr),h.scanUntil(f),g="&"):_=h.scanUntil(f),!h.scan(f))throw new Error("Unclosed tag at "+h.pos);if(g==">"?S=[g,_,y,h.pos,u,l,r]:S=[g,_,y,h.pos],l++,o.push(S),g==="#"||g==="^")n.push(S);else if(g==="/"){if(C=n.pop(),!C)throw new Error('Unopened section "'+_+'" at '+y);if(C[1]!==_)throw new Error('Unclosed section "'+C[1]+'" at '+y)}else g==="name"||g==="{"||g==="&"?s=!0:g==="="&&m(_)}if(c(),C=n.pop(),C)throw new Error('Unclosed section "'+C[1]+'" at '+h.pos);return qPr(UPr(o))}function UPr(t){for(var e=[],r,n,o=0,i=t.length;o<i;++o)r=t[o],r&&(r[0]==="text"&&n&&n[0]==="text"?(n[1]+=r[1],n[3]=r[3]):(e.push(r),n=r));return e}function qPr(t){for(var e=[],r=e,n=[],o,i,a=0,s=t.length;a<s;++a)switch(o=t[a],o[0]){case"#":case"^":r.push(o),n.push(o),r=o[4]=[];break;case"/":i=n.pop(),i[5]=o[2],r=n.length>0?n[n.length-1][4]:e;break;default:r.push(o)}return e}function s8(t){this.string=t,this.tail=t,this.pos=0}function WB(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Rp(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}var TPr,KB,MPr,NPr,DPr,FPr,kPr,oet,$Pr,BPr,Jg,a8,vee,iet=b(()=>{TPr=Object.prototype.toString,KB=Array.isArray||function(e){return TPr.call(e)==="[object Array]"};MPr=RegExp.prototype.test;NPr=/\S/;DPr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};FPr=/\s*/,kPr=/\s+/,oet=/\s*=/,$Pr=/\s*\}/,BPr=/#|\^|\/|>|\{|&|=|!/;s8.prototype.eos=function(){return this.tail===""};s8.prototype.scan=function(e){var r=this.tail.match(e);if(!r||r.index!==0)return"";var n=r[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};s8.prototype.scanUntil=function(e){var r=this.tail.search(e),n;switch(r){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,r),this.tail=this.tail.substring(r)}return this.pos+=n.length,n};WB.prototype.push=function(e){return new WB(e,this)};WB.prototype.lookup=function(e){var r=this.cache,n;if(r.hasOwnProperty(e))n=r[e];else{for(var o=this,i,a,s,u=!1;o;){if(e.indexOf(".")>0)for(i=o.view,a=e.split("."),s=0;i!=null&&s<a.length;)s===a.length-1&&(u=net(i,a[s])||IPr(i,a[s])),i=i[a[s++]];else i=o.view[e],u=net(o.view,e);if(u){n=i;break}o=o.parent}r[e]=n}return ESe(n)&&(n=n.call(this.view)),n};Rp.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Rp.prototype.parse=function(e,r){var n=this.templateCache,o=e+":"+(r||Jg.tags).join(":"),i=typeof n<"u",a=i?n.get(o):void 0;return a==null&&(a=zPr(e,r),i&&n.set(o,a)),a};Rp.prototype.render=function(e,r,n,o){var i=this.getConfigTags(o),a=this.parse(e,i),s=r instanceof WB?r:new WB(r,void 0);return this.renderTokens(a,s,n,e,o)};Rp.prototype.renderTokens=function(e,r,n,o,i){for(var a="",s,u,l,c=0,d=e.length;c<d;++c)l=void 0,s=e[c],u=s[0],u==="#"?l=this.renderSection(s,r,n,o,i):u==="^"?l=this.renderInverted(s,r,n,o,i):u===">"?l=this.renderPartial(s,r,n,i):u==="&"?l=this.unescapedValue(s,r):u==="name"?l=this.escapedValue(s,r,i):u==="text"&&(l=this.rawValue(s)),l!==void 0&&(a+=l);return a};Rp.prototype.renderSection=function(e,r,n,o,i){var a=this,s="",u=r.lookup(e[1]);function l(f){return a.render(f,r,n,i)}if(u){if(KB(u))for(var c=0,d=u.length;c<d;++c)s+=this.renderTokens(e[4],r.push(u[c]),n,o,i);else if(typeof u=="object"||typeof u=="string"||typeof u=="number")s+=this.renderTokens(e[4],r.push(u),n,o,i);else if(ESe(u)){if(typeof o!="string")throw new Error("Cannot use higher-order sections without the original template");u=u.call(r.view,o.slice(e[3],e[5]),l),u!=null&&(s+=u)}else s+=this.renderTokens(e[4],r,n,o,i);return s}};Rp.prototype.renderInverted=function(e,r,n,o,i){var a=r.lookup(e[1]);if(!a||KB(a)&&a.length===0)return this.renderTokens(e[4],r,n,o,i)};Rp.prototype.indentPartial=function(e,r,n){for(var o=r.replace(/[^ \t]/g,""),i=e.split(`
`),a=0;a<i.length;a++)i[a].length&&(a>0||!n)&&(i[a]=o+i[a]);return i.join(`
`)};Rp.prototype.renderPartial=function(e,r,n,o){if(n){var i=this.getConfigTags(o),a=ESe(n)?n(e[1]):n[e[1]];if(a!=null){var s=e[6],u=e[5],l=e[4],c=a;u==0&&l&&(c=this.indentPartial(a,l,s));var d=this.parse(c,i);return this.renderTokens(d,r,n,c,o)}}};Rp.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};Rp.prototype.escapedValue=function(e,r,n){var o=this.getConfigEscape(n)||Jg.escape,i=r.lookup(e[1]);if(i!=null)return typeof i=="number"&&o===Jg.escape?String(i):o(i)};Rp.prototype.rawValue=function(e){return e[1]};Rp.prototype.getConfigTags=function(e){return KB(e)?e:e&&typeof e=="object"?e.tags:void 0};Rp.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!KB(e))return e.escape};Jg={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){a8.templateCache=t},get templateCache(){return a8.templateCache}},a8=new Rp;Jg.clearCache=function(){return a8.clearCache()};Jg.parse=function(e,r){return a8.parse(e,r)};Jg.render=function(e,r,n,o){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+APr(e)+'" was given as the first argument for mustache#render(template, view, partials)');return a8.render(e,r,n,o)};Jg.escape=LPr;Jg.Scanner=s8;Jg.Context=WB;Jg.Writer=Rp;vee=Jg});function aet(){vee.escape=t=>t}var u8,set,wee,HPr,VPr,PSe,WPr,Tm,l8,jj,Dj=b(()=>{iet();D6();u8=t=>{let e=t.split(""),r=[],n=(i,a)=>{for(let s=a;s<e.length;s+=1)if(i.includes(e[s]))return s;return-1},o=0;for(;o<e.length;)if(e[o]==="{"&&o+1<e.length&&e[o+1]==="{")r.push({type:"literal",text:"{"}),o+=2;else if(e[o]==="}"&&o+1<e.length&&e[o+1]==="}")r.push({type:"literal",text:"}"}),o+=2;else if(e[o]==="{"){let i=n("}",o);if(i<0)throw new Error("Unclosed '{' in template.");r.push({type:"variable",name:e.slice(o+1,i).join("")}),o=i+1}else{if(e[o]==="}")throw new Error("Single '}' in template.");{let i=n("{}",o),a=(i<0?e.slice(o):e.slice(o,i)).join("");r.push({type:"literal",text:a}),o=i<0?e.length:i}}return r},set=t=>{let e=[];for(let r of t)if(r[0]==="name"){let n=r[1].includes(".")?r[1].split(".")[0]:r[1];e.push({type:"variable",name:n})}else if(["#","&","^",">"].includes(r[0])){if(e.push({type:"variable",name:r[1]}),r[0]==="#"&&r.length>4&&Array.isArray(r[4])){let n=set(r[4]);e.push(...n)}}else e.push({type:"literal",text:r[1]});return e},wee=t=>{aet();let e=vee.parse(t);return set(e)},HPr=(t,e)=>u8(t).reduce((r,n)=>{if(n.type==="variable"){if(n.name in e){let o=typeof e[n.name]=="string"?e[n.name]:JSON.stringify(e[n.name]);return r+o}throw new Error(`(f-string) Missing value for input ${n.name}`)}return r+n.text},""),VPr=(t,e)=>(aet(),vee.render(t,e)),PSe={"f-string":HPr,mustache:VPr},WPr={"f-string":u8,mustache:wee},Tm=(t,e,r)=>{try{return PSe[e](t,r)}catch(n){throw qA(n,"INVALID_PROMPT_INPUT")}},l8=(t,e)=>WPr[e](t),jj=(t,e,r)=>{if(!(e in PSe)){let n=Object.keys(PSe);throw new Error(`Invalid template format. Got \`${e}\`;
should be one of ${n}`)}try{let n=r.reduce((o,i)=>(o[i]="foo",o),{});Array.isArray(t)?t.forEach(o=>{if(o.type==="text")Tm(o.text,e,n);else if(o.type==="image_url")if(typeof o.image_url=="string")Tm(o.image_url,e,n);else{let i=o.image_url.url;Tm(i,e,n)}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):Tm(t,e,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var TSe={};as(TSe,{PromptTemplate:()=>If});var If,GB=b(()=>{i8();Dj();If=class t extends PE{static lc_name(){return"PromptTemplate"}constructor(e){if(super(e),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"additionalContentFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e.templateFormat==="mustache"&&e.validateTemplate===void 0&&(this.validateTemplate=!1),Object.assign(this,e),this.validateTemplate){if(this.templateFormat==="mustache")throw new Error("Mustache templates cannot be validated.");let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),jj(this.template,this.templateFormat,r)}}_getPromptType(){return"prompt"}async format(e){let r=await this.mergePartialAndUserVariables(e);return Tm(this.template,this.templateFormat,r)}static fromExamples(e,r,n,o=`
`,i=""){let a=[i,...e,r].join(o);return new t({inputVariables:n,template:a})}static fromTemplate(e,r){let{templateFormat:n="f-string",...o}=r??{},i=new Set;return l8(e,n).forEach(a=>{a.type==="variable"&&i.add(a.name)}),new t({inputVariables:[...i],templateFormat:n,template:e,...o})}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}serialize(){if(this.outputParser!==void 0)throw new Error("Cannot serialize a prompt template with an output parser");return{_type:this._getPromptType(),input_variables:this.inputVariables,template:this.template,template_format:this.templateFormat}}static async deserialize(e){if(!e.template)throw new Error("Prompt template must have a template");return new t({inputVariables:e.input_variables,template:e.template,templateFormat:e.template_format})}}});var JB,ASe=b(()=>{o8();VB();Dj();JB=class t extends Mv{static lc_name(){return"ImagePromptTemplate"}constructor(e){if(super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","image"]}),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"additionalContentFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.template=e.template,this.templateFormat=e.templateFormat??this.templateFormat,this.validateTemplate=e.validateTemplate??this.validateTemplate,this.additionalContentFields=e.additionalContentFields,this.validateTemplate){let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),jj([{type:"image_url",image_url:this.template}],this.templateFormat,r)}}_getPromptType(){return"prompt"}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}async format(e){let r={};for(let[a,s]of Object.entries(this.template))typeof s=="string"?r[a]=Tm(s,this.templateFormat,e):r[a]=s;let n=e.url||r.url,o=e.detail||r.detail;if(!n)throw new Error("Must provide either an image URL.");if(typeof n!="string")throw new Error("url must be a string.");let i={url:n};return o&&(i.detail=o),i}async formatPromptValue(e){let r=await this.format(e);return new _ee(r)}}});function ISe(t,e){let r=[];for(let n of Object.values(t))if(typeof n=="string")l8(n,e).forEach(o=>{o.type==="variable"&&r.push(o.name)});else if(Array.isArray(n))for(let o of n)typeof o=="string"?l8(o,e).forEach(i=>{i.type==="variable"&&r.push(i.name)}):typeof o=="object"&&r.push(...ISe(o,e));else typeof n=="object"&&n!==null&&r.push(...ISe(n,e));return Array.from(new Set(r))}function MSe(t,e,r){let n={};for(let[o,i]of Object.entries(t))if(typeof i=="string")n[o]=Tm(i,r,e);else if(Array.isArray(i)){let a=[];for(let s of i)typeof s=="string"?a.push(Tm(s,r,e)):typeof s=="object"&&a.push(MSe(s,e,r));n[o]=a}else typeof i=="object"&&i!==null?n[o]=MSe(i,e,r):n[o]=i;return n}var c8,RSe=b(()=>{Af();Dj();c8=class extends zn{static lc_name(){return"DictPromptTemplate"}constructor(e){let r=e.templateFormat??"f-string",n=ISe(e.template,r);super({inputVariables:n,...e}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","dict"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.template=e.template,this.templateFormat=r,this.inputVariables=n}async format(e){return MSe(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}}});function KPr(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).length===1&&"text"in t&&typeof t.text=="string"}function GPr(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:"image_url"in t&&(typeof t.image_url=="string"||typeof t.image_url=="object"&&t.image_url!==null&&"url"in t.image_url&&typeof t.image_url.url=="string")}function JPr(t){return typeof t.formatMessages=="function"}function ZPr(t,e){if(JPr(t)||Hg(t))return t;if(Array.isArray(t)&&t[0]==="placeholder"){let o=t[1];if(e?.templateFormat==="mustache"&&typeof o=="string"&&o.slice(0,2)==="{{"&&o.slice(-2)==="}}"){let i=o.slice(2,-2);return new Rv({variableName:i,optional:!0})}else if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}"){let i=o.slice(1,-1);return new Rv({variableName:i,optional:!0})}throw new Error(`Invalid placeholder template for format ${e?.templateFormat??'"f-string"'}: "${t[1]}". Expected a variable name surrounded by ${e?.templateFormat==="mustache"?"double":"single"} curly braces.`)}let r=Db(t),n;if(typeof r.content=="string"?n=r.content:n=r.content.map(o=>"text"in o?{...o,text:o.text}:"image_url"in o?{...o,image_url:o.image_url}:o),r._getType()==="human")return Nv.fromTemplate(n,e);if(r._getType()==="ai")return DSe.fromTemplate(n,e);if(r._getType()==="system")return eI.fromTemplate(n,e);if(Qs.isInstance(r))return jSe.fromTemplate(r.content,r.role,e);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function YPr(t){return t.constructor.lc_name()==="MessagesPlaceholder"}var d8,Rv,NSe,f8,jSe,p8,Nv,DSe,eI,Am,m8=b(()=>{Aj();o8();Af();i8();VB();GB();ASe();Dj();D6();RSe();d8=class extends zn{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","chat"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0})}async invoke(e,r){return this._callWithConfig(n=>this.formatMessages(n),e,{...r,runType:"prompt"})}},Rv=class extends d8{static lc_name(){return"MessagesPlaceholder"}constructor(e){typeof e=="string"&&(e={variableName:e}),super(e),Object.defineProperty(this,"variableName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"optional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.variableName=e.variableName,this.optional=e.optional??!1}get inputVariables(){return[this.variableName]}async formatMessages(e){let r=e[this.variableName];if(this.optional&&!r)return[];if(!r){let o=new Error(`Field "${this.variableName}" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages as an input value. Received: undefined`);throw o.name="InputFormatError",o}let n;try{Array.isArray(r)?n=r.map(Db):n=[Db(r)]}catch(o){let i=typeof r=="string"?r:JSON.stringify(r,null,2),a=new Error([`Field "${this.variableName}" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages or coerceable values as input.`,`Received value: ${i}`,`Additional message: ${o.message}`].join(`
`));throw a.name="InputFormatError",a.lc_error_code=o.lc_error_code,a}return n}},NSe=class extends d8{constructor(e){"prompt"in e||(e={prompt:e}),super(e),Object.defineProperty(this,"prompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.prompt=e.prompt}get inputVariables(){return this.prompt.inputVariables}async formatMessages(e){return[await this.format(e)]}},f8=class extends Mv{constructor(e){super(e)}async format(e){return(await this.formatPromptValue(e)).toString()}async formatPromptValue(e){let r=await this.formatMessages(e);return new HB(r)}},jSe=class extends NSe{static lc_name(){return"ChatMessagePromptTemplate"}constructor(e,r){"prompt"in e||(e={prompt:e,role:r}),super(e),Object.defineProperty(this,"role",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.role=e.role}async format(e){return new Qs(await this.prompt.format(e),this.role)}static fromTemplate(e,r,n){return new this(If.fromTemplate(e,{templateFormat:n?.templateFormat}),r)}};p8=class extends d8{static _messageClass(){throw new Error("Can not invoke _messageClass from inside _StringImageMessagePromptTemplate")}constructor(e,r){if("prompt"in e||(e={prompt:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","chat"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"additionalOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"prompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"messageClass",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chatMessageClass",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.prompt=e.prompt,Array.isArray(this.prompt)){let n=[];this.prompt.forEach(o=>{"inputVariables"in o&&(n=n.concat(o.inputVariables))}),this.inputVariables=n}else this.inputVariables=this.prompt.inputVariables;this.additionalOptions=r??this.additionalOptions}createMessage(e){let r=this.constructor;if(r._messageClass()){let n=r._messageClass();return new n({content:e})}else if(r.chatMessageClass){let n=r.chatMessageClass();return new n({content:e,role:this.getRoleFromMessageClass(n.lc_name())})}else throw new Error("No message class defined")}getRoleFromMessageClass(e){switch(e){case"HumanMessage":return"human";case"AIMessage":return"ai";case"SystemMessage":return"system";case"ChatMessage":return"chat";default:throw new Error("Invalid message class name")}}static fromTemplate(e,r){if(typeof e=="string")return new this(If.fromTemplate(e,r));let n=[];for(let o of e)if(typeof o=="string")n.push(If.fromTemplate(o,r));else if(o!==null)if(KPr(o)){let i="";typeof o.text=="string"&&(i=o.text??"");let a={...r,additionalContentFields:o};n.push(If.fromTemplate(i,a))}else if(GPr(o)){let i=o.image_url??"",a,s=[];if(typeof i=="string"){let u;r?.templateFormat==="mustache"?u=wee(i):u=u8(i);let l=u.flatMap(c=>c.type==="variable"?[c.name]:[]);if((l?.length??0)>0){if(l.length>1)throw new Error(`Only one format variable allowed per image template.
Got: ${l}
From: ${i}`);s=[l[0]]}else s=[];i={url:i},a=new JB({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=wee(i.url):u=u8(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new JB({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else throw new Error("Invalid image template");n.push(a)}else typeof o=="object"&&n.push(new c8({template:o,templateFormat:r?.templateFormat}));return new this({prompt:n,additionalOptions:r})}async format(e){if(this.prompt instanceof PE){let r=await this.prompt.format(e);return this.createMessage(r)}else{let r=[];for(let n of this.prompt){let o={};if(!("inputVariables"in n))throw new Error(`Prompt ${n} does not have inputVariables defined.`);for(let i of n.inputVariables)o||(o={[i]:e[i]}),o={...o,[i]:e[i]};if(n instanceof PE){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"text",text:i})}else if(n instanceof JB){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"image_url",image_url:i})}else if(n instanceof c8){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,...i})}}return this.createMessage(r)}}async formatMessages(e){return[await this.format(e)]}},Nv=class extends p8{static _messageClass(){return eu}static lc_name(){return"HumanMessagePromptTemplate"}},DSe=class extends p8{static _messageClass(){return Ln}static lc_name(){return"AIMessagePromptTemplate"}},eI=class extends p8{static _messageClass(){return xE}static lc_name(){return"SystemMessagePromptTemplate"}};Am=class t extends f8{static lc_name(){return"ChatPromptTemplate"}get lc_aliases(){return{promptMessages:"messages"}}constructor(e){if(super(e),Object.defineProperty(this,"promptMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),e.templateFormat==="mustache"&&e.validateTemplate===void 0&&(this.validateTemplate=!1),Object.assign(this,e),this.validateTemplate){let r=new Set;for(let s of this.promptMessages)if(!(s instanceof sc))for(let u of s.inputVariables)r.add(u);let n=this.inputVariables,o=new Set(this.partialVariables?n.concat(Object.keys(this.partialVariables)):n),i=new Set([...o].filter(s=>!r.has(s)));if(i.size>0)throw new Error(`Input variables \`${[...i]}\` are not used in any of the prompt messages.`);let a=new Set([...r].filter(s=>!o.has(s)));if(a.size>0)throw new Error(`Input variables \`${[...a]}\` are used in prompt messages but not in the prompt template.`)}}_getPromptType(){return"chat"}async _parseImagePrompts(e,r){if(typeof e.content=="string")return e;let n=await Promise.all(e.content.map(async o=>{if(o.type!=="image_url")return o;let i="";typeof o.image_url=="string"?i=o.image_url:i=o.image_url.url;let s=await If.fromTemplate(i,{templateFormat:this.templateFormat}).format(r);return typeof o.image_url!="string"&&"url"in o.image_url?o.image_url.url=s:o.image_url=s,o}));return e.content=n,e}async formatMessages(e){let r=await this.mergePartialAndUserVariables(e),n=[];for(let o of this.promptMessages)if(o instanceof sc)n.push(await this._parseImagePrompts(o,r));else{let i=o.inputVariables.reduce((s,u)=>{if(!(u in r)&&!(YPr(o)&&o.optional))throw qA(new Error(`Missing value for input variable \`${u.toString()}\``),"INVALID_PROMPT_INPUT");return s[u]=r[u],s},{}),a=await o.formatMessages(i);n=n.concat(a)}return n}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}static fromTemplate(e,r){let n=If.fromTemplate(e,r),o=new Nv({prompt:n});return this.fromMessages([o])}static fromMessages(e,r){let n=e.reduce((a,s)=>a.concat(s instanceof t?s.promptMessages:[ZPr(s,r)]),[]),o=e.reduce((a,s)=>s instanceof t?Object.assign(a,s.partialVariables):a,Object.create(null)),i=new Set;for(let a of n)if(!(a instanceof sc))for(let s of a.inputVariables)s in o||i.add(s);return new this({...r,inputVariables:[...i],promptMessages:n,partialVariables:o,templateFormat:r?.templateFormat})}static fromPromptMessages(e){return this.fromMessages(e)}}});var uet={};as(uet,{FewShotChatMessagePromptTemplate:()=>FSe,FewShotPromptTemplate:()=>LSe});var LSe,FSe,kSe=b(()=>{i8();Dj();GB();m8();LSe=class t extends PE{constructor(e){if(super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"examples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleSelector",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"examplePrompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"suffix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"exampleSeparator",{enumerable:!0,configurable:!0,writable:!0,value:`
`}),Object.defineProperty(this,"prefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.assign(this,e),this.examples!==void 0&&this.exampleSelector!==void 0)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(this.examples===void 0&&this.exampleSelector===void 0)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),jj(this.prefix+this.suffix,this.templateFormat,r)}}_getPromptType(){return"few_shot"}static lc_name(){return"FewShotPromptTemplate"}async getExamples(e){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(e);throw new Error("One of 'examples' and 'example_selector' should be provided")}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}async format(e){let r=await this.mergePartialAndUserVariables(e),n=await this.getExamples(r),o=await Promise.all(n.map(a=>this.examplePrompt.format(a))),i=[this.prefix,...o,this.suffix].join(this.exampleSeparator);return Tm(i,this.templateFormat,r)}serialize(){if(this.exampleSelector||!this.examples)throw new Error("Serializing an example selector is not currently supported");if(this.outputParser!==void 0)throw new Error("Serializing an output parser is not currently supported");return{_type:this._getPromptType(),input_variables:this.inputVariables,example_prompt:this.examplePrompt.serialize(),example_separator:this.exampleSeparator,suffix:this.suffix,prefix:this.prefix,template_format:this.templateFormat,examples:this.examples}}static async deserialize(e){let{example_prompt:r}=e;if(!r)throw new Error("Missing example prompt");let n=await If.deserialize(r),o;if(Array.isArray(e.examples))o=e.examples;else throw new Error("Invalid examples format. Only list or string are supported.");return new t({inputVariables:e.input_variables,examplePrompt:n,examples:o,exampleSeparator:e.example_separator,prefix:e.prefix,suffix:e.suffix,templateFormat:e.template_format})}},FSe=class t extends f8{_getPromptType(){return"few_shot_chat"}static lc_name(){return"FewShotChatMessagePromptTemplate"}constructor(e){if(super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"examples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleSelector",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"examplePrompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"suffix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"exampleSeparator",{enumerable:!0,configurable:!0,writable:!0,value:`
`}),Object.defineProperty(this,"prefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.examples=e.examples,this.examplePrompt=e.examplePrompt,this.exampleSeparator=e.exampleSeparator??`
`,this.exampleSelector=e.exampleSelector,this.prefix=e.prefix??"",this.suffix=e.suffix??"",this.templateFormat=e.templateFormat??"f-string",this.validateTemplate=e.validateTemplate??!0,this.examples!==void 0&&this.exampleSelector!==void 0)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(this.examples===void 0&&this.exampleSelector===void 0)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),jj(this.prefix+this.suffix,this.templateFormat,r)}}async getExamples(e){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(e);throw new Error("One of 'examples' and 'example_selector' should be provided")}async formatMessages(e){let r=await this.mergePartialAndUserVariables(e),n=await this.getExamples(r);n=n.map(i=>{let a={};return this.examplePrompt.inputVariables.forEach(s=>{a[s]=i[s]}),a});let o=[];for(let i of n){let a=await this.examplePrompt.formatMessages(i);o.push(...a)}return o}async format(e){let r=await this.mergePartialAndUserVariables(e),n=await this.getExamples(r),i=(await Promise.all(n.map(s=>this.examplePrompt.formatMessages(s)))).flat().map(s=>s.content),a=[this.prefix,...i,this.suffix].join(this.exampleSeparator);return Tm(a,this.templateFormat,r)}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}}});var Mv,VB=b(()=>{Af();Mv=class extends zn{get lc_attributes(){return{partialVariables:void 0}}constructor(e){super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts",this._getPromptType()]}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"partialVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let{inputVariables:r}=e;if(r.includes("stop"))throw new Error("Cannot have an input variable named 'stop', as it is used internally, please rename.");Object.assign(this,e)}async mergePartialAndUserVariables(e){let r=this.partialVariables??{},n={};for(let[i,a]of Object.entries(r))typeof a=="string"?n[i]=a:n[i]=await a();return{...n,...e}}async invoke(e,r){let n={...this.metadata,...r?.metadata},o=[...this.tags??[],...r?.tags??[]];return this._callWithConfig(i=>this.formatPromptValue(i),e,{...r,tags:o,metadata:n,runType:"prompt"})}serialize(){throw new Error("Use .toJSON() instead")}static async deserialize(e){switch(e._type){case"prompt":{let{PromptTemplate:r}=await Promise.resolve().then(()=>(GB(),TSe));return r.deserialize(e)}case void 0:{let{PromptTemplate:r}=await Promise.resolve().then(()=>(GB(),TSe));return r.deserialize({...e,_type:"prompt"})}case"few_shot":{let{FewShotPromptTemplate:r}=await Promise.resolve().then(()=>(kSe(),uet));return r.deserialize(e)}default:throw new Error(`Invalid prompt type in config: ${e._type}`)}}}});var cet=b(()=>{VB();m8()});var det=b(()=>{});var fet=b(()=>{Af();m8()});var pet=b(()=>{VB();m8();kSe();cet();GB();det();i8();Dj();ASe();fet();RSe()});var tI=b(()=>{pet()});var Im=b(()=>{xSe()});var $Se,BSe=b(()=>{$Se=t=>t.map(e=>e.pageContent).join(`
`)});var met=b(()=>{BSe()});function Lh(t,e){let r=`atom${++XPr}`,n={toString(){return(Ba.env?Ba.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=QPr,n.write=eTr),e&&(n.write=e),n}function QPr(t){return t(this)}function eTr(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}var Ba,XPr,het,zSe,USe,See,HSe,tTr,rTr,VSe,get,xee,_et,yet,ZB,qSe,nTr,oTr,bet,rI,vet,YB,h8,wet,WSe=b(()=>{Ba={},XPr=0;het=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,zSe=t=>"init"in t,USe=t=>!!t.write,See=new WeakMap,HSe=t=>{var e;return VSe(t)&&!((e=See.get(t))!=null&&e[1])},tTr=(t,e)=>{let r=See.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((Ba.env?Ba.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},rTr=t=>{if(See.has(t))return;let e=[new Set,!1];See.set(t,e);let r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},VSe=t=>typeof t?.then=="function",get=t=>"v"in t||"e"in t,xee=t=>{if("e"in t)throw t.e;if((Ba.env?Ba.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},_et=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},yet=(t,e,r,n,o)=>{var i;if((Ba.env?Ba.env.MODE:void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),HSe(r.v)&&_et(e,r.v,o),(i=o.m)==null||i.t.add(e),t&&nTr(t,n,e)},ZB=()=>[new Map,new Map,new Set],qSe=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},nTr=(t,e,r)=>{let n=t[0].get(e);n&&n.add(r)},oTr=(t,e)=>t[0].get(e),bet=(t,e)=>{t[2].add(e)},rI=t=>{let e,r=!1,n=o=>{try{o()}catch(i){r||(e=i,r=!0)}};for(;t[1].size||t[2].size;){t[0].clear();let o=new Set(t[1].values());t[1].clear();let i=new Set(t[2]);t[2].clear(),o.forEach(a=>{var s;return(s=a.m)==null?void 0:s.l.forEach(n)}),i.forEach(n)}if(r)throw e},vet=(...[t,e,r,n])=>{let o;(Ba.env?Ba.env.MODE:void 0)!=="production"&&(o=new Set);let i=(w,S,C)=>{let E="v"in S,P=S.v,T=HSe(S.v)?S.v:null;if(VSe(C)){rTr(C);for(let I of S.d.keys())_et(w,C,t(I));S.v=C,delete S.e}else S.v=C,delete S.e;(!E||!Object.is(P,S.v))&&(++S.n,T&&tTr(T,C))},a=(w,S,C)=>{var E;let P=t(S);if(get(P)&&(P.m&&!C?.has(S)||Array.from(P.d).every(([k,L])=>a(w,k,C).n===L)))return P;P.d.clear();let T=!0,I=k=>{if(het(S,k)){let H=t(k);if(!get(H))if(zSe(k))i(k,H,k.init);else throw new Error("no atom init");return xee(H)}let L=a(w,k,C);try{return xee(L)}finally{if(T)yet(w,S,P,k,L);else{let H=ZB();yet(H,S,P,k,L),p(H,S,P),rI(H)}}},N,M,D={get signal(){return N||(N=new AbortController),N.signal},get setSelf(){return(Ba.env?Ba.env.MODE:void 0)!=="production"&&!USe(S)&&console.warn("setSelf function cannot be used with read-only atom"),!M&&USe(S)&&(M=(...k)=>{if((Ba.env?Ba.env.MODE:void 0)!=="production"&&T&&console.warn("setSelf function cannot be called in sync"),!T)return f(S,...k)}),M}};try{let k=e(S,I,D);if(i(S,P,k),VSe(k)){(E=k.onCancel)==null||E.call(k,()=>N?.abort());let L=()=>{if(P.m){let H=ZB();p(H,S,P),rI(H)}};k.then(L,L)}return P}catch(k){return delete P.v,P.e=k,++P.n,P}finally{T=!1}},s=w=>xee(a(void 0,w)),u=(w,S,C)=>{var E,P;let T=new Map;for(let I of((E=C.m)==null?void 0:E.t)||[])T.set(I,t(I));for(let I of C.p)T.set(I,t(I));return(P=oTr(w,S))==null||P.forEach(I=>{T.set(I,t(I))}),T};function l(w,S,C){let E=[],P=new Set,T=new Set,I=[[S,C]];for(;I.length>0;){let[N,M]=I[I.length-1];if(T.has(N)){I.pop();continue}if(P.has(N)){E.push([N,M,M.n]),T.add(N),I.pop();continue}P.add(N);for(let[D,k]of u(w,N,M))N!==D&&!P.has(D)&&I.push([D,k])}return[E,T]}let c=(w,S,C)=>{let[E,P]=l(w,S,C),T=new Set([S]);for(let I=E.length-1;I>=0;--I){let[N,M,D]=E[I],k=!1;for(let L of M.d.keys())if(L!==N&&T.has(L)){k=!0;break}k&&(a(w,N,P),p(w,N,M),D!==M.n&&(qSe(w,N,M),T.add(N))),P.delete(N)}},d=(w,S,...C)=>{let E=!0,P=I=>xee(a(w,I)),T=(I,...N)=>{let M=t(I);try{if(het(S,I)){if(!zSe(I))throw new Error("atom not writable");let D=M.n,k=N[0];i(I,M,k),p(w,I,M),D!==M.n&&(qSe(w,I,M),c(w,I,M));return}else return d(w,I,...N)}finally{E||rI(w)}};try{return r(S,P,T,...C)}finally{E=!1}},f=(w,...S)=>{let C=ZB();try{return d(C,w,...S)}finally{rI(C)}},p=(w,S,C)=>{if(C.m&&!HSe(C.v)){for(let E of C.d.keys())C.m.d.has(E)||(m(w,E,t(E)).t.add(S),C.m.d.add(E));for(let E of C.m.d||[])if(!C.d.has(E)){C.m.d.delete(E);let P=h(w,E,t(E));P?.t.delete(S)}}},m=(w,S,C)=>{if(!C.m){a(w,S);for(let E of C.d.keys())m(w,E,t(E)).t.add(S);if(C.m={l:new Set,d:new Set(C.d.keys()),t:new Set},(Ba.env?Ba.env.MODE:void 0)!=="production"&&o.add(S),USe(S)){let E=C.m,P,T=(I,N)=>{let M=!0;P=(...D)=>{try{return d(I,S,...D)}finally{M||rI(I)}};try{return N()}finally{M=!1}};bet(w,()=>{let I=T(w,()=>n(S,(...N)=>P(...N)));I&&(E.u=N=>T(N,I))})}}return C.m},h=(w,S,C)=>{if(C.m&&!C.m.l.size&&!Array.from(C.m.t).some(E=>{var P;return(P=t(E).m)==null?void 0:P.d.has(S)})){let E=C.m.u;E&&bet(w,()=>E(w)),delete C.m,(Ba.env?Ba.env.MODE:void 0)!=="production"&&o.delete(S);for(let P of C.d.keys()){let T=h(w,P,t(P));T?.t.delete(S)}return}return C.m},_={get:s,set:f,sub:(w,S)=>{let C=ZB(),E=t(w),T=m(C,w,E).l;return T.add(S),rI(C),()=>{T.delete(S);let I=ZB();h(I,w,E),rI(I)}},unstable_derive:w=>vet(...w(t,e,r,n))};return(Ba.env?Ba.env.MODE:void 0)!=="production"&&Object.assign(_,{dev4_get_internal_weak_map:()=>({get:S=>{let C=t(S);if(C.n!==0)return C}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:S=>{let C=ZB();for(let[E,P]of S)if(zSe(E)){let T=t(E),I=T.n;i(E,T,P),p(C,E,T),I!==T.n&&(qSe(C,E,T),c(C,E,T))}rI(C)}}),_},YB=()=>{let t=new WeakMap;return vet(r=>{if((Ba.env?Ba.env.MODE:void 0)!=="production"&&!r)throw new Error("Atom is undefined or null");let n=t.get(r);return n||(n={d:new Map,p:new Set,n:0},t.set(r,n)),n},(r,...n)=>r.read(...n),(r,...n)=>r.write(...n),(r,...n)=>{var o;return(o=r.onMount)==null?void 0:o.call(r,...n)})},wet=()=>(h8||(h8=YB(),(Ba.env?Ba.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=h8),globalThis.__JOTAI_DEFAULT_STORE__!==h8&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),h8)});var Net=x(eo=>{"use strict";var g8=Symbol.for("react.element"),iTr=Symbol.for("react.portal"),aTr=Symbol.for("react.fragment"),sTr=Symbol.for("react.strict_mode"),uTr=Symbol.for("react.profiler"),lTr=Symbol.for("react.provider"),cTr=Symbol.for("react.context"),dTr=Symbol.for("react.forward_ref"),fTr=Symbol.for("react.suspense"),pTr=Symbol.for("react.memo"),mTr=Symbol.for("react.lazy"),xet=Symbol.iterator;function hTr(t){return t===null||typeof t!="object"?null:(t=xet&&t[xet]||t["@@iterator"],typeof t=="function"?t:null)}var Eet={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Pet=Object.assign,Tet={};function XB(t,e,r){this.props=t,this.context=e,this.refs=Tet,this.updater=r||Eet}XB.prototype.isReactComponent={};XB.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};XB.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Aet(){}Aet.prototype=XB.prototype;function GSe(t,e,r){this.props=t,this.context=e,this.refs=Tet,this.updater=r||Eet}var JSe=GSe.prototype=new Aet;JSe.constructor=GSe;Pet(JSe,XB.prototype);JSe.isPureReactComponent=!0;var Cet=Array.isArray,Iet=Object.prototype.hasOwnProperty,ZSe={current:null},Met={key:!0,ref:!0,__self:!0,__source:!0};function Ret(t,e,r){var n,o={},i=null,a=null;if(e!=null)for(n in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(i=""+e.key),e)Iet.call(e,n)&&!Met.hasOwnProperty(n)&&(o[n]=e[n]);var s=arguments.length-2;if(s===1)o.children=r;else if(1<s){for(var u=Array(s),l=0;l<s;l++)u[l]=arguments[l+2];o.children=u}if(t&&t.defaultProps)for(n in s=t.defaultProps,s)o[n]===void 0&&(o[n]=s[n]);return{$$typeof:g8,type:t,key:i,ref:a,props:o,_owner:ZSe.current}}function gTr(t,e){return{$$typeof:g8,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function YSe(t){return typeof t=="object"&&t!==null&&t.$$typeof===g8}function yTr(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var Oet=/\/+/g;function KSe(t,e){return typeof t=="object"&&t!==null&&t.key!=null?yTr(""+t.key):e.toString(36)}function Oee(t,e,r,n,o){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var a=!1;if(t===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case g8:case iTr:a=!0}}if(a)return a=t,o=o(a),t=n===""?"."+KSe(a,0):n,Cet(o)?(r="",t!=null&&(r=t.replace(Oet,"$&/")+"/"),Oee(o,e,r,"",function(l){return l})):o!=null&&(YSe(o)&&(o=gTr(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(Oet,"$&/")+"/")+t)),e.push(o)),1;if(a=0,n=n===""?".":n+":",Cet(t))for(var s=0;s<t.length;s++){i=t[s];var u=n+KSe(i,s);a+=Oee(i,e,r,u,o)}else if(u=hTr(t),typeof u=="function")for(t=u.call(t),s=0;!(i=t.next()).done;)i=i.value,u=n+KSe(i,s++),a+=Oee(i,e,r,u,o);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return a}function Cee(t,e,r){if(t==null)return t;var n=[],o=0;return Oee(t,n,"","",function(i){return e.call(r,i,o++)}),n}function bTr(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Np={current:null},Eee={transition:null},_Tr={ReactCurrentDispatcher:Np,ReactCurrentBatchConfig:Eee,ReactCurrentOwner:ZSe};eo.Children={map:Cee,forEach:function(t,e,r){Cee(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return Cee(t,function(){e++}),e},toArray:function(t){return Cee(t,function(e){return e})||[]},only:function(t){if(!YSe(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};eo.Component=XB;eo.Fragment=aTr;eo.Profiler=uTr;eo.PureComponent=GSe;eo.StrictMode=sTr;eo.Suspense=fTr;eo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_Tr;eo.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=Pet({},t.props),o=t.key,i=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,a=ZSe.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(u in e)Iet.call(e,u)&&!Met.hasOwnProperty(u)&&(n[u]=e[u]===void 0&&s!==void 0?s[u]:e[u])}var u=arguments.length-2;if(u===1)n.children=r;else if(1<u){s=Array(u);for(var l=0;l<u;l++)s[l]=arguments[l+2];n.children=s}return{$$typeof:g8,type:t.type,key:o,ref:i,props:n,_owner:a}};eo.createContext=function(t){return t={$$typeof:cTr,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:lTr,_context:t},t.Consumer=t};eo.createElement=Ret;eo.createFactory=function(t){var e=Ret.bind(null,t);return e.type=t,e};eo.createRef=function(){return{current:null}};eo.forwardRef=function(t){return{$$typeof:dTr,render:t}};eo.isValidElement=YSe;eo.lazy=function(t){return{$$typeof:mTr,_payload:{_status:-1,_result:t},_init:bTr}};eo.memo=function(t,e){return{$$typeof:pTr,type:t,compare:e===void 0?null:e}};eo.startTransition=function(t){var e=Eee.transition;Eee.transition={};try{t()}finally{Eee.transition=e}};eo.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};eo.useCallback=function(t,e){return Np.current.useCallback(t,e)};eo.useContext=function(t){return Np.current.useContext(t)};eo.useDebugValue=function(){};eo.useDeferredValue=function(t){return Np.current.useDeferredValue(t)};eo.useEffect=function(t,e){return Np.current.useEffect(t,e)};eo.useId=function(){return Np.current.useId()};eo.useImperativeHandle=function(t,e,r){return Np.current.useImperativeHandle(t,e,r)};eo.useInsertionEffect=function(t,e){return Np.current.useInsertionEffect(t,e)};eo.useLayoutEffect=function(t,e){return Np.current.useLayoutEffect(t,e)};eo.useMemo=function(t,e){return Np.current.useMemo(t,e)};eo.useReducer=function(t,e,r){return Np.current.useReducer(t,e,r)};eo.useRef=function(t){return Np.current.useRef(t)};eo.useState=function(t){return Np.current.useState(t)};eo.useSyncExternalStore=function(t,e,r){return Np.current.useSyncExternalStore(t,e,r)};eo.useTransition=function(){return Np.current.useTransition()};eo.version="18.2.0"});var Z=x((Dso,jet)=>{"use strict";jet.exports=Net()});function y8(t,e){let r=Let(e),[[n,o,i],a]=(0,Mf.useReducer)(l=>{let c=r.get(t);return Object.is(l[0],c)&&l[1]===r&&l[2]===t?l:[c,r,t]},void 0,()=>[r.get(t),r,t]),s=n;(o!==r||i!==t)&&(a(),s=r.get(t));let u=e?.delay;if((0,Mf.useEffect)(()=>{let l=r.sub(t,()=>{if(typeof u=="number"){let c=r.get(t);QSe(c)&&Fet(Det(c)),setTimeout(a,u);return}a()});return a(),l},[r,t,u]),(0,Mf.useDebugValue)(s),QSe(s)){let l=Det(s);return wTr(l)}return s}function xTr(t,e){let r=Let(e);return(0,Mf.useCallback)((...o)=>{if((Pee.env?Pee.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...o)},[r,t])}function QB(t,e){return[y8(t,e),xTr(t,e)]}var Mf,Pee,vTr,Let,QSe,Fet,wTr,XSe,Det,ket=b(()=>{"use client";Mf=j(Z(),1);WSe();Pee={},vTr=(0,Mf.createContext)(void 0),Let=t=>{let e=(0,Mf.useContext)(vTr);return t?.store||e||wet()},QSe=t=>typeof t?.then=="function",Fet=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},wTr=Mf.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(Fet(t),t)}),XSe=new WeakMap,Det=t=>{let e=XSe.get(t);return e||(e=new Promise((r,n)=>{let o=t,i=u=>l=>{o===u&&r(l)},a=u=>l=>{o===u&&n(l)},s=u=>{"onCancel"in u&&typeof u.onCancel=="function"&&u.onCancel(l=>{if((Pee.env?Pee.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");QSe(l)?(XSe.set(l,e),o=l,l.then(i(l),a(l)),s(l)):r(l)})};t.then(i(t),a(t)),s(t)}),XSe.set(t,e)),e}});var b8=b(()=>{WSe();ket()});var _8={};as(_8,{getModelKeyFromModel:()=>Qr,getSettings:()=>ne,getSystemPrompt:()=>Rf,resetSettings:()=>eCe,sanitizeQaExclusions:()=>Bet,sanitizeSettings:()=>tCe,setSettings:()=>AE,settingsAtom:()=>nI,settingsStore:()=>Gi,subscribeToSettingsChange:()=>oa,updateSetting:()=>Xe,useSettingsValue:()=>an});function AE(t){let e=STr({...ne(),...t});Gi.set(nI,e)}function Bet(t){let r=(typeof t=="string"?t:rCe).split(",").map(o=>decodeURIComponent(o.trim())).filter(o=>o.length>0),n=new Map;return r.forEach(o=>{let i=o.replace(/\/+$/,""),a=i.length>0?i:o;if(a===TE){n.set(TE,TE);return}if(!n.has(a)){let s=i.length>0&&o.endsWith("/")?`${i}/`:o;n.set(a,s)}}),n.set(TE,TE),Array.from(n.values()).map(o=>encodeURIComponent(o)).join(",")}function Xe(t,e){let r=ne();AE({...r,[t]:e})}function ne(){return Gi.get(nI)}function eCe(){let t={...za,activeModels:jv.map(e=>({...e,enabled:!0})),activeEmbeddingModels:Lj.map(e=>({...e,enabled:!0}))};AE(t)}function oa(t){let e=ne();return Gi.sub(nI,()=>{let r=ne();t(e,r),e=r})}function an(){return y8(nI,{store:Gi})}function tCe(t){let e=t||za;e.userId||(e.userId=mm()),e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(f=>({...f,provider:f.provider==="azure_openai"?"azure openai":f.provider})):e.activeEmbeddingModels=Lj.map(f=>({...f,enabled:!0}));let r={...e},n=Number(e.temperature);r.temperature=isNaN(n)?za.temperature:n;let o=Number(e.maxTokens);r.maxTokens=isNaN(o)?za.maxTokens:o;let i=Number(e.contextTurns);r.contextTurns=isNaN(i)?za.contextTurns:i;let a=Number(e.embeddingRequestsPerMin);r.embeddingRequestsPerMin=isNaN(a)?za.embeddingRequestsPerMin:a;let s=Number(e.embeddingBatchSize);r.embeddingBatchSize=isNaN(s)?za.embeddingBatchSize:s;let u=Number(e.lexicalSearchRamLimit);isNaN(u)?r.lexicalSearchRamLimit=za.lexicalSearchRamLimit:r.lexicalSearchRamLimit=Math.min(1e3,Math.max(20,u)),typeof r.includeActiveNoteAsContext!="boolean"&&(r.includeActiveNoteAsContext=za.includeActiveNoteAsContext),typeof r.generateAIChatTitleOnSave!="boolean"&&(r.generateAIChatTitleOnSave=za.generateAIChatTitleOnSave),typeof r.passMarkdownImages!="boolean"&&(r.passMarkdownImages=za.passMarkdownImages),typeof r.enableInlineCitations!="boolean"&&(r.enableInlineCitations=za.enableInlineCitations),typeof r.enableCustomPromptTemplating!="boolean"&&(r.enableCustomPromptTemplating=za.enableCustomPromptTemplating),typeof r.allowAdditionalContext!="boolean"&&(r.allowAdditionalContext=za.allowAdditionalContext),typeof r.enableWordCompletion!="boolean"&&(r.enableWordCompletion=za.enableWordCompletion);let l=Number(e.autonomousAgentMaxIterations);isNaN(l)||l<4||l>8?r.autonomousAgentMaxIterations=za.autonomousAgentMaxIterations:r.autonomousAgentMaxIterations=l,Array.isArray(r.autonomousAgentEnabledToolIds)||(r.autonomousAgentEnabledToolIds=za.autonomousAgentEnabledToolIds);let c=(e.defaultSaveFolder||"").trim();r.defaultSaveFolder=c.length>0?c:za.defaultSaveFolder;let d=(e.customPromptsFolder||"").trim();return r.customPromptsFolder=d.length>0?d:za.customPromptsFolder,r.qaExclusions=Bet(e.qaExclusions),r}function Rf(){let t=ne().userSystemPrompt,e=zet;return t?`${e}
<user_custom_instructions>
${t}
</user_custom_instructions>`:e}function STr(t){return t.activeModels=$et(t.activeModels,jv),t.activeEmbeddingModels=$et(t.activeEmbeddingModels,Lj),t}function Qr(t){return`${t.name}|${t.provider}`}function $et(t,e){let r=new Map;return e.filter(n=>n.core).forEach(n=>{r.set(Qr(n),{...n})}),t.forEach(n=>{let o=Qr(n),i=r.get(o);if(i){let a=e.find(s=>s.name===n.name&&s.provider===n.provider);a?r.set(o,{...a,...n,isBuiltIn:!0,believerExclusive:a.believerExclusive}):r.set(o,{...n,isBuiltIn:i.isBuiltIn})}else r.set(o,n)}),Array.from(r.values())}var Gi,nI,_t=b(()=>{b8();ZN();er();Gi=YB(),nI=Lh(za)});function Fn(t,e=!1){try{if(t instanceof Error){let n=t?.cause instanceof Error?t.cause.message:t?.cause?String(t.cause):"",o=e&&t.stack?t.stack:"",i=[t.message];return n&&i.push(`more message: ${n}`),o&&i.push(o),i.join(`
`)}return JSON.stringify(t)??String(t)}catch{return String(t)}}var nCe=b(()=>{});var oCe,Nf,ez=b(()=>{nCe();kt();oCe=class t{constructor(){this.maxLines=500;this.maxLineChars=8e3;this.buffer=[];this.initialized=!1;this.flushing=!1}static getInstance(){return t.instance||(t.instance=new t),t.instance}getLogPath(){return"copilot/copilot-log.md"}async ensureInitialized(){if(!this.initialized)try{if(!this.hasVault()){this.initialized=!0;return}let e=this.getLogPath();if(await app.vault.adapter.exists(e)){let o=(await app.vault.adapter.read(e)).split(/\r?\n/).filter(i=>i.length>0);o.length>this.maxLines?this.buffer=o.slice(o.length-this.maxLines):this.buffer=o}}catch{this.buffer=[]}finally{this.initialized=!0}}hasVault(){try{return typeof app<"u"&&!!app.vault?.adapter}catch{return!1}}sanitizeForSingleLine(e){if(e instanceof Error){let r=Fn(e,!0);return this.escapeAngleBrackets(this.collapseToSingleLine(r))}if(typeof e=="string")return this.escapeAngleBrackets(this.collapseToSingleLine(e));try{let r=JSON.stringify(e);return this.escapeAngleBrackets(this.collapseToSingleLine(r??String(e)))}catch{return this.escapeAngleBrackets(this.collapseToSingleLine(String(e)))}}collapseToSingleLine(e){let r=e.replace(/[\r\n]+/g,"\\n").replace(/\t/g," ");return r.length<=this.maxLineChars?r:r.slice(0,this.maxLineChars)+` \u2026 [truncated ${r.length-this.maxLineChars} chars]`}async append(e,...r){await this.ensureInitialized();let n=new Date().toISOString(),o=r.map(a=>this.sanitizeForSingleLine(a)),i=`${n} ${e} ${o.join(" ")}`.trim();this.buffer.push(i),this.buffer.length>this.maxLines&&this.buffer.splice(0,this.buffer.length-this.maxLines)}escapeAngleBrackets(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;")}async appendMarkdownBlock(e){if(await this.ensureInitialized(),!(!Array.isArray(e)||e.length===0))for(let r of e){let n=typeof r=="string"?r:String(r??"");this.buffer.push(n),this.buffer.length>this.maxLines&&this.buffer.splice(0,this.buffer.length-this.maxLines)}}async flush(){if(this.hasVault()&&!this.flushing){this.flushing=!0;try{let e=this.getLogPath();if(await app.vault.adapter.exists(e)){let r=this.buffer.join(`
`)+(this.buffer.length?`
`:"");await app.vault.adapter.write(e,r)}}catch{}finally{this.flushing=!1}}}async clear(){if(this.buffer=[],!!this.hasVault())try{let e=this.getLogPath();await app.vault.adapter.exists(e)&&await app.vault.adapter.remove(e)}catch{}}async openLogFile(){if(await this.flush(),!this.hasVault())return;let e=this.getLogPath(),r=app.vault.getAbstractFileByPath(e);try{if(!r){let o=e.includes("/")?e.split("/").slice(0,-1).join("/"):"";o&&await Mm(o),r=await app.vault.create(e,this.buffer.join(`
`)+(this.buffer.length?`
`:""))}await app.workspace.getLeaf(!0).openFile(r)}catch{}}},Nf=oCe.getInstance()});function B(...t){ne().debug&&console.log(...t),Nf.append("INFO",...t)}function ie(...t){ne().debug&&console.error(...t),Nf.append("ERROR",...t)}function Ft(...t){ne().debug&&console.warn(...t),Nf.append("WARN",...t)}function Uet(t){Nf.appendMarkdownBlock(t)}function qet(t,e){if(ne().debug)try{if(typeof console.table=="function"){Array.isArray(e)&&e.length>0?console.table(t,e):console.table(t);return}}catch{}B("Table:",JSON.stringify(t))}var $t=b(()=>{_t();ez()});var Het=x((iCe,tz)=>{(function(t,e){typeof iCe=="object"&&typeof tz<"u"?tz.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(iCe,function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(v){t=v}function n(v){return v instanceof Array||Object.prototype.toString.call(v)==="[object Array]"}function o(v){return v!=null&&Object.prototype.toString.call(v)==="[object Object]"}function i(v,O){return Object.prototype.hasOwnProperty.call(v,O)}function a(v){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(v).length===0;var O;for(O in v)if(i(v,O))return!1;return!0}function s(v){return v===void 0}function u(v){return typeof v=="number"||Object.prototype.toString.call(v)==="[object Number]"}function l(v){return v instanceof Date||Object.prototype.toString.call(v)==="[object Date]"}function c(v,O){var A=[],R,$=v.length;for(R=0;R<$;++R)A.push(O(v[R],R));return A}function d(v,O){for(var A in O)i(O,A)&&(v[A]=O[A]);return i(O,"toString")&&(v.toString=O.toString),i(O,"valueOf")&&(v.valueOf=O.valueOf),v}function f(v,O,A,R){return hGe(v,O,A,R,!0).utc()}function p(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function m(v){return v._pf==null&&(v._pf=p()),v._pf}var h;Array.prototype.some?h=Array.prototype.some:h=function(v){var O=Object(this),A=O.length>>>0,R;for(R=0;R<A;R++)if(R in O&&v.call(this,O[R],R,O))return!0;return!1};function y(v){if(v._isValid==null){var O=m(v),A=h.call(O.parsedDateParts,function($){return $!=null}),R=!isNaN(v._d.getTime())&&O.overflow<0&&!O.empty&&!O.invalidEra&&!O.invalidMonth&&!O.invalidWeekday&&!O.weekdayMismatch&&!O.nullInput&&!O.invalidFormat&&!O.userInvalidated&&(!O.meridiem||O.meridiem&&A);if(v._strict&&(R=R&&O.charsLeftOver===0&&O.unusedTokens.length===0&&O.bigHour===void 0),Object.isFrozen==null||!Object.isFrozen(v))v._isValid=R;else return R}return v._isValid}function g(v){var O=f(NaN);return v!=null?d(m(O),v):m(O).userInvalidated=!0,O}var _=e.momentProperties=[],w=!1;function S(v,O){var A,R,$,te=_.length;if(s(O._isAMomentObject)||(v._isAMomentObject=O._isAMomentObject),s(O._i)||(v._i=O._i),s(O._f)||(v._f=O._f),s(O._l)||(v._l=O._l),s(O._strict)||(v._strict=O._strict),s(O._tzm)||(v._tzm=O._tzm),s(O._isUTC)||(v._isUTC=O._isUTC),s(O._offset)||(v._offset=O._offset),s(O._pf)||(v._pf=m(O)),s(O._locale)||(v._locale=O._locale),te>0)for(A=0;A<te;A++)R=_[A],$=O[R],s($)||(v[R]=$);return v}function C(v){S(this,v),this._d=new Date(v._d!=null?v._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),w===!1&&(w=!0,e.updateOffset(this),w=!1)}function E(v){return v instanceof C||v!=null&&v._isAMomentObject!=null}function P(v){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+v)}function T(v,O){var A=!0;return d(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,v),A){var R=[],$,te,xe,lr=arguments.length;for(te=0;te<lr;te++){if($="",typeof arguments[te]=="object"){$+=`
[`+te+"] ";for(xe in arguments[0])i(arguments[0],xe)&&($+=xe+": "+arguments[0][xe]+", ");$=$.slice(0,-2)}else $=arguments[te];R.push($)}P(v+`
Arguments: `+Array.prototype.slice.call(R).join("")+`
`+new Error().stack),A=!1}return O.apply(this,arguments)},O)}var I={};function N(v,O){e.deprecationHandler!=null&&e.deprecationHandler(v,O),I[v]||(P(O),I[v]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function M(v){return typeof Function<"u"&&v instanceof Function||Object.prototype.toString.call(v)==="[object Function]"}function D(v){var O,A;for(A in v)i(v,A)&&(O=v[A],M(O)?this[A]=O:this["_"+A]=O);this._config=v,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function k(v,O){var A=d({},v),R;for(R in O)i(O,R)&&(o(v[R])&&o(O[R])?(A[R]={},d(A[R],v[R]),d(A[R],O[R])):O[R]!=null?A[R]=O[R]:delete A[R]);for(R in v)i(v,R)&&!i(O,R)&&o(v[R])&&(A[R]=d({},A[R]));return A}function L(v){v!=null&&this.set(v)}var H;Object.keys?H=Object.keys:H=function(v){var O,A=[];for(O in v)i(v,O)&&A.push(O);return A};var K={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function G(v,O,A){var R=this._calendar[v]||this._calendar.sameElse;return M(R)?R.call(O,A):R}function X(v,O,A){var R=""+Math.abs(v),$=O-R.length,te=v>=0;return(te?A?"+":"":"-")+Math.pow(10,Math.max(0,$)).toString().substr(1)+R}var F=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Q=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,ee={},U={};function z(v,O,A,R){var $=R;typeof R=="string"&&($=function(){return this[R]()}),v&&(U[v]=$),O&&(U[O[0]]=function(){return X($.apply(this,arguments),O[1],O[2])}),A&&(U[A]=function(){return this.localeData().ordinal($.apply(this,arguments),v)})}function V(v){return v.match(/\[[\s\S]/)?v.replace(/^\[|\]$/g,""):v.replace(/\\/g,"")}function q(v){var O=v.match(F),A,R;for(A=0,R=O.length;A<R;A++)U[O[A]]?O[A]=U[O[A]]:O[A]=V(O[A]);return function($){var te="",xe;for(xe=0;xe<R;xe++)te+=M(O[xe])?O[xe].call($,v):O[xe];return te}}function W(v,O){return v.isValid()?(O=J(O,v.localeData()),ee[O]=ee[O]||q(O),ee[O](v)):v.localeData().invalidDate()}function J(v,O){var A=5;function R($){return O.longDateFormat($)||$}for(Q.lastIndex=0;A>=0&&Q.test(v);)v=v.replace(Q,R),Q.lastIndex=0,A-=1;return v}var se={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function be(v){var O=this._longDateFormat[v],A=this._longDateFormat[v.toUpperCase()];return O||!A?O:(this._longDateFormat[v]=A.match(F).map(function(R){return R==="MMMM"||R==="MM"||R==="DD"||R==="dddd"?R.slice(1):R}).join(""),this._longDateFormat[v])}var ce="Invalid date";function pe(){return this._invalidDate}var Me="%d",Ue=/\d{1,2}/;function Et(v){return this._ordinal.replace("%d",v)}var pr={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function $r(v,O,A,R){var $=this._relativeTime[A];return M($)?$(v,O,A,R):$.replace(/%d/i,v)}function On(v,O){var A=this._relativeTime[v>0?"future":"past"];return M(A)?A(O):A.replace(/%s/i,O)}var Br={};function Tr(v,O){var A=v.toLowerCase();Br[A]=Br[A+"s"]=Br[O]=v}function Ie(v){return typeof v=="string"?Br[v]||Br[v.toLowerCase()]:void 0}function Ge(v){var O={},A,R;for(R in v)i(v,R)&&(A=Ie(R),A&&(O[A]=v[R]));return O}var Ne={};function le(v,O){Ne[v]=O}function oe(v){var O=[],A;for(A in v)i(v,A)&&O.push({unit:A,priority:Ne[A]});return O.sort(function(R,$){return R.priority-$.priority}),O}function fe(v){return v%4===0&&v%100!==0||v%400===0}function _e(v){return v<0?Math.ceil(v)||0:Math.floor(v)}function ge(v){var O=+v,A=0;return O!==0&&isFinite(O)&&(A=_e(O)),A}function Le(v,O){return function(A){return A!=null?(Ii(this,v,A),e.updateOffset(this,O),this):dr(this,v)}}function dr(v,O){return v.isValid()?v._d["get"+(v._isUTC?"UTC":"")+O]():NaN}function Ii(v,O,A){v.isValid()&&!isNaN(A)&&(O==="FullYear"&&fe(v.year())&&v.month()===1&&v.date()===29?(A=ge(A),v._d["set"+(v._isUTC?"UTC":"")+O](A,v.month(),SX(A,v.month()))):v._d["set"+(v._isUTC?"UTC":"")+O](A))}function bi(v){return v=Ie(v),M(this[v])?this[v]():this}function _f(v,O){if(typeof v=="object"){v=Ge(v);var A=oe(v),R,$=A.length;for(R=0;R<$;R++)this[A[R].unit](v[A[R].unit])}else if(v=Ie(v),M(this[v]))return this[v](O);return this}var yp=/\d/,Vi=/\d\d/,gd=/\d{3}/,yd=/\d{4}/,vf=/[+-]?\d{6}/,Wn=/\d\d?/,MA=/\d\d\d\d?/,WN=/\d\d\d\d\d\d?/,RA=/\d{1,3}/,Ms=/\d{1,4}/,bu=/[+-]?\d{1,6}/,is=/\d+/,bp=/[+-]?\d+/,wf=/Z|[+-]\d\d:?\d\d/gi,Zs=/Z|[+-]\d\d(?::?\d\d)?/gi,pm=/[+-]?\d+(\.\d{1,3})?/,_p=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Qn;Qn={};function Ye(v,O,A){Qn[v]=M(O)?O:function(R,$){return R&&A?A:O}}function vp(v,O){return i(Qn,v)?Qn[v](O._strict,O._locale):new RegExp(Th(v))}function Th(v){return oc(v.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(O,A,R,$,te){return A||R||$||te}))}function oc(v){return v.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var oE={};function Kn(v,O){var A,R=O,$;for(typeof v=="string"&&(v=[v]),u(O)&&(R=function(te,xe){xe[O]=ge(te)}),$=v.length,A=0;A<$;A++)oE[v[A]]=R}function Ab(v,O){Kn(v,function(A,R,$,te){$._w=$._w||{},O(A,$._w,$,te)})}function s6(v,O,A){O!=null&&i(oE,v)&&oE[v](O,A._a,A,v)}var xf=0,iE=1,vv=2,ic=3,Ib=4,aE=5,KN=6,Jyr=7,Zyr=8;function Yyr(v,O){return(v%O+O)%O}var Ys;Array.prototype.indexOf?Ys=Array.prototype.indexOf:Ys=function(v){var O;for(O=0;O<this.length;++O)if(this[O]===v)return O;return-1};function SX(v,O){if(isNaN(v)||isNaN(O))return NaN;var A=Yyr(O,12);return v+=(O-A)/12,A===1?fe(v)?29:28:31-A%7%2}z("M",["MM",2],"Mo",function(){return this.month()+1}),z("MMM",0,0,function(v){return this.localeData().monthsShort(this,v)}),z("MMMM",0,0,function(v){return this.localeData().months(this,v)}),Tr("month","M"),le("month",8),Ye("M",Wn),Ye("MM",Wn,Vi),Ye("MMM",function(v,O){return O.monthsShortRegex(v)}),Ye("MMMM",function(v,O){return O.monthsRegex(v)}),Kn(["M","MM"],function(v,O){O[iE]=ge(v)-1}),Kn(["MMM","MMMM"],function(v,O,A,R){var $=A._locale.monthsParse(v,R,A._strict);$!=null?O[iE]=$:m(A).invalidMonth=v});var Xyr="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),eGe="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),tGe=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Qyr=_p,ebr=_p;function tbr(v,O){return v?n(this._months)?this._months[v.month()]:this._months[(this._months.isFormat||tGe).test(O)?"format":"standalone"][v.month()]:n(this._months)?this._months:this._months.standalone}function rbr(v,O){return v?n(this._monthsShort)?this._monthsShort[v.month()]:this._monthsShort[tGe.test(O)?"format":"standalone"][v.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function nbr(v,O,A){var R,$,te,xe=v.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],R=0;R<12;++R)te=f([2e3,R]),this._shortMonthsParse[R]=this.monthsShort(te,"").toLocaleLowerCase(),this._longMonthsParse[R]=this.months(te,"").toLocaleLowerCase();return A?O==="MMM"?($=Ys.call(this._shortMonthsParse,xe),$!==-1?$:null):($=Ys.call(this._longMonthsParse,xe),$!==-1?$:null):O==="MMM"?($=Ys.call(this._shortMonthsParse,xe),$!==-1?$:($=Ys.call(this._longMonthsParse,xe),$!==-1?$:null)):($=Ys.call(this._longMonthsParse,xe),$!==-1?$:($=Ys.call(this._shortMonthsParse,xe),$!==-1?$:null))}function obr(v,O,A){var R,$,te;if(this._monthsParseExact)return nbr.call(this,v,O,A);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),R=0;R<12;R++){if($=f([2e3,R]),A&&!this._longMonthsParse[R]&&(this._longMonthsParse[R]=new RegExp("^"+this.months($,"").replace(".","")+"$","i"),this._shortMonthsParse[R]=new RegExp("^"+this.monthsShort($,"").replace(".","")+"$","i")),!A&&!this._monthsParse[R]&&(te="^"+this.months($,"")+"|^"+this.monthsShort($,""),this._monthsParse[R]=new RegExp(te.replace(".",""),"i")),A&&O==="MMMM"&&this._longMonthsParse[R].test(v))return R;if(A&&O==="MMM"&&this._shortMonthsParse[R].test(v))return R;if(!A&&this._monthsParse[R].test(v))return R}}function rGe(v,O){var A;if(!v.isValid())return v;if(typeof O=="string"){if(/^\d+$/.test(O))O=ge(O);else if(O=v.localeData().monthsParse(O),!u(O))return v}return A=Math.min(v.date(),SX(v.year(),O)),v._d["set"+(v._isUTC?"UTC":"")+"Month"](O,A),v}function nGe(v){return v!=null?(rGe(this,v),e.updateOffset(this,!0),this):dr(this,"Month")}function ibr(){return SX(this.year(),this.month())}function abr(v){return this._monthsParseExact?(i(this,"_monthsRegex")||oGe.call(this),v?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=Qyr),this._monthsShortStrictRegex&&v?this._monthsShortStrictRegex:this._monthsShortRegex)}function sbr(v){return this._monthsParseExact?(i(this,"_monthsRegex")||oGe.call(this),v?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=ebr),this._monthsStrictRegex&&v?this._monthsStrictRegex:this._monthsRegex)}function oGe(){function v(xe,lr){return lr.length-xe.length}var O=[],A=[],R=[],$,te;for($=0;$<12;$++)te=f([2e3,$]),O.push(this.monthsShort(te,"")),A.push(this.months(te,"")),R.push(this.months(te,"")),R.push(this.monthsShort(te,""));for(O.sort(v),A.sort(v),R.sort(v),$=0;$<12;$++)O[$]=oc(O[$]),A[$]=oc(A[$]);for($=0;$<24;$++)R[$]=oc(R[$]);this._monthsRegex=new RegExp("^("+R.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+A.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+O.join("|")+")","i")}z("Y",0,0,function(){var v=this.year();return v<=9999?X(v,4):"+"+v}),z(0,["YY",2],0,function(){return this.year()%100}),z(0,["YYYY",4],0,"year"),z(0,["YYYYY",5],0,"year"),z(0,["YYYYYY",6,!0],0,"year"),Tr("year","y"),le("year",1),Ye("Y",bp),Ye("YY",Wn,Vi),Ye("YYYY",Ms,yd),Ye("YYYYY",bu,vf),Ye("YYYYYY",bu,vf),Kn(["YYYYY","YYYYYY"],xf),Kn("YYYY",function(v,O){O[xf]=v.length===2?e.parseTwoDigitYear(v):ge(v)}),Kn("YY",function(v,O){O[xf]=e.parseTwoDigitYear(v)}),Kn("Y",function(v,O){O[xf]=parseInt(v,10)});function u6(v){return fe(v)?366:365}e.parseTwoDigitYear=function(v){return ge(v)+(ge(v)>68?1900:2e3)};var iGe=Le("FullYear",!0);function ubr(){return fe(this.year())}function lbr(v,O,A,R,$,te,xe){var lr;return v<100&&v>=0?(lr=new Date(v+400,O,A,R,$,te,xe),isFinite(lr.getFullYear())&&lr.setFullYear(v)):lr=new Date(v,O,A,R,$,te,xe),lr}function l6(v){var O,A;return v<100&&v>=0?(A=Array.prototype.slice.call(arguments),A[0]=v+400,O=new Date(Date.UTC.apply(null,A)),isFinite(O.getUTCFullYear())&&O.setUTCFullYear(v)):O=new Date(Date.UTC.apply(null,arguments)),O}function CX(v,O,A){var R=7+O-A,$=(7+l6(v,0,R).getUTCDay()-O)%7;return-$+R-1}function aGe(v,O,A,R,$){var te=(7+A-R)%7,xe=CX(v,R,$),lr=1+7*(O-1)+te+xe,En,Wi;return lr<=0?(En=v-1,Wi=u6(En)+lr):lr>u6(v)?(En=v+1,Wi=lr-u6(v)):(En=v,Wi=lr),{year:En,dayOfYear:Wi}}function c6(v,O,A){var R=CX(v.year(),O,A),$=Math.floor((v.dayOfYear()-R-1)/7)+1,te,xe;return $<1?(xe=v.year()-1,te=$+sE(xe,O,A)):$>sE(v.year(),O,A)?(te=$-sE(v.year(),O,A),xe=v.year()+1):(xe=v.year(),te=$),{week:te,year:xe}}function sE(v,O,A){var R=CX(v,O,A),$=CX(v+1,O,A);return(u6(v)-R+$)/7}z("w",["ww",2],"wo","week"),z("W",["WW",2],"Wo","isoWeek"),Tr("week","w"),Tr("isoWeek","W"),le("week",5),le("isoWeek",5),Ye("w",Wn),Ye("ww",Wn,Vi),Ye("W",Wn),Ye("WW",Wn,Vi),Ab(["w","ww","W","WW"],function(v,O,A,R){O[R.substr(0,1)]=ge(v)});function cbr(v){return c6(v,this._week.dow,this._week.doy).week}var dbr={dow:0,doy:6};function fbr(){return this._week.dow}function pbr(){return this._week.doy}function mbr(v){var O=this.localeData().week(this);return v==null?O:this.add((v-O)*7,"d")}function hbr(v){var O=c6(this,1,4).week;return v==null?O:this.add((v-O)*7,"d")}z("d",0,"do","day"),z("dd",0,0,function(v){return this.localeData().weekdaysMin(this,v)}),z("ddd",0,0,function(v){return this.localeData().weekdaysShort(this,v)}),z("dddd",0,0,function(v){return this.localeData().weekdays(this,v)}),z("e",0,0,"weekday"),z("E",0,0,"isoWeekday"),Tr("day","d"),Tr("weekday","e"),Tr("isoWeekday","E"),le("day",11),le("weekday",11),le("isoWeekday",11),Ye("d",Wn),Ye("e",Wn),Ye("E",Wn),Ye("dd",function(v,O){return O.weekdaysMinRegex(v)}),Ye("ddd",function(v,O){return O.weekdaysShortRegex(v)}),Ye("dddd",function(v,O){return O.weekdaysRegex(v)}),Ab(["dd","ddd","dddd"],function(v,O,A,R){var $=A._locale.weekdaysParse(v,R,A._strict);$!=null?O.d=$:m(A).invalidWeekday=v}),Ab(["d","e","E"],function(v,O,A,R){O[R]=ge(v)});function gbr(v,O){return typeof v!="string"?v:isNaN(v)?(v=O.weekdaysParse(v),typeof v=="number"?v:null):parseInt(v,10)}function ybr(v,O){return typeof v=="string"?O.weekdaysParse(v)%7||7:isNaN(v)?null:v}function mwe(v,O){return v.slice(O,7).concat(v.slice(0,O))}var bbr="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),sGe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),_br="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),vbr=_p,wbr=_p,xbr=_p;function Sbr(v,O){var A=n(this._weekdays)?this._weekdays:this._weekdays[v&&v!==!0&&this._weekdays.isFormat.test(O)?"format":"standalone"];return v===!0?mwe(A,this._week.dow):v?A[v.day()]:A}function Cbr(v){return v===!0?mwe(this._weekdaysShort,this._week.dow):v?this._weekdaysShort[v.day()]:this._weekdaysShort}function Obr(v){return v===!0?mwe(this._weekdaysMin,this._week.dow):v?this._weekdaysMin[v.day()]:this._weekdaysMin}function Ebr(v,O,A){var R,$,te,xe=v.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],R=0;R<7;++R)te=f([2e3,1]).day(R),this._minWeekdaysParse[R]=this.weekdaysMin(te,"").toLocaleLowerCase(),this._shortWeekdaysParse[R]=this.weekdaysShort(te,"").toLocaleLowerCase(),this._weekdaysParse[R]=this.weekdays(te,"").toLocaleLowerCase();return A?O==="dddd"?($=Ys.call(this._weekdaysParse,xe),$!==-1?$:null):O==="ddd"?($=Ys.call(this._shortWeekdaysParse,xe),$!==-1?$:null):($=Ys.call(this._minWeekdaysParse,xe),$!==-1?$:null):O==="dddd"?($=Ys.call(this._weekdaysParse,xe),$!==-1||($=Ys.call(this._shortWeekdaysParse,xe),$!==-1)?$:($=Ys.call(this._minWeekdaysParse,xe),$!==-1?$:null)):O==="ddd"?($=Ys.call(this._shortWeekdaysParse,xe),$!==-1||($=Ys.call(this._weekdaysParse,xe),$!==-1)?$:($=Ys.call(this._minWeekdaysParse,xe),$!==-1?$:null)):($=Ys.call(this._minWeekdaysParse,xe),$!==-1||($=Ys.call(this._weekdaysParse,xe),$!==-1)?$:($=Ys.call(this._shortWeekdaysParse,xe),$!==-1?$:null))}function Pbr(v,O,A){var R,$,te;if(this._weekdaysParseExact)return Ebr.call(this,v,O,A);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),R=0;R<7;R++){if($=f([2e3,1]).day(R),A&&!this._fullWeekdaysParse[R]&&(this._fullWeekdaysParse[R]=new RegExp("^"+this.weekdays($,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[R]=new RegExp("^"+this.weekdaysShort($,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[R]=new RegExp("^"+this.weekdaysMin($,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[R]||(te="^"+this.weekdays($,"")+"|^"+this.weekdaysShort($,"")+"|^"+this.weekdaysMin($,""),this._weekdaysParse[R]=new RegExp(te.replace(".",""),"i")),A&&O==="dddd"&&this._fullWeekdaysParse[R].test(v))return R;if(A&&O==="ddd"&&this._shortWeekdaysParse[R].test(v))return R;if(A&&O==="dd"&&this._minWeekdaysParse[R].test(v))return R;if(!A&&this._weekdaysParse[R].test(v))return R}}function Tbr(v){if(!this.isValid())return v!=null?this:NaN;var O=this._isUTC?this._d.getUTCDay():this._d.getDay();return v!=null?(v=gbr(v,this.localeData()),this.add(v-O,"d")):O}function Abr(v){if(!this.isValid())return v!=null?this:NaN;var O=(this.day()+7-this.localeData()._week.dow)%7;return v==null?O:this.add(v-O,"d")}function Ibr(v){if(!this.isValid())return v!=null?this:NaN;if(v!=null){var O=ybr(v,this.localeData());return this.day(this.day()%7?O:O-7)}else return this.day()||7}function Mbr(v){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||hwe.call(this),v?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=vbr),this._weekdaysStrictRegex&&v?this._weekdaysStrictRegex:this._weekdaysRegex)}function Rbr(v){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||hwe.call(this),v?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=wbr),this._weekdaysShortStrictRegex&&v?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Nbr(v){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||hwe.call(this),v?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=xbr),this._weekdaysMinStrictRegex&&v?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function hwe(){function v(wp,fE){return fE.length-wp.length}var O=[],A=[],R=[],$=[],te,xe,lr,En,Wi;for(te=0;te<7;te++)xe=f([2e3,1]).day(te),lr=oc(this.weekdaysMin(xe,"")),En=oc(this.weekdaysShort(xe,"")),Wi=oc(this.weekdays(xe,"")),O.push(lr),A.push(En),R.push(Wi),$.push(lr),$.push(En),$.push(Wi);O.sort(v),A.sort(v),R.sort(v),$.sort(v),this._weekdaysRegex=new RegExp("^("+$.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+R.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+A.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+O.join("|")+")","i")}function gwe(){return this.hours()%12||12}function jbr(){return this.hours()||24}z("H",["HH",2],0,"hour"),z("h",["hh",2],0,gwe),z("k",["kk",2],0,jbr),z("hmm",0,0,function(){return""+gwe.apply(this)+X(this.minutes(),2)}),z("hmmss",0,0,function(){return""+gwe.apply(this)+X(this.minutes(),2)+X(this.seconds(),2)}),z("Hmm",0,0,function(){return""+this.hours()+X(this.minutes(),2)}),z("Hmmss",0,0,function(){return""+this.hours()+X(this.minutes(),2)+X(this.seconds(),2)});function uGe(v,O){z(v,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),O)})}uGe("a",!0),uGe("A",!1),Tr("hour","h"),le("hour",13);function lGe(v,O){return O._meridiemParse}Ye("a",lGe),Ye("A",lGe),Ye("H",Wn),Ye("h",Wn),Ye("k",Wn),Ye("HH",Wn,Vi),Ye("hh",Wn,Vi),Ye("kk",Wn,Vi),Ye("hmm",MA),Ye("hmmss",WN),Ye("Hmm",MA),Ye("Hmmss",WN),Kn(["H","HH"],ic),Kn(["k","kk"],function(v,O,A){var R=ge(v);O[ic]=R===24?0:R}),Kn(["a","A"],function(v,O,A){A._isPm=A._locale.isPM(v),A._meridiem=v}),Kn(["h","hh"],function(v,O,A){O[ic]=ge(v),m(A).bigHour=!0}),Kn("hmm",function(v,O,A){var R=v.length-2;O[ic]=ge(v.substr(0,R)),O[Ib]=ge(v.substr(R)),m(A).bigHour=!0}),Kn("hmmss",function(v,O,A){var R=v.length-4,$=v.length-2;O[ic]=ge(v.substr(0,R)),O[Ib]=ge(v.substr(R,2)),O[aE]=ge(v.substr($)),m(A).bigHour=!0}),Kn("Hmm",function(v,O,A){var R=v.length-2;O[ic]=ge(v.substr(0,R)),O[Ib]=ge(v.substr(R))}),Kn("Hmmss",function(v,O,A){var R=v.length-4,$=v.length-2;O[ic]=ge(v.substr(0,R)),O[Ib]=ge(v.substr(R,2)),O[aE]=ge(v.substr($))});function Dbr(v){return(v+"").toLowerCase().charAt(0)==="p"}var Lbr=/[ap]\.?m?\.?/i,Fbr=Le("Hours",!0);function kbr(v,O,A){return v>11?A?"pm":"PM":A?"am":"AM"}var cGe={calendar:K,longDateFormat:se,invalidDate:ce,ordinal:Me,dayOfMonthOrdinalParse:Ue,relativeTime:pr,months:Xyr,monthsShort:eGe,week:dbr,weekdays:bbr,weekdaysMin:_br,weekdaysShort:sGe,meridiemParse:Lbr},$a={},d6={},f6;function $br(v,O){var A,R=Math.min(v.length,O.length);for(A=0;A<R;A+=1)if(v[A]!==O[A])return A;return R}function dGe(v){return v&&v.toLowerCase().replace("_","-")}function Bbr(v){for(var O=0,A,R,$,te;O<v.length;){for(te=dGe(v[O]).split("-"),A=te.length,R=dGe(v[O+1]),R=R?R.split("-"):null;A>0;){if($=OX(te.slice(0,A).join("-")),$)return $;if(R&&R.length>=A&&$br(te,R)>=A-1)break;A--}O++}return f6}function zbr(v){return v.match("^[^/\\\\]*$")!=null}function OX(v){var O=null,A;if($a[v]===void 0&&typeof tz<"u"&&tz&&tz.exports&&zbr(v))try{O=f6._abbr,A=require,A("./locale/"+v),NA(O)}catch{$a[v]=null}return $a[v]}function NA(v,O){var A;return v&&(s(O)?A=uE(v):A=ywe(v,O),A?f6=A:typeof console<"u"&&console.warn&&console.warn("Locale "+v+" not found. Did you forget to load it?")),f6._abbr}function ywe(v,O){if(O!==null){var A,R=cGe;if(O.abbr=v,$a[v]!=null)N("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),R=$a[v]._config;else if(O.parentLocale!=null)if($a[O.parentLocale]!=null)R=$a[O.parentLocale]._config;else if(A=OX(O.parentLocale),A!=null)R=A._config;else return d6[O.parentLocale]||(d6[O.parentLocale]=[]),d6[O.parentLocale].push({name:v,config:O}),null;return $a[v]=new L(k(R,O)),d6[v]&&d6[v].forEach(function($){ywe($.name,$.config)}),NA(v),$a[v]}else return delete $a[v],null}function Ubr(v,O){if(O!=null){var A,R,$=cGe;$a[v]!=null&&$a[v].parentLocale!=null?$a[v].set(k($a[v]._config,O)):(R=OX(v),R!=null&&($=R._config),O=k($,O),R==null&&(O.abbr=v),A=new L(O),A.parentLocale=$a[v],$a[v]=A),NA(v)}else $a[v]!=null&&($a[v].parentLocale!=null?($a[v]=$a[v].parentLocale,v===NA()&&NA(v)):$a[v]!=null&&delete $a[v]);return $a[v]}function uE(v){var O;if(v&&v._locale&&v._locale._abbr&&(v=v._locale._abbr),!v)return f6;if(!n(v)){if(O=OX(v),O)return O;v=[v]}return Bbr(v)}function qbr(){return H($a)}function bwe(v){var O,A=v._a;return A&&m(v).overflow===-2&&(O=A[iE]<0||A[iE]>11?iE:A[vv]<1||A[vv]>SX(A[xf],A[iE])?vv:A[ic]<0||A[ic]>24||A[ic]===24&&(A[Ib]!==0||A[aE]!==0||A[KN]!==0)?ic:A[Ib]<0||A[Ib]>59?Ib:A[aE]<0||A[aE]>59?aE:A[KN]<0||A[KN]>999?KN:-1,m(v)._overflowDayOfYear&&(O<xf||O>vv)&&(O=vv),m(v)._overflowWeeks&&O===-1&&(O=Jyr),m(v)._overflowWeekday&&O===-1&&(O=Zyr),m(v).overflow=O),v}var Hbr=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Vbr=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Wbr=/Z|[+-]\d\d(?::?\d\d)?/,EX=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],_we=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Kbr=/^\/?Date\((-?\d+)/i,Gbr=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Jbr={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function fGe(v){var O,A,R=v._i,$=Hbr.exec(R)||Vbr.exec(R),te,xe,lr,En,Wi=EX.length,wp=_we.length;if($){for(m(v).iso=!0,O=0,A=Wi;O<A;O++)if(EX[O][1].exec($[1])){xe=EX[O][0],te=EX[O][2]!==!1;break}if(xe==null){v._isValid=!1;return}if($[3]){for(O=0,A=wp;O<A;O++)if(_we[O][1].exec($[3])){lr=($[2]||" ")+_we[O][0];break}if(lr==null){v._isValid=!1;return}}if(!te&&lr!=null){v._isValid=!1;return}if($[4])if(Wbr.exec($[4]))En="Z";else{v._isValid=!1;return}v._f=xe+(lr||"")+(En||""),wwe(v)}else v._isValid=!1}function Zbr(v,O,A,R,$,te){var xe=[Ybr(v),eGe.indexOf(O),parseInt(A,10),parseInt(R,10),parseInt($,10)];return te&&xe.push(parseInt(te,10)),xe}function Ybr(v){var O=parseInt(v,10);return O<=49?2e3+O:O<=999?1900+O:O}function Xbr(v){return v.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Qbr(v,O,A){if(v){var R=sGe.indexOf(v),$=new Date(O[0],O[1],O[2]).getDay();if(R!==$)return m(A).weekdayMismatch=!0,A._isValid=!1,!1}return!0}function e_r(v,O,A){if(v)return Jbr[v];if(O)return 0;var R=parseInt(A,10),$=R%100,te=(R-$)/100;return te*60+$}function pGe(v){var O=Gbr.exec(Xbr(v._i)),A;if(O){if(A=Zbr(O[4],O[3],O[2],O[5],O[6],O[7]),!Qbr(O[1],A,v))return;v._a=A,v._tzm=e_r(O[8],O[9],O[10]),v._d=l6.apply(null,v._a),v._d.setUTCMinutes(v._d.getUTCMinutes()-v._tzm),m(v).rfc2822=!0}else v._isValid=!1}function t_r(v){var O=Kbr.exec(v._i);if(O!==null){v._d=new Date(+O[1]);return}if(fGe(v),v._isValid===!1)delete v._isValid;else return;if(pGe(v),v._isValid===!1)delete v._isValid;else return;v._strict?v._isValid=!1:e.createFromInputFallback(v)}e.createFromInputFallback=T("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(v){v._d=new Date(v._i+(v._useUTC?" UTC":""))});function sB(v,O,A){return v??O??A}function r_r(v){var O=new Date(e.now());return v._useUTC?[O.getUTCFullYear(),O.getUTCMonth(),O.getUTCDate()]:[O.getFullYear(),O.getMonth(),O.getDate()]}function vwe(v){var O,A,R=[],$,te,xe;if(!v._d){for($=r_r(v),v._w&&v._a[vv]==null&&v._a[iE]==null&&n_r(v),v._dayOfYear!=null&&(xe=sB(v._a[xf],$[xf]),(v._dayOfYear>u6(xe)||v._dayOfYear===0)&&(m(v)._overflowDayOfYear=!0),A=l6(xe,0,v._dayOfYear),v._a[iE]=A.getUTCMonth(),v._a[vv]=A.getUTCDate()),O=0;O<3&&v._a[O]==null;++O)v._a[O]=R[O]=$[O];for(;O<7;O++)v._a[O]=R[O]=v._a[O]==null?O===2?1:0:v._a[O];v._a[ic]===24&&v._a[Ib]===0&&v._a[aE]===0&&v._a[KN]===0&&(v._nextDay=!0,v._a[ic]=0),v._d=(v._useUTC?l6:lbr).apply(null,R),te=v._useUTC?v._d.getUTCDay():v._d.getDay(),v._tzm!=null&&v._d.setUTCMinutes(v._d.getUTCMinutes()-v._tzm),v._nextDay&&(v._a[ic]=24),v._w&&typeof v._w.d<"u"&&v._w.d!==te&&(m(v).weekdayMismatch=!0)}}function n_r(v){var O,A,R,$,te,xe,lr,En,Wi;O=v._w,O.GG!=null||O.W!=null||O.E!=null?(te=1,xe=4,A=sB(O.GG,v._a[xf],c6(_a(),1,4).year),R=sB(O.W,1),$=sB(O.E,1),($<1||$>7)&&(En=!0)):(te=v._locale._week.dow,xe=v._locale._week.doy,Wi=c6(_a(),te,xe),A=sB(O.gg,v._a[xf],Wi.year),R=sB(O.w,Wi.week),O.d!=null?($=O.d,($<0||$>6)&&(En=!0)):O.e!=null?($=O.e+te,(O.e<0||O.e>6)&&(En=!0)):$=te),R<1||R>sE(A,te,xe)?m(v)._overflowWeeks=!0:En!=null?m(v)._overflowWeekday=!0:(lr=aGe(A,R,$,te,xe),v._a[xf]=lr.year,v._dayOfYear=lr.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function wwe(v){if(v._f===e.ISO_8601){fGe(v);return}if(v._f===e.RFC_2822){pGe(v);return}v._a=[],m(v).empty=!0;var O=""+v._i,A,R,$,te,xe,lr=O.length,En=0,Wi,wp;for($=J(v._f,v._locale).match(F)||[],wp=$.length,A=0;A<wp;A++)te=$[A],R=(O.match(vp(te,v))||[])[0],R&&(xe=O.substr(0,O.indexOf(R)),xe.length>0&&m(v).unusedInput.push(xe),O=O.slice(O.indexOf(R)+R.length),En+=R.length),U[te]?(R?m(v).empty=!1:m(v).unusedTokens.push(te),s6(te,R,v)):v._strict&&!R&&m(v).unusedTokens.push(te);m(v).charsLeftOver=lr-En,O.length>0&&m(v).unusedInput.push(O),v._a[ic]<=12&&m(v).bigHour===!0&&v._a[ic]>0&&(m(v).bigHour=void 0),m(v).parsedDateParts=v._a.slice(0),m(v).meridiem=v._meridiem,v._a[ic]=o_r(v._locale,v._a[ic],v._meridiem),Wi=m(v).era,Wi!==null&&(v._a[xf]=v._locale.erasConvertYear(Wi,v._a[xf])),vwe(v),bwe(v)}function o_r(v,O,A){var R;return A==null?O:v.meridiemHour!=null?v.meridiemHour(O,A):(v.isPM!=null&&(R=v.isPM(A),R&&O<12&&(O+=12),!R&&O===12&&(O=0)),O)}function i_r(v){var O,A,R,$,te,xe,lr=!1,En=v._f.length;if(En===0){m(v).invalidFormat=!0,v._d=new Date(NaN);return}for($=0;$<En;$++)te=0,xe=!1,O=S({},v),v._useUTC!=null&&(O._useUTC=v._useUTC),O._f=v._f[$],wwe(O),y(O)&&(xe=!0),te+=m(O).charsLeftOver,te+=m(O).unusedTokens.length*10,m(O).score=te,lr?te<R&&(R=te,A=O):(R==null||te<R||xe)&&(R=te,A=O,xe&&(lr=!0));d(v,A||O)}function a_r(v){if(!v._d){var O=Ge(v._i),A=O.day===void 0?O.date:O.day;v._a=c([O.year,O.month,A,O.hour,O.minute,O.second,O.millisecond],function(R){return R&&parseInt(R,10)}),vwe(v)}}function s_r(v){var O=new C(bwe(mGe(v)));return O._nextDay&&(O.add(1,"d"),O._nextDay=void 0),O}function mGe(v){var O=v._i,A=v._f;return v._locale=v._locale||uE(v._l),O===null||A===void 0&&O===""?g({nullInput:!0}):(typeof O=="string"&&(v._i=O=v._locale.preparse(O)),E(O)?new C(bwe(O)):(l(O)?v._d=O:n(A)?i_r(v):A?wwe(v):u_r(v),y(v)||(v._d=null),v))}function u_r(v){var O=v._i;s(O)?v._d=new Date(e.now()):l(O)?v._d=new Date(O.valueOf()):typeof O=="string"?t_r(v):n(O)?(v._a=c(O.slice(0),function(A){return parseInt(A,10)}),vwe(v)):o(O)?a_r(v):u(O)?v._d=new Date(O):e.createFromInputFallback(v)}function hGe(v,O,A,R,$){var te={};return(O===!0||O===!1)&&(R=O,O=void 0),(A===!0||A===!1)&&(R=A,A=void 0),(o(v)&&a(v)||n(v)&&v.length===0)&&(v=void 0),te._isAMomentObject=!0,te._useUTC=te._isUTC=$,te._l=A,te._i=v,te._f=O,te._strict=R,s_r(te)}function _a(v,O,A,R){return hGe(v,O,A,R,!1)}var l_r=T("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var v=_a.apply(null,arguments);return this.isValid()&&v.isValid()?v<this?this:v:g()}),c_r=T("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var v=_a.apply(null,arguments);return this.isValid()&&v.isValid()?v>this?this:v:g()});function gGe(v,O){var A,R;if(O.length===1&&n(O[0])&&(O=O[0]),!O.length)return _a();for(A=O[0],R=1;R<O.length;++R)(!O[R].isValid()||O[R][v](A))&&(A=O[R]);return A}function d_r(){var v=[].slice.call(arguments,0);return gGe("isBefore",v)}function f_r(){var v=[].slice.call(arguments,0);return gGe("isAfter",v)}var p_r=function(){return Date.now?Date.now():+new Date},p6=["year","quarter","month","week","day","hour","minute","second","millisecond"];function m_r(v){var O,A=!1,R,$=p6.length;for(O in v)if(i(v,O)&&!(Ys.call(p6,O)!==-1&&(v[O]==null||!isNaN(v[O]))))return!1;for(R=0;R<$;++R)if(v[p6[R]]){if(A)return!1;parseFloat(v[p6[R]])!==ge(v[p6[R]])&&(A=!0)}return!0}function h_r(){return this._isValid}function g_r(){return Mb(NaN)}function PX(v){var O=Ge(v),A=O.year||0,R=O.quarter||0,$=O.month||0,te=O.week||O.isoWeek||0,xe=O.day||0,lr=O.hour||0,En=O.minute||0,Wi=O.second||0,wp=O.millisecond||0;this._isValid=m_r(O),this._milliseconds=+wp+Wi*1e3+En*6e4+lr*1e3*60*60,this._days=+xe+te*7,this._months=+$+R*3+A*12,this._data={},this._locale=uE(),this._bubble()}function TX(v){return v instanceof PX}function xwe(v){return v<0?Math.round(-1*v)*-1:Math.round(v)}function y_r(v,O,A){var R=Math.min(v.length,O.length),$=Math.abs(v.length-O.length),te=0,xe;for(xe=0;xe<R;xe++)(A&&v[xe]!==O[xe]||!A&&ge(v[xe])!==ge(O[xe]))&&te++;return te+$}function yGe(v,O){z(v,0,0,function(){var A=this.utcOffset(),R="+";return A<0&&(A=-A,R="-"),R+X(~~(A/60),2)+O+X(~~A%60,2)})}yGe("Z",":"),yGe("ZZ",""),Ye("Z",Zs),Ye("ZZ",Zs),Kn(["Z","ZZ"],function(v,O,A){A._useUTC=!0,A._tzm=Swe(Zs,v)});var b_r=/([\+\-]|\d\d)/gi;function Swe(v,O){var A=(O||"").match(v),R,$,te;return A===null?null:(R=A[A.length-1]||[],$=(R+"").match(b_r)||["-",0,0],te=+($[1]*60)+ge($[2]),te===0?0:$[0]==="+"?te:-te)}function Cwe(v,O){var A,R;return O._isUTC?(A=O.clone(),R=(E(v)||l(v)?v.valueOf():_a(v).valueOf())-A.valueOf(),A._d.setTime(A._d.valueOf()+R),e.updateOffset(A,!1),A):_a(v).local()}function Owe(v){return-Math.round(v._d.getTimezoneOffset())}e.updateOffset=function(){};function __r(v,O,A){var R=this._offset||0,$;if(!this.isValid())return v!=null?this:NaN;if(v!=null){if(typeof v=="string"){if(v=Swe(Zs,v),v===null)return this}else Math.abs(v)<16&&!A&&(v=v*60);return!this._isUTC&&O&&($=Owe(this)),this._offset=v,this._isUTC=!0,$!=null&&this.add($,"m"),R!==v&&(!O||this._changeInProgress?wGe(this,Mb(v-R,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?R:Owe(this)}function v_r(v,O){return v!=null?(typeof v!="string"&&(v=-v),this.utcOffset(v,O),this):-this.utcOffset()}function w_r(v){return this.utcOffset(0,v)}function x_r(v){return this._isUTC&&(this.utcOffset(0,v),this._isUTC=!1,v&&this.subtract(Owe(this),"m")),this}function S_r(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var v=Swe(wf,this._i);v!=null?this.utcOffset(v):this.utcOffset(0,!0)}return this}function C_r(v){return this.isValid()?(v=v?_a(v).utcOffset():0,(this.utcOffset()-v)%60===0):!1}function O_r(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function E_r(){if(!s(this._isDSTShifted))return this._isDSTShifted;var v={},O;return S(v,this),v=mGe(v),v._a?(O=v._isUTC?f(v._a):_a(v._a),this._isDSTShifted=this.isValid()&&y_r(v._a,O.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function P_r(){return this.isValid()?!this._isUTC:!1}function T_r(){return this.isValid()?this._isUTC:!1}function bGe(){return this.isValid()?this._isUTC&&this._offset===0:!1}var A_r=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,I_r=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Mb(v,O){var A=v,R=null,$,te,xe;return TX(v)?A={ms:v._milliseconds,d:v._days,M:v._months}:u(v)||!isNaN(+v)?(A={},O?A[O]=+v:A.milliseconds=+v):(R=A_r.exec(v))?($=R[1]==="-"?-1:1,A={y:0,d:ge(R[vv])*$,h:ge(R[ic])*$,m:ge(R[Ib])*$,s:ge(R[aE])*$,ms:ge(xwe(R[KN]*1e3))*$}):(R=I_r.exec(v))?($=R[1]==="-"?-1:1,A={y:GN(R[2],$),M:GN(R[3],$),w:GN(R[4],$),d:GN(R[5],$),h:GN(R[6],$),m:GN(R[7],$),s:GN(R[8],$)}):A==null?A={}:typeof A=="object"&&("from"in A||"to"in A)&&(xe=M_r(_a(A.from),_a(A.to)),A={},A.ms=xe.milliseconds,A.M=xe.months),te=new PX(A),TX(v)&&i(v,"_locale")&&(te._locale=v._locale),TX(v)&&i(v,"_isValid")&&(te._isValid=v._isValid),te}Mb.fn=PX.prototype,Mb.invalid=g_r;function GN(v,O){var A=v&&parseFloat(v.replace(",","."));return(isNaN(A)?0:A)*O}function _Ge(v,O){var A={};return A.months=O.month()-v.month()+(O.year()-v.year())*12,v.clone().add(A.months,"M").isAfter(O)&&--A.months,A.milliseconds=+O-+v.clone().add(A.months,"M"),A}function M_r(v,O){var A;return v.isValid()&&O.isValid()?(O=Cwe(O,v),v.isBefore(O)?A=_Ge(v,O):(A=_Ge(O,v),A.milliseconds=-A.milliseconds,A.months=-A.months),A):{milliseconds:0,months:0}}function vGe(v,O){return function(A,R){var $,te;return R!==null&&!isNaN(+R)&&(N(O,"moment()."+O+"(period, number) is deprecated. Please use moment()."+O+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),te=A,A=R,R=te),$=Mb(A,R),wGe(this,$,v),this}}function wGe(v,O,A,R){var $=O._milliseconds,te=xwe(O._days),xe=xwe(O._months);v.isValid()&&(R=R??!0,xe&&rGe(v,dr(v,"Month")+xe*A),te&&Ii(v,"Date",dr(v,"Date")+te*A),$&&v._d.setTime(v._d.valueOf()+$*A),R&&e.updateOffset(v,te||xe))}var R_r=vGe(1,"add"),N_r=vGe(-1,"subtract");function xGe(v){return typeof v=="string"||v instanceof String}function j_r(v){return E(v)||l(v)||xGe(v)||u(v)||L_r(v)||D_r(v)||v===null||v===void 0}function D_r(v){var O=o(v)&&!a(v),A=!1,R=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],$,te,xe=R.length;for($=0;$<xe;$+=1)te=R[$],A=A||i(v,te);return O&&A}function L_r(v){var O=n(v),A=!1;return O&&(A=v.filter(function(R){return!u(R)&&xGe(v)}).length===0),O&&A}function F_r(v){var O=o(v)&&!a(v),A=!1,R=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],$,te;for($=0;$<R.length;$+=1)te=R[$],A=A||i(v,te);return O&&A}function k_r(v,O){var A=v.diff(O,"days",!0);return A<-6?"sameElse":A<-1?"lastWeek":A<0?"lastDay":A<1?"sameDay":A<2?"nextDay":A<7?"nextWeek":"sameElse"}function $_r(v,O){arguments.length===1&&(arguments[0]?j_r(arguments[0])?(v=arguments[0],O=void 0):F_r(arguments[0])&&(O=arguments[0],v=void 0):(v=void 0,O=void 0));var A=v||_a(),R=Cwe(A,this).startOf("day"),$=e.calendarFormat(this,R)||"sameElse",te=O&&(M(O[$])?O[$].call(this,A):O[$]);return this.format(te||this.localeData().calendar($,this,_a(A)))}function B_r(){return new C(this)}function z_r(v,O){var A=E(v)?v:_a(v);return this.isValid()&&A.isValid()?(O=Ie(O)||"millisecond",O==="millisecond"?this.valueOf()>A.valueOf():A.valueOf()<this.clone().startOf(O).valueOf()):!1}function U_r(v,O){var A=E(v)?v:_a(v);return this.isValid()&&A.isValid()?(O=Ie(O)||"millisecond",O==="millisecond"?this.valueOf()<A.valueOf():this.clone().endOf(O).valueOf()<A.valueOf()):!1}function q_r(v,O,A,R){var $=E(v)?v:_a(v),te=E(O)?O:_a(O);return this.isValid()&&$.isValid()&&te.isValid()?(R=R||"()",(R[0]==="("?this.isAfter($,A):!this.isBefore($,A))&&(R[1]===")"?this.isBefore(te,A):!this.isAfter(te,A))):!1}function H_r(v,O){var A=E(v)?v:_a(v),R;return this.isValid()&&A.isValid()?(O=Ie(O)||"millisecond",O==="millisecond"?this.valueOf()===A.valueOf():(R=A.valueOf(),this.clone().startOf(O).valueOf()<=R&&R<=this.clone().endOf(O).valueOf())):!1}function V_r(v,O){return this.isSame(v,O)||this.isAfter(v,O)}function W_r(v,O){return this.isSame(v,O)||this.isBefore(v,O)}function K_r(v,O,A){var R,$,te;if(!this.isValid())return NaN;if(R=Cwe(v,this),!R.isValid())return NaN;switch($=(R.utcOffset()-this.utcOffset())*6e4,O=Ie(O),O){case"year":te=AX(this,R)/12;break;case"month":te=AX(this,R);break;case"quarter":te=AX(this,R)/3;break;case"second":te=(this-R)/1e3;break;case"minute":te=(this-R)/6e4;break;case"hour":te=(this-R)/36e5;break;case"day":te=(this-R-$)/864e5;break;case"week":te=(this-R-$)/6048e5;break;default:te=this-R}return A?te:_e(te)}function AX(v,O){if(v.date()<O.date())return-AX(O,v);var A=(O.year()-v.year())*12+(O.month()-v.month()),R=v.clone().add(A,"months"),$,te;return O-R<0?($=v.clone().add(A-1,"months"),te=(O-R)/(R-$)):($=v.clone().add(A+1,"months"),te=(O-R)/($-R)),-(A+te)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function G_r(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function J_r(v){if(!this.isValid())return null;var O=v!==!0,A=O?this.clone().utc():this;return A.year()<0||A.year()>9999?W(A,O?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):M(Date.prototype.toISOString)?O?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",W(A,"Z")):W(A,O?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Z_r(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var v="moment",O="",A,R,$,te;return this.isLocal()||(v=this.utcOffset()===0?"moment.utc":"moment.parseZone",O="Z"),A="["+v+'("]',R=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",$="-MM-DD[T]HH:mm:ss.SSS",te=O+'[")]',this.format(A+R+$+te)}function Y_r(v){v||(v=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var O=W(this,v);return this.localeData().postformat(O)}function X_r(v,O){return this.isValid()&&(E(v)&&v.isValid()||_a(v).isValid())?Mb({to:this,from:v}).locale(this.locale()).humanize(!O):this.localeData().invalidDate()}function Q_r(v){return this.from(_a(),v)}function evr(v,O){return this.isValid()&&(E(v)&&v.isValid()||_a(v).isValid())?Mb({from:this,to:v}).locale(this.locale()).humanize(!O):this.localeData().invalidDate()}function tvr(v){return this.to(_a(),v)}function SGe(v){var O;return v===void 0?this._locale._abbr:(O=uE(v),O!=null&&(this._locale=O),this)}var CGe=T("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(v){return v===void 0?this.localeData():this.locale(v)});function OGe(){return this._locale}var IX=1e3,uB=60*IX,MX=60*uB,EGe=(365*400+97)*24*MX;function lB(v,O){return(v%O+O)%O}function PGe(v,O,A){return v<100&&v>=0?new Date(v+400,O,A)-EGe:new Date(v,O,A).valueOf()}function TGe(v,O,A){return v<100&&v>=0?Date.UTC(v+400,O,A)-EGe:Date.UTC(v,O,A)}function rvr(v){var O,A;if(v=Ie(v),v===void 0||v==="millisecond"||!this.isValid())return this;switch(A=this._isUTC?TGe:PGe,v){case"year":O=A(this.year(),0,1);break;case"quarter":O=A(this.year(),this.month()-this.month()%3,1);break;case"month":O=A(this.year(),this.month(),1);break;case"week":O=A(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":O=A(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":O=A(this.year(),this.month(),this.date());break;case"hour":O=this._d.valueOf(),O-=lB(O+(this._isUTC?0:this.utcOffset()*uB),MX);break;case"minute":O=this._d.valueOf(),O-=lB(O,uB);break;case"second":O=this._d.valueOf(),O-=lB(O,IX);break}return this._d.setTime(O),e.updateOffset(this,!0),this}function nvr(v){var O,A;if(v=Ie(v),v===void 0||v==="millisecond"||!this.isValid())return this;switch(A=this._isUTC?TGe:PGe,v){case"year":O=A(this.year()+1,0,1)-1;break;case"quarter":O=A(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":O=A(this.year(),this.month()+1,1)-1;break;case"week":O=A(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":O=A(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":O=A(this.year(),this.month(),this.date()+1)-1;break;case"hour":O=this._d.valueOf(),O+=MX-lB(O+(this._isUTC?0:this.utcOffset()*uB),MX)-1;break;case"minute":O=this._d.valueOf(),O+=uB-lB(O,uB)-1;break;case"second":O=this._d.valueOf(),O+=IX-lB(O,IX)-1;break}return this._d.setTime(O),e.updateOffset(this,!0),this}function ovr(){return this._d.valueOf()-(this._offset||0)*6e4}function ivr(){return Math.floor(this.valueOf()/1e3)}function avr(){return new Date(this.valueOf())}function svr(){var v=this;return[v.year(),v.month(),v.date(),v.hour(),v.minute(),v.second(),v.millisecond()]}function uvr(){var v=this;return{years:v.year(),months:v.month(),date:v.date(),hours:v.hours(),minutes:v.minutes(),seconds:v.seconds(),milliseconds:v.milliseconds()}}function lvr(){return this.isValid()?this.toISOString():null}function cvr(){return y(this)}function dvr(){return d({},m(this))}function fvr(){return m(this).overflow}function pvr(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}z("N",0,0,"eraAbbr"),z("NN",0,0,"eraAbbr"),z("NNN",0,0,"eraAbbr"),z("NNNN",0,0,"eraName"),z("NNNNN",0,0,"eraNarrow"),z("y",["y",1],"yo","eraYear"),z("y",["yy",2],0,"eraYear"),z("y",["yyy",3],0,"eraYear"),z("y",["yyyy",4],0,"eraYear"),Ye("N",Ewe),Ye("NN",Ewe),Ye("NNN",Ewe),Ye("NNNN",Cvr),Ye("NNNNN",Ovr),Kn(["N","NN","NNN","NNNN","NNNNN"],function(v,O,A,R){var $=A._locale.erasParse(v,R,A._strict);$?m(A).era=$:m(A).invalidEra=v}),Ye("y",is),Ye("yy",is),Ye("yyy",is),Ye("yyyy",is),Ye("yo",Evr),Kn(["y","yy","yyy","yyyy"],xf),Kn(["yo"],function(v,O,A,R){var $;A._locale._eraYearOrdinalRegex&&($=v.match(A._locale._eraYearOrdinalRegex)),A._locale.eraYearOrdinalParse?O[xf]=A._locale.eraYearOrdinalParse(v,$):O[xf]=parseInt(v,10)});function mvr(v,O){var A,R,$,te=this._eras||uE("en")._eras;for(A=0,R=te.length;A<R;++A){switch(typeof te[A].since){case"string":$=e(te[A].since).startOf("day"),te[A].since=$.valueOf();break}switch(typeof te[A].until){case"undefined":te[A].until=1/0;break;case"string":$=e(te[A].until).startOf("day").valueOf(),te[A].until=$.valueOf();break}}return te}function hvr(v,O,A){var R,$,te=this.eras(),xe,lr,En;for(v=v.toUpperCase(),R=0,$=te.length;R<$;++R)if(xe=te[R].name.toUpperCase(),lr=te[R].abbr.toUpperCase(),En=te[R].narrow.toUpperCase(),A)switch(O){case"N":case"NN":case"NNN":if(lr===v)return te[R];break;case"NNNN":if(xe===v)return te[R];break;case"NNNNN":if(En===v)return te[R];break}else if([xe,lr,En].indexOf(v)>=0)return te[R]}function gvr(v,O){var A=v.since<=v.until?1:-1;return O===void 0?e(v.since).year():e(v.since).year()+(O-v.offset)*A}function yvr(){var v,O,A,R=this.localeData().eras();for(v=0,O=R.length;v<O;++v)if(A=this.clone().startOf("day").valueOf(),R[v].since<=A&&A<=R[v].until||R[v].until<=A&&A<=R[v].since)return R[v].name;return""}function bvr(){var v,O,A,R=this.localeData().eras();for(v=0,O=R.length;v<O;++v)if(A=this.clone().startOf("day").valueOf(),R[v].since<=A&&A<=R[v].until||R[v].until<=A&&A<=R[v].since)return R[v].narrow;return""}function _vr(){var v,O,A,R=this.localeData().eras();for(v=0,O=R.length;v<O;++v)if(A=this.clone().startOf("day").valueOf(),R[v].since<=A&&A<=R[v].until||R[v].until<=A&&A<=R[v].since)return R[v].abbr;return""}function vvr(){var v,O,A,R,$=this.localeData().eras();for(v=0,O=$.length;v<O;++v)if(A=$[v].since<=$[v].until?1:-1,R=this.clone().startOf("day").valueOf(),$[v].since<=R&&R<=$[v].until||$[v].until<=R&&R<=$[v].since)return(this.year()-e($[v].since).year())*A+$[v].offset;return this.year()}function wvr(v){return i(this,"_erasNameRegex")||Pwe.call(this),v?this._erasNameRegex:this._erasRegex}function xvr(v){return i(this,"_erasAbbrRegex")||Pwe.call(this),v?this._erasAbbrRegex:this._erasRegex}function Svr(v){return i(this,"_erasNarrowRegex")||Pwe.call(this),v?this._erasNarrowRegex:this._erasRegex}function Ewe(v,O){return O.erasAbbrRegex(v)}function Cvr(v,O){return O.erasNameRegex(v)}function Ovr(v,O){return O.erasNarrowRegex(v)}function Evr(v,O){return O._eraYearOrdinalRegex||is}function Pwe(){var v=[],O=[],A=[],R=[],$,te,xe=this.eras();for($=0,te=xe.length;$<te;++$)O.push(oc(xe[$].name)),v.push(oc(xe[$].abbr)),A.push(oc(xe[$].narrow)),R.push(oc(xe[$].name)),R.push(oc(xe[$].abbr)),R.push(oc(xe[$].narrow));this._erasRegex=new RegExp("^("+R.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+O.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+v.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+A.join("|")+")","i")}z(0,["gg",2],0,function(){return this.weekYear()%100}),z(0,["GG",2],0,function(){return this.isoWeekYear()%100});function RX(v,O){z(0,[v,v.length],0,O)}RX("gggg","weekYear"),RX("ggggg","weekYear"),RX("GGGG","isoWeekYear"),RX("GGGGG","isoWeekYear"),Tr("weekYear","gg"),Tr("isoWeekYear","GG"),le("weekYear",1),le("isoWeekYear",1),Ye("G",bp),Ye("g",bp),Ye("GG",Wn,Vi),Ye("gg",Wn,Vi),Ye("GGGG",Ms,yd),Ye("gggg",Ms,yd),Ye("GGGGG",bu,vf),Ye("ggggg",bu,vf),Ab(["gggg","ggggg","GGGG","GGGGG"],function(v,O,A,R){O[R.substr(0,2)]=ge(v)}),Ab(["gg","GG"],function(v,O,A,R){O[R]=e.parseTwoDigitYear(v)});function Pvr(v){return AGe.call(this,v,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Tvr(v){return AGe.call(this,v,this.isoWeek(),this.isoWeekday(),1,4)}function Avr(){return sE(this.year(),1,4)}function Ivr(){return sE(this.isoWeekYear(),1,4)}function Mvr(){var v=this.localeData()._week;return sE(this.year(),v.dow,v.doy)}function Rvr(){var v=this.localeData()._week;return sE(this.weekYear(),v.dow,v.doy)}function AGe(v,O,A,R,$){var te;return v==null?c6(this,R,$).year:(te=sE(v,R,$),O>te&&(O=te),Nvr.call(this,v,O,A,R,$))}function Nvr(v,O,A,R,$){var te=aGe(v,O,A,R,$),xe=l6(te.year,0,te.dayOfYear);return this.year(xe.getUTCFullYear()),this.month(xe.getUTCMonth()),this.date(xe.getUTCDate()),this}z("Q",0,"Qo","quarter"),Tr("quarter","Q"),le("quarter",7),Ye("Q",yp),Kn("Q",function(v,O){O[iE]=(ge(v)-1)*3});function jvr(v){return v==null?Math.ceil((this.month()+1)/3):this.month((v-1)*3+this.month()%3)}z("D",["DD",2],"Do","date"),Tr("date","D"),le("date",9),Ye("D",Wn),Ye("DD",Wn,Vi),Ye("Do",function(v,O){return v?O._dayOfMonthOrdinalParse||O._ordinalParse:O._dayOfMonthOrdinalParseLenient}),Kn(["D","DD"],vv),Kn("Do",function(v,O){O[vv]=ge(v.match(Wn)[0])});var IGe=Le("Date",!0);z("DDD",["DDDD",3],"DDDo","dayOfYear"),Tr("dayOfYear","DDD"),le("dayOfYear",4),Ye("DDD",RA),Ye("DDDD",gd),Kn(["DDD","DDDD"],function(v,O,A){A._dayOfYear=ge(v)});function Dvr(v){var O=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return v==null?O:this.add(v-O,"d")}z("m",["mm",2],0,"minute"),Tr("minute","m"),le("minute",14),Ye("m",Wn),Ye("mm",Wn,Vi),Kn(["m","mm"],Ib);var Lvr=Le("Minutes",!1);z("s",["ss",2],0,"second"),Tr("second","s"),le("second",15),Ye("s",Wn),Ye("ss",Wn,Vi),Kn(["s","ss"],aE);var Fvr=Le("Seconds",!1);z("S",0,0,function(){return~~(this.millisecond()/100)}),z(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),z(0,["SSS",3],0,"millisecond"),z(0,["SSSS",4],0,function(){return this.millisecond()*10}),z(0,["SSSSS",5],0,function(){return this.millisecond()*100}),z(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),z(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),z(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),z(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Tr("millisecond","ms"),le("millisecond",16),Ye("S",RA,yp),Ye("SS",RA,Vi),Ye("SSS",RA,gd);var jA,MGe;for(jA="SSSS";jA.length<=9;jA+="S")Ye(jA,is);function kvr(v,O){O[KN]=ge(("0."+v)*1e3)}for(jA="S";jA.length<=9;jA+="S")Kn(jA,kvr);MGe=Le("Milliseconds",!1),z("z",0,0,"zoneAbbr"),z("zz",0,0,"zoneName");function $vr(){return this._isUTC?"UTC":""}function Bvr(){return this._isUTC?"Coordinated Universal Time":""}var Ve=C.prototype;Ve.add=R_r,Ve.calendar=$_r,Ve.clone=B_r,Ve.diff=K_r,Ve.endOf=nvr,Ve.format=Y_r,Ve.from=X_r,Ve.fromNow=Q_r,Ve.to=evr,Ve.toNow=tvr,Ve.get=bi,Ve.invalidAt=fvr,Ve.isAfter=z_r,Ve.isBefore=U_r,Ve.isBetween=q_r,Ve.isSame=H_r,Ve.isSameOrAfter=V_r,Ve.isSameOrBefore=W_r,Ve.isValid=cvr,Ve.lang=CGe,Ve.locale=SGe,Ve.localeData=OGe,Ve.max=c_r,Ve.min=l_r,Ve.parsingFlags=dvr,Ve.set=_f,Ve.startOf=rvr,Ve.subtract=N_r,Ve.toArray=svr,Ve.toObject=uvr,Ve.toDate=avr,Ve.toISOString=J_r,Ve.inspect=Z_r,typeof Symbol<"u"&&Symbol.for!=null&&(Ve[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Ve.toJSON=lvr,Ve.toString=G_r,Ve.unix=ivr,Ve.valueOf=ovr,Ve.creationData=pvr,Ve.eraName=yvr,Ve.eraNarrow=bvr,Ve.eraAbbr=_vr,Ve.eraYear=vvr,Ve.year=iGe,Ve.isLeapYear=ubr,Ve.weekYear=Pvr,Ve.isoWeekYear=Tvr,Ve.quarter=Ve.quarters=jvr,Ve.month=nGe,Ve.daysInMonth=ibr,Ve.week=Ve.weeks=mbr,Ve.isoWeek=Ve.isoWeeks=hbr,Ve.weeksInYear=Mvr,Ve.weeksInWeekYear=Rvr,Ve.isoWeeksInYear=Avr,Ve.isoWeeksInISOWeekYear=Ivr,Ve.date=IGe,Ve.day=Ve.days=Tbr,Ve.weekday=Abr,Ve.isoWeekday=Ibr,Ve.dayOfYear=Dvr,Ve.hour=Ve.hours=Fbr,Ve.minute=Ve.minutes=Lvr,Ve.second=Ve.seconds=Fvr,Ve.millisecond=Ve.milliseconds=MGe,Ve.utcOffset=__r,Ve.utc=w_r,Ve.local=x_r,Ve.parseZone=S_r,Ve.hasAlignedHourOffset=C_r,Ve.isDST=O_r,Ve.isLocal=P_r,Ve.isUtcOffset=T_r,Ve.isUtc=bGe,Ve.isUTC=bGe,Ve.zoneAbbr=$vr,Ve.zoneName=Bvr,Ve.dates=T("dates accessor is deprecated. Use date instead.",IGe),Ve.months=T("months accessor is deprecated. Use month instead",nGe),Ve.years=T("years accessor is deprecated. Use year instead",iGe),Ve.zone=T("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",v_r),Ve.isDSTShifted=T("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",E_r);function zvr(v){return _a(v*1e3)}function Uvr(){return _a.apply(null,arguments).parseZone()}function RGe(v){return v}var Bo=L.prototype;Bo.calendar=G,Bo.longDateFormat=be,Bo.invalidDate=pe,Bo.ordinal=Et,Bo.preparse=RGe,Bo.postformat=RGe,Bo.relativeTime=$r,Bo.pastFuture=On,Bo.set=D,Bo.eras=mvr,Bo.erasParse=hvr,Bo.erasConvertYear=gvr,Bo.erasAbbrRegex=xvr,Bo.erasNameRegex=wvr,Bo.erasNarrowRegex=Svr,Bo.months=tbr,Bo.monthsShort=rbr,Bo.monthsParse=obr,Bo.monthsRegex=sbr,Bo.monthsShortRegex=abr,Bo.week=cbr,Bo.firstDayOfYear=pbr,Bo.firstDayOfWeek=fbr,Bo.weekdays=Sbr,Bo.weekdaysMin=Obr,Bo.weekdaysShort=Cbr,Bo.weekdaysParse=Pbr,Bo.weekdaysRegex=Mbr,Bo.weekdaysShortRegex=Rbr,Bo.weekdaysMinRegex=Nbr,Bo.isPM=Dbr,Bo.meridiem=kbr;function NX(v,O,A,R){var $=uE(),te=f().set(R,O);return $[A](te,v)}function NGe(v,O,A){if(u(v)&&(O=v,v=void 0),v=v||"",O!=null)return NX(v,O,A,"month");var R,$=[];for(R=0;R<12;R++)$[R]=NX(v,R,A,"month");return $}function Twe(v,O,A,R){typeof v=="boolean"?(u(O)&&(A=O,O=void 0),O=O||""):(O=v,A=O,v=!1,u(O)&&(A=O,O=void 0),O=O||"");var $=uE(),te=v?$._week.dow:0,xe,lr=[];if(A!=null)return NX(O,(A+te)%7,R,"day");for(xe=0;xe<7;xe++)lr[xe]=NX(O,(xe+te)%7,R,"day");return lr}function qvr(v,O){return NGe(v,O,"months")}function Hvr(v,O){return NGe(v,O,"monthsShort")}function Vvr(v,O,A){return Twe(v,O,A,"weekdays")}function Wvr(v,O,A){return Twe(v,O,A,"weekdaysShort")}function Kvr(v,O,A){return Twe(v,O,A,"weekdaysMin")}NA("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(v){var O=v%10,A=ge(v%100/10)===1?"th":O===1?"st":O===2?"nd":O===3?"rd":"th";return v+A}}),e.lang=T("moment.lang is deprecated. Use moment.locale instead.",NA),e.langData=T("moment.langData is deprecated. Use moment.localeData instead.",uE);var lE=Math.abs;function Gvr(){var v=this._data;return this._milliseconds=lE(this._milliseconds),this._days=lE(this._days),this._months=lE(this._months),v.milliseconds=lE(v.milliseconds),v.seconds=lE(v.seconds),v.minutes=lE(v.minutes),v.hours=lE(v.hours),v.months=lE(v.months),v.years=lE(v.years),this}function jGe(v,O,A,R){var $=Mb(O,A);return v._milliseconds+=R*$._milliseconds,v._days+=R*$._days,v._months+=R*$._months,v._bubble()}function Jvr(v,O){return jGe(this,v,O,1)}function Zvr(v,O){return jGe(this,v,O,-1)}function DGe(v){return v<0?Math.floor(v):Math.ceil(v)}function Yvr(){var v=this._milliseconds,O=this._days,A=this._months,R=this._data,$,te,xe,lr,En;return v>=0&&O>=0&&A>=0||v<=0&&O<=0&&A<=0||(v+=DGe(Awe(A)+O)*864e5,O=0,A=0),R.milliseconds=v%1e3,$=_e(v/1e3),R.seconds=$%60,te=_e($/60),R.minutes=te%60,xe=_e(te/60),R.hours=xe%24,O+=_e(xe/24),En=_e(LGe(O)),A+=En,O-=DGe(Awe(En)),lr=_e(A/12),A%=12,R.days=O,R.months=A,R.years=lr,this}function LGe(v){return v*4800/146097}function Awe(v){return v*146097/4800}function Xvr(v){if(!this.isValid())return NaN;var O,A,R=this._milliseconds;if(v=Ie(v),v==="month"||v==="quarter"||v==="year")switch(O=this._days+R/864e5,A=this._months+LGe(O),v){case"month":return A;case"quarter":return A/3;case"year":return A/12}else switch(O=this._days+Math.round(Awe(this._months)),v){case"week":return O/7+R/6048e5;case"day":return O+R/864e5;case"hour":return O*24+R/36e5;case"minute":return O*1440+R/6e4;case"second":return O*86400+R/1e3;case"millisecond":return Math.floor(O*864e5)+R;default:throw new Error("Unknown unit "+v)}}function Qvr(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+ge(this._months/12)*31536e6:NaN}function cE(v){return function(){return this.as(v)}}var ewr=cE("ms"),twr=cE("s"),rwr=cE("m"),nwr=cE("h"),owr=cE("d"),iwr=cE("w"),awr=cE("M"),swr=cE("Q"),uwr=cE("y");function lwr(){return Mb(this)}function cwr(v){return v=Ie(v),this.isValid()?this[v+"s"]():NaN}function JN(v){return function(){return this.isValid()?this._data[v]:NaN}}var dwr=JN("milliseconds"),fwr=JN("seconds"),pwr=JN("minutes"),mwr=JN("hours"),hwr=JN("days"),gwr=JN("months"),ywr=JN("years");function bwr(){return _e(this.days()/7)}var dE=Math.round,cB={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function _wr(v,O,A,R,$){return $.relativeTime(O||1,!!A,v,R)}function vwr(v,O,A,R){var $=Mb(v).abs(),te=dE($.as("s")),xe=dE($.as("m")),lr=dE($.as("h")),En=dE($.as("d")),Wi=dE($.as("M")),wp=dE($.as("w")),fE=dE($.as("y")),DA=te<=A.ss&&["s",te]||te<A.s&&["ss",te]||xe<=1&&["m"]||xe<A.m&&["mm",xe]||lr<=1&&["h"]||lr<A.h&&["hh",lr]||En<=1&&["d"]||En<A.d&&["dd",En];return A.w!=null&&(DA=DA||wp<=1&&["w"]||wp<A.w&&["ww",wp]),DA=DA||Wi<=1&&["M"]||Wi<A.M&&["MM",Wi]||fE<=1&&["y"]||["yy",fE],DA[2]=O,DA[3]=+v>0,DA[4]=R,_wr.apply(null,DA)}function wwr(v){return v===void 0?dE:typeof v=="function"?(dE=v,!0):!1}function xwr(v,O){return cB[v]===void 0?!1:O===void 0?cB[v]:(cB[v]=O,v==="s"&&(cB.ss=O-1),!0)}function Swr(v,O){if(!this.isValid())return this.localeData().invalidDate();var A=!1,R=cB,$,te;return typeof v=="object"&&(O=v,v=!1),typeof v=="boolean"&&(A=v),typeof O=="object"&&(R=Object.assign({},cB,O),O.s!=null&&O.ss==null&&(R.ss=O.s-1)),$=this.localeData(),te=vwr(this,!A,R,$),A&&(te=$.pastFuture(+this,te)),$.postformat(te)}var Iwe=Math.abs;function dB(v){return(v>0)-(v<0)||+v}function jX(){if(!this.isValid())return this.localeData().invalidDate();var v=Iwe(this._milliseconds)/1e3,O=Iwe(this._days),A=Iwe(this._months),R,$,te,xe,lr=this.asSeconds(),En,Wi,wp,fE;return lr?(R=_e(v/60),$=_e(R/60),v%=60,R%=60,te=_e(A/12),A%=12,xe=v?v.toFixed(3).replace(/\.?0+$/,""):"",En=lr<0?"-":"",Wi=dB(this._months)!==dB(lr)?"-":"",wp=dB(this._days)!==dB(lr)?"-":"",fE=dB(this._milliseconds)!==dB(lr)?"-":"",En+"P"+(te?Wi+te+"Y":"")+(A?Wi+A+"M":"")+(O?wp+O+"D":"")+($||R||v?"T":"")+($?fE+$+"H":"")+(R?fE+R+"M":"")+(v?fE+xe+"S":"")):"P0D"}var xo=PX.prototype;xo.isValid=h_r,xo.abs=Gvr,xo.add=Jvr,xo.subtract=Zvr,xo.as=Xvr,xo.asMilliseconds=ewr,xo.asSeconds=twr,xo.asMinutes=rwr,xo.asHours=nwr,xo.asDays=owr,xo.asWeeks=iwr,xo.asMonths=awr,xo.asQuarters=swr,xo.asYears=uwr,xo.valueOf=Qvr,xo._bubble=Yvr,xo.clone=lwr,xo.get=cwr,xo.milliseconds=dwr,xo.seconds=fwr,xo.minutes=pwr,xo.hours=mwr,xo.days=hwr,xo.weeks=bwr,xo.months=gwr,xo.years=ywr,xo.humanize=Swr,xo.toISOString=jX,xo.toString=jX,xo.toJSON=jX,xo.locale=SGe,xo.localeData=OGe,xo.toIsoString=T("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",jX),xo.lang=CGe,z("X",0,0,"unix"),z("x",0,0,"valueOf"),Ye("x",bp),Ye("X",pm),Kn("X",function(v,O,A){A._d=new Date(parseFloat(v)*1e3)}),Kn("x",function(v,O,A){A._d=new Date(ge(v))});return e.version="2.29.4",r(_a),e.fn=Ve,e.min=d_r,e.max=f_r,e.now=p_r,e.utc=f,e.unix=zvr,e.months=qvr,e.isDate=l,e.locale=NA,e.invalid=g,e.duration=Mb,e.isMoment=E,e.weekdays=Vvr,e.parseZone=Uvr,e.localeData=uE,e.isDuration=TX,e.monthsShort=Hvr,e.weekdaysMin=Kvr,e.defineLocale=ywe,e.updateLocale=Ubr,e.locales=qbr,e.weekdaysShort=Wvr,e.normalizeUnits=Ie,e.relativeTimeRounding=wwr,e.relativeTimeThreshold=xwr,e.calendarFormat=k_r,e.prototype=Ve,e.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},e})});var Vet={};as(Vet,{CustomError:()=>en,TimeoutError:()=>v8});var en,v8,IE=b(()=>{en=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype)}},v8=class t extends Error{constructor(e,r){super(`${e} timed out after ${r}ms`),this.name="TimeoutError",Object.setPrototypeOf(this,t.prototype)}}});function Wet(t){let e=t?.detail||{};return{status:e.status,message:e.message||t?.message,reason:e.reason}}function CTr(t){let e=Wet(t);return e.reason==="Invalid license key"||t?.message==="Invalid license key"||t?.message?.includes("status 403")||e.status===403}function Ket(t){let e=Wet(t);return CTr(t)?aCe.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:aCe.UNKNOWN_ERROR)}function rz(t){return t.replace(/^#/,"").trim().toLowerCase()}function Fj(t,e=!0){let r=app.metadataCache.getFileCache(t),n=r?.frontmatter?.tags,o=new Set;if(!e){let i=r?.tags?.map(a=>a.tag);i&&i.forEach(a=>o.add(rz(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(rz(i))}):typeof n=="string"&&o.add(rz(n))),Array.from(o)}function Get(t,e,r){if(e.length===0)return[];e=e.map(i=>rz(i));let n=r&&r.length>0?r:lCe(t,"/"),o=[];for(let i of n){let a=Fj(i);e.some(s=>a.includes(s))&&o.push(i)}return o}async function Mm(t){let e=(0,jf.normalizePath)(t).replace(/^\/+/,"").replace(/\/+$/,"");if(!e)return;let r=e.split("/").filter(Boolean),n="";for(let o of r){n=n?`${n}/${o}`:o;let i=app.vault.getAbstractFileByPath(n);if(i){if(i instanceof jf.TFile)throw new Error(`Path conflict: "${n}" exists as a file, expected folder.`);continue}await app.vault.adapter.mkdir(n)}}function cCe(t){let e=(0,uCe.default)(t,"YYYY/MM/DD HH:mm:ss");return e.isValid()?{fileName:e.format("YYYYMMDD_HHmmss"),display:e.format("YYYY/MM/DD HH:mm:ss"),epoch:e.valueOf()}:nu(new Date)}async function nz(t,e){return t.extension!="md"&&t.extension!="canvas"?null:await e.cachedRead(t)}function Tee(t){return t.basename}function dCe(t){return t?t.extension==="md"||t.extension==="pdf"||t.extension==="canvas":!1}function Fh(t){return t==="copilot_plus"||t==="project"}function oz(t,e){return t?t.extension==="md"||t.extension==="canvas"?!0:Fh(e):!1}function Zet(t,e){return!t||!e?!1:t.includes(sCe)&&e.includes(sCe)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function iz(t){let e=[],{history:r}=t;for(let n=0;n<r.length;n+=2){let o=r[n]?.content||"",i=r[n+1]?.content||"";e.push({role:"user",content:o},{role:"assistant",content:i})}return e}function Zg(t,e){let r=/\[\[(.*?)\]\]/g,n=t.match(r),o=new Map;return n&&n.forEach(i=>{let a=i.slice(2,-2),s=e.getAbstractFileByPath(a);if(s instanceof jf.TFile)o.set(s.path,s);else{let l=e.getMarkdownFiles().filter(c=>c.basename===a);l.length>0&&(fCe(a,e)?o.set(l[0].path,l[0]):console.warn(`Found multiple files with title "${a}". Expected a full path for duplicate titles.`))}}),Array.from(o.values())}function fCe(t,e){return e.getMarkdownFiles().filter(n=>n.basename===t).length===1}function Yet(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function Xet(t){let e=new Set;return t.forEach(r=>{r.metadata?.title&&e.add(r.metadata?.title)}),Array.from(e)}function Qet(t){return pCe.test(t)}function mCe(t){let e=t.match(pCe);return e?e[0]:null}function Aee(t){let e=t.matchAll(new RegExp(pCe,"g"));return Array.from(e,r=>r[0])}async function wu(t,e={}){let r=new Headers(e.headers),n=Object.fromEntries(r.entries());delete n["content-length"],B("safeFetch request");let o=e.method?.toUpperCase()||"POST",a=await(0,jf.requestUrl)({url:t,contentType:"application/json",headers:n,method:o,...["POST","PUT","PATCH"].includes(o)&&{body:e.body?.toString()},throw:!1});if(a.status>=400){let s;try{s=typeof a.json=="string"?JSON.parse(a.json):a.json}catch{try{s=typeof a.text=="string"?JSON.parse(a.text):a.text}catch{s=null}}let u=new Error(aCe.REQUEST_FAILED(a.status));if(u.json=s,s?.detail?.reason==="Invalid license key"||s?.reason==="Invalid license key")u.message="Invalid license key";else if(s?.detail?.message||s?.message){let l=s?.detail?.message||s?.message,c=s?.detail?.reason||s?.reason;u.message=c?`${l}: ${c}`:l}else s?.detail?u.message=JSON.stringify(s.detail):s&&(u.message+=". "+JSON.stringify(s));throw u}return{ok:a.status>=200&&a.status<300,status:a.status,statusText:a.status.toString(),headers:new Headers(a.headers),url:t,type:"basic",redirected:!1,bytes:()=>Promise.resolve(new Uint8Array(0)),body:PTr(a.text),bodyUsed:!0,json:()=>a.json,text:async()=>a.text,arrayBuffer:async()=>{if(a.arrayBuffer)return a.arrayBuffer;let s=a.text.replace(/^data:.*;base64,/,""),u=atob(s),l=new Uint8Array(u.length);for(let c=0;c<u.length;c++)l[c]=u.charCodeAt(c);return l.buffer},blob:()=>{throw new Error("not implemented")},formData:()=>{throw new Error("not implemented")},clone:()=>{throw new Error("not implemented")}}}function PTr(t){return new ReadableStream({start(e){let n=new TextEncoder().encode(t);e.enqueue(n),e.close()}})}function w8(t,e){let r={...t};return e.forEach(n=>{delete r[n]}),r}function Iee(t,e){let[r,n]=t.split("|"),o=e.find(i=>i.name===r&&i.provider===n);if(!o)throw new Error(`No model configuration found for: ${t}`);return o}function ME(t){let e=uz[t];return{...e,label:e.label||t}}function jp(t,e){let r=uz[t]?.label||t;return r+(e?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}function Mee(t){let e=t;return e=kj(e),e=e.replace(/```xml\s*[\s\S]*?<writeToFile>[\s\S]*?<\/writeToFile>[\s\S]*?```/g,""),e=e.replace(/<writeToFile>[\s\S]*?<\/writeToFile>/g,""),e=e.replace(/<!--TOOL_CALL_START:[^:]+:[^:]+:[^:]+:[^:]+:[^:]*:[^:]+-->[\s\S]*?<!--TOOL_CALL_END:[^:]+:[\s\S]*?-->/g,""),e=e.replace(/\n{3,}/g,`
`),e=e.trim(),e}async function x8(t,e=!1){let r=app.workspace.getMostRecentLeaf();if(!r){new jf.Notice("No active leaf found.");return}if(r.view instanceof jf.MarkdownView||(r=app.workspace.getLeaf(!1),await r.setViewState({type:"markdown",state:r.view.getState()})),!(r.view instanceof jf.MarkdownView)){new jf.Notice("Failed to open a markdown view.");return}let n=r.view.editor,o=n.getCursor("from"),i=n.getCursor("to"),a=Mee(t);e?n.replaceRange(a,o,i):n.replaceRange(a,i),new jf.Notice("Message inserted into the active note.")}function Ree(t,e){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function Nee(t,e){let r=t.split(".").map(Number),n=e.split(".").map(Number);for(let o=0;o<3;o++){if(r[o]>n[o])return!0;if(r[o]<n[o])return!1}return!1}async function ett(){try{return{version:(await(0,jf.requestUrl)({url:"https://api.github.com/repos/logancyang/obsidian-copilot/releases/latest",method:"GET"})).json.tag_name.replace("v",""),error:null}}catch(t){return{version:null,error:t instanceof Error?t.message:"Failed to check for updates"}}}function S8(t){if(typeof t=="string")return t.startsWith("o1")||t.startsWith("o3")||t.startsWith("o4");let e=t.modelName||t.model||"";return e.startsWith("o1")||e.startsWith("o3")||e.startsWith("o4")}function TTr(t){return typeof t=="string"?t.startsWith("gpt-5"):(t.modelName||t.model||"").startsWith("gpt-5")}function az(t){let e=typeof t=="string"?t:t.modelName||t.model||"",r=S8(e),n=TTr(e),o=e.startsWith("claude-3-7-sonnet")||e.startsWith("claude-sonnet-4");return{isOSeries:r,isGPT5:n,isThinkingEnabled:o}}function iI(t,e="system"){return S8(t)?"human":e}function hCe(){let t=["3rd party (openai-format)","ollama","lm-studio","azure openai","copilot-plus","copilot-plus-jina"];return Object.entries(uz).filter(([e])=>!t.includes(e)).map(([e])=>e)}function sz(t,e){let r=!!hCe().find(i=>i===t.provider),n=NE[t.provider],o=!t.apiKey&&!e[n];return r&&o?{hasApiKey:!1,errorNotice:`Please configure API Key for ${t.name} in settings first.
Path: Settings > copilot plugin > Basic Tab > Set Keys`}:{hasApiKey:!0}}function ATr(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e.type==="text").map(e=>e.text).join(""):String(t||"")}function kj(t){let r=ATr(t).replace(/<think>[\s\S]*?<\/think>/g,"");return r=r.replace(/<think>[\s\S]*$/g,""),r.trim()}function ttt(){return crypto.randomUUID()}async function Od(t){let e=console.warn;try{return console.warn=function(...r){if(!(r[0]?.includes&&(r[0].includes("Failed to calculate number of tokens")||r[0].includes("Unknown model"))))return e.apply(console,r)},await t()}finally{console.warn=e}}async function jee(t,e,r="Operation"){let{TimeoutError:n}=await Promise.resolve().then(()=>(IE(),Vet)),o=new AbortController,i=setTimeout(()=>{o.abort()},e);try{return await Promise.race([t(o.signal),new Promise((a,s)=>{o.signal.addEventListener("abort",()=>{s(new n(r,e))})})])}finally{clearTimeout(i)}}function gCe(){let t=app.workspace.getActiveViewOfType(jf.MarkdownView);return t?t.getState().source===!0:!0}var uCe,jf,aCe,lCe,OTr,ETr,Jet,nu,pCe,kt=b(()=>{xu();er();$t();uCe=j(Het()),jf=require("obsidian");nCe();aCe={INVALID_LICENSE_KEY_USER:"Invalid Copilot Plus license key. Please check your license key in settings.",UNKNOWN_ERROR:"An unknown error occurred",REQUEST_FAILED:t=>`Request failed, status ${t}`};lCe=(t,e)=>{let r=t.getMarkdownFiles();if(e==="/")return r;let n=e.toLowerCase().replace(/^\/|\/$/g,"");return r.filter(o=>{let a=o.path.toLowerCase().split("/"),s=n.split("/"),u=0;for(let l of s){for(;u<a.length&&a[u]!==l;)u++;if(u>=a.length)return!1}return!0})};OTr=t=>t.last.bound.modelName||t.last.bound.model,ETr=t=>t.last.bound.retriever!==void 0,Jet=t=>OTr(t)||ETr(t),nu=(t,e="local")=>{let r=(0,uCe.default)(t);return e==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};pCe=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/});var lz,yCe,C8,xu=b(()=>{$b();tI();Im();met();kt();lz=class lz{static createNewLLMChain(e){let{llm:r,memory:n,prompt:o,abortController:i}=e,a=r.bind({signal:i?.signal}),s=Fi.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return lz.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(e){let r=lz.instances.get("llm_chain");return r||(r=lz.createNewLLMChain(e)),r}static createConversationalRetrievalChain(e,r,n){let{llm:o,retriever:i,systemMessage:a}=e,u=If.fromTemplate(`Given the following conversation and a follow up question,
summarize the conversation as context and keep the follow up question unchanged, in its original language.
If the follow up question is unrelated to its preceding messages, return this follow up question directly.
If it is related, then combine the summary and the follow up question to construct a standalone question.
Make sure to keep any [[]] wrapped note titles in the question unchanged.
Chat History:
{chat_history}
Follow Up Input: {question}
Standalone question:`),c=If.fromTemplate(`{system_message}
Answer the question with as detailed as possible based only on the following context:
{context}
Question: {question}
`),d=y=>y.map(_=>`Human: ${_[0]}
Assistant: ${_[1]}`).join(`
`),f=Fi.from([{question:y=>(n&&console.log("Input Question: ",y.question),y.question),chat_history:y=>{let g=d(y.chat_history);return n&&console.log("Formatted Chat History: ",g),g}},u,o,new bee,y=>{let g=kj(y);return n&&console.log("Standalone Question: ",g),g}]),p=async y=>(r(y),$Se(y)),m=Fi.from([{context:i.pipe(p),question:new Fo,system_message:()=>a},c,o]);return f.pipe(m)}};lz.instances=new Map;yCe=lz,C8=yCe});var O8=b(()=>{});var aI,js,So,Yg,TE,ITr,MTr,rCe,zet,ntt,E8,Rm,P8,$j,T8,bCe,Bj,_Ce,vCe,cz,Dv,jE,Df,RE,sI,jv,oI,Lj,sCe,uz,NE,ott,zr,Dee,Xg,dz,za,Qg,er=b(()=>{ZN();xu();O8();aI="https://api.brevilabs.com/v1",js="copilot-chat-view",So="user",Yg="ai",TE="copilot",ITr=`${TE}/copilot-conversations`,MTr=`${TE}/copilot-custom-prompts`,rCe=TE,zet=`You are Obsidian Copilot, a helpful assistant that integrates AI to Obsidian note-taking.
1. Never mention that you do not have access to something. Always rely on the user provided context.
2. Always answer to the best of your knowledge. If you are unsure about something, say so and ask the user to provide more context.
3. If the user mentions "note", it most likely means an Obsidian note in the vault, not the generic meaning of a note.
4. If the user mentions "@vault", it means the user wants you to search the Obsidian vault for information relevant to the query. The search results will be provided to you in the context along with the user query, read it carefully and answer the question based on the information provided. If there's no relevant information in the vault, just say so.
5. If the user mentions any other tool with the @ symbol, check the context for their results. If nothing is found, just ignore the @ symbol in the query.
6. Always use $'s instead of \\[ etc. for LaTeX equations.
7. When showing note titles, use [[title]] format and do not wrap them in \` \`.
8. When showing **Obsidian internal** image links, use ![[link]] format and do not wrap them in \` \`.
9. When showing **web** image links, use ![link](url) format and do not wrap them in \` \`.
10. When generating a table, format as github markdown tables, however, for table headings, immediately add ' |' after the table heading.
11. Always respond in the language of the user's query.
12. Do NOT mention the additional context provided such as getCurrentTime and getTimeRangeMs if it's irrelevant to the user message.
13. If the user mentions "tags", it most likely means tags in Obsidian note properties.
14. YouTube URLs: If the user provides YouTube URLs in their message, transcriptions will be automatically fetched and provided to you. You don't need to do anything special - just use the transcription content if available.`,ntt=`Return the new note content or canvas JSON in <writeToFile> tags.
# Steps to find the the target notes
1. Extract the target note information from user message and find out the note path from the context below.
2. If target note is not specified, use the <active_note> as the target note.
3. If still failed to find the target note or the note path, ask the user to specify the target note.
# Examples
Input: Add a new section to note A
Output:
<writeToFile>
<path>path/to/file.md</path>
<content>The FULL CONTENT of the note A with added section goes here</content>
</writeToFile>
Input: Create a new canvas with "Hello, world!"
Output:
<writeToFile>
<path>path/to/file.canvas</path>
<content>
{
"nodes": [
{
"id": "1",
"type": "text",
"text": "Hello, world!",
"x": 0,
"y": 0,
"width": 200,
"height": 50
}
],
"edges": [
{
"id": "e1-2",
"fromNode": "1",
"toNode": "2",
"label": "connects to"
}
]
}
</content>
</writeToFile>
# Important
# The content within the <content> tags for canvas files is in JSON format.
* For canvas files, both 'nodes' and 'edges' arrays must be properly closed with ]
* Prefer to create new files in existing folders or root folder unless the user's request specifies otherwise
* File paths must end with a .md or .canvas extension
* When generating changes on multiple files, output multiple <writeToFile> tags
* For canvas files:
- Every node must have: id, type, x, y, width, height
- Every edge must have: id, fromNode, toNode
- All IDs must be unique
- Edge fromNode and toNode must reference existing node IDs.
`,E8="note_context",Rm="selected_text",P8="variable",$j="variable_note",T8="embedded_pdf",bCe="retrieved_document",Bj=6e3,_Ce=.4,vCe=448e3,cz=3e4,Dv={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree"},jE={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"},Df={MAX_TOKENS:6e3,TEMPERATURE:.1,REASONING_EFFORT:"low",VERBOSITY:"medium"},RE=(m=>(m.OPENAI="openai",m.OPENAI_FORMAT="3rd party (openai-format)",m.AZURE_OPENAI="azure openai",m.ANTHROPIC="anthropic",m.COHEREAI="cohereai",m.GOOGLE="google",m.XAI="xai",m.OPENROUTERAI="openrouterai",m.GROQ="groq",m.OLLAMA="ollama",m.LM_STUDIO="lm-studio",m.COPILOT_PLUS="copilot-plus",m.MISTRAL="mistralai",m.DEEPSEEK="deepseek",m))(RE||{}),sI={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},jv=[{name:"copilot-plus-flash",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,core:!0,plusExclusive:!0,projectEnabled:!1,capabilities:["vision"]},{name:"google/gemini-2.5-flash-lite",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"google/gemini-2.5-flash",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"google/gemini-2.5-pro",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"openai/gpt-4.1",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"openai/gpt-4.1-mini",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"x-ai/grok-4-fast:free",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!1,projectEnabled:!0},{name:"gpt-5",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"gpt-5-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"gpt-5-nano",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"gpt-4.1",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-4.1-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-4.1-nano",provider:"openai",enabled:!0,isBuiltIn:!0,capabilities:["vision"]},{name:"claude-sonnet-4-20250514",provider:"anthropic",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"claude-3-7-sonnet-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"grok-3-beta",provider:"xai",enabled:!0,isBuiltIn:!0},{name:"grok-3-mini-beta",provider:"xai",enabled:!0,isBuiltIn:!0},{name:"gemini-2.5-flash",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gemini-2.5-flash-lite",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gemini-2.5-pro",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0},{name:"deepseek-chat",provider:"deepseek",enabled:!0,isBuiltIn:!0},{name:"deepseek-reasoner",provider:"deepseek",enabled:!0,isBuiltIn:!0,capabilities:["reasoning"]}],oI=(l=>(l.OPENAI="openai",l.COHEREAI="cohereai",l.GOOGLE="google",l.AZURE_OPENAI="azure openai",l.OLLAMA="ollama",l.LM_STUDIO="lm-studio",l.OPENAI_FORMAT="3rd party (openai-format)",l.COPILOT_PLUS="copilot-plus",l.COPILOT_PLUS_JINA="copilot-plus-jina",l))(oI||{}),Lj=[{name:"copilot-plus-small",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0},{name:"copilot-plus-large",provider:"copilot-plus-jina",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0,believerExclusive:!0,dimensions:1024},{name:"copilot-plus-multilingual",provider:"copilot-plus-jina",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0,dimensions:512},{name:"text-embedding-3-small",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"text-embedding-3-large",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"embed-multilingual-light-v3.0",provider:"cohereai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"text-embedding-004",provider:"google",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"gemini-embedding-001",provider:"google",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0}],sCe="nomic-embed-text",uz={openrouterai:{label:"OpenRouter",host:"https://openrouter.ai/api/v1/",keyManagementURL:"https://openrouter.ai/keys",listModelURL:"https://openrouter.ai/api/v1/models",testModel:"openai/chatgpt-4o-latest"},google:{label:"Gemini",host:"https://generativelanguage.googleapis.com",keyManagementURL:"https://makersuite.google.com/app/apikey",listModelURL:"https://generativelanguage.googleapis.com/v1beta/models",testModel:"gemini-2.5-flash"},openai:{label:"OpenAI",host:"https://api.openai.com",keyManagementURL:"https://platform.openai.com/api-keys",listModelURL:"https://api.openai.com/v1/models",testModel:"gpt-4.1"},"azure openai":{label:"Azure OpenAI",host:"",keyManagementURL:"",listModelURL:"",testModel:"azure-openai"},anthropic:{label:"Anthropic",host:"https://api.anthropic.com/",keyManagementURL:"https://console.anthropic.com/settings/keys",listModelURL:"https://api.anthropic.com/v1/models",testModel:"claude-3-5-sonnet-latest"},cohereai:{label:"Cohere",host:"https://api.cohere.com",keyManagementURL:"https://dashboard.cohere.ai/api-keys",listModelURL:"https://api.cohere.com/v1/models",testModel:"command-r"},xai:{label:"XAI",host:"https://api.x.ai/v1",keyManagementURL:"https://console.x.ai",listModelURL:"https://api.x.ai/v1/models",testModel:"grok-3-beta"},groq:{label:"Groq",host:"https://api.groq.com/openai",keyManagementURL:"https://console.groq.com/keys",listModelURL:"https://api.groq.com/openai/v1/models",testModel:"llama3-8b-8192"},ollama:{label:"Ollama",host:"http://localhost:11434/v1/",keyManagementURL:"",listModelURL:""},"lm-studio":{label:"LM Studio",host:"http://localhost:1234/v1",keyManagementURL:"",listModelURL:""},"3rd party (openai-format)":{label:"OpenAI Format",host:"https://api.example.com/v1",keyManagementURL:"",listModelURL:""},mistralai:{label:"Mistral",host:"https://api.mistral.ai/v1",keyManagementURL:"https://console.mistral.ai/api-keys",listModelURL:"https://api.mistral.ai/v1/models",testModel:"mistral-tiny-latest"},deepseek:{label:"DeepSeek",host:"https://api.deepseek.com/",keyManagementURL:"https://platform.deepseek.com/api-keys",listModelURL:"https://api.deepseek.com/models",testModel:"deepseek-chat"},"copilot-plus":{label:"Copilot Plus",host:"https://api.brevilabs.com/v1",keyManagementURL:"",listModelURL:""},"copilot-plus-jina":{label:"Copilot Plus",host:"https://api.brevilabs.com/v1",keyManagementURL:"",listModelURL:""}},NE={anthropic:"anthropicApiKey",openai:"openAIApiKey","azure openai":"azureOpenAIApiKey",google:"googleApiKey",groq:"groqApiKey",openrouterai:"openRouterAiApiKey",cohereai:"cohereApiKey",xai:"xaiApiKey","copilot-plus":"plusLicenseKey",mistralai:"mistralApiKey",deepseek:"deepseekApiKey"},ott=["NEVER","ON STARTUP","ON MODE SWITCH"],zr={TRIGGER_QUICK_COMMAND:"trigger-quick-command",CLEAR_LOCAL_COPILOT_INDEX:"clear-local-copilot-index",CLEAR_COPILOT_CACHE:"clear-copilot-cache",COUNT_WORD_AND_TOKENS_SELECTION:"count-word-and-tokens-selection",COUNT_TOTAL_VAULT_TOKENS:"count-total-vault-tokens",DEBUG_WORD_COMPLETION:"debug-word-completion",FORCE_REINDEX_VAULT_TO_COPILOT_INDEX:"force-reindex-vault-to-copilot-index",GARBAGE_COLLECT_COPILOT_INDEX:"garbage-collect-copilot-index",INDEX_VAULT_TO_COPILOT_INDEX:"index-vault-to-copilot-index",INSPECT_COPILOT_INDEX_BY_NOTE_PATHS:"copilot-inspect-index-by-note-paths",LIST_INDEXED_FILES:"copilot-list-indexed-files",LOAD_COPILOT_CHAT_CONVERSATION:"load-copilot-chat-conversation",NEW_CHAT:"new-chat",OPEN_COPILOT_CHAT_WINDOW:"chat-open-window",REMOVE_FILES_FROM_COPILOT_INDEX:"remove-files-from-copilot-index",SEARCH_ORAMA_DB:"copilot-search-orama-db",TOGGLE_COPILOT_CHAT_WINDOW:"chat-toggle-window",TOGGLE_AUTOCOMPLETE:"toggle-autocomplete",ADD_SELECTION_TO_CHAT_CONTEXT:"add-selection-to-chat-context",ADD_CUSTOM_COMMAND:"add-custom-command",APPLY_CUSTOM_COMMAND:"apply-custom-command",OPEN_LOG_FILE:"open-log-file",CLEAR_LOG_FILE:"clear-log-file"},Dee={[zr.TRIGGER_QUICK_COMMAND]:"Trigger quick command",[zr.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[zr.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[zr.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[zr.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[zr.DEBUG_WORD_COMPLETION]:"Word completion: Debug",[zr.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[zr.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[zr.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[zr.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[zr.LIST_INDEXED_FILES]:"List all indexed files (debug)",[zr.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[zr.NEW_CHAT]:"New Copilot Chat",[zr.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[zr.REMOVE_FILES_FROM_COPILOT_INDEX]:"Remove files from Copilot index (debug)",[zr.SEARCH_ORAMA_DB]:"Search semantic index (debug)",[zr.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window",[zr.TOGGLE_AUTOCOMPLETE]:"Toggle autocomplete",[zr.ADD_SELECTION_TO_CHAT_CONTEXT]:"Add selection to chat context",[zr.ADD_CUSTOM_COMMAND]:"Add new custom command",[zr.APPLY_CUSTOM_COMMAND]:"Apply custom command",[zr.OPEN_LOG_FILE]:"Create log file",[zr.CLEAR_LOG_FILE]:"Clear log file"},Xg={DELAY_MS:600,MIN_TRIGGER_LENGTH:3,MAX_CONTEXT_LENGTH:1e4,KEYBIND:"Tab"},dz={NON_MARKDOWN_FILES_RESTRICTED:"Non-markdown files are only available in Copilot Plus mode. Please upgrade to access this file type.",URL_PROCESSING_RESTRICTED:"URL processing is only available in Copilot Plus mode. URLs will not be processed for context.",UNSUPPORTED_FILE_TYPE:t=>`${t.toUpperCase()} files are not supported in the current mode.`},za={userId:mm(),isPlusUser:!1,plusLicenseKey:"",openAIApiKey:"",openAIOrgId:"",huggingfaceApiKey:"",cohereApiKey:"",anthropicApiKey:"",azureOpenAIApiKey:"",azureOpenAIApiInstanceName:"",azureOpenAIApiDeploymentName:"",azureOpenAIApiVersion:"",azureOpenAIApiEmbeddingDeploymentName:"",googleApiKey:"",openRouterAiApiKey:"",xaiApiKey:"",mistralApiKey:"",deepseekApiKey:"",defaultChainType:"llm_chain",defaultModelKey:"google/gemini-2.5-flash|openrouterai",embeddingModelKey:"text-embedding-3-small|openai",temperature:Df.TEMPERATURE,maxTokens:Df.MAX_TOKENS,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:ITr,defaultConversationTag:"copilot-conversation",autosaveChat:!1,generateAIChatTitleOnSave:!0,includeActiveNoteAsContext:!0,defaultOpenArea:"view",customPromptsFolder:MTr,indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:rCe,qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,enableEncryption:!1,maxSourceChunks:15,groqApiKey:"",activeModels:jv,activeEmbeddingModels:Lj,embeddingRequestsPerMin:60,embeddingBatchSize:16,disableIndexOnMobile:!0,showSuggestedPrompts:!0,showRelevantNotes:!0,numPartitions:1,lexicalSearchRamLimit:100,promptUsageTimestamps:{},promptSortStrategy:"timestamp",defaultConversationNoteName:"{$topic}@{$date}_{$time}",inlineEditCommands:[],projectList:[],enableAutocomplete:!1,autocompleteAcceptKey:Xg.KEYBIND,allowAdditionalContext:!0,enableWordCompletion:!1,lastDismissedVersion:null,passMarkdownImages:!0,enableAutonomousAgent:!1,enableCustomPromptTemplating:!0,enableSemanticSearchV3:!1,enableLexicalBoosts:!0,suggestedDefaultCommands:!1,autonomousAgentMaxIterations:4,autonomousAgentEnabledToolIds:["localSearch","webSearch","pomodoro","youtubeTranscription","writeToFile","replaceInFile"],reasoningEffort:Df.REASONING_EFFORT,verbosity:Df.VERBOSITY,enableInlineCitations:!0},Qg={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change",ABORT_STREAM:"abort-stream"}});var xCe=x(Lee=>{"use strict";Lee.byteLength=NTr;Lee.toByteArray=DTr;Lee.fromByteArray=kTr;var Lv=[],ey=[],RTr=typeof Uint8Array<"u"?Uint8Array:Array,wCe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(zj=0,itt=wCe.length;zj<itt;++zj)Lv[zj]=wCe[zj],ey[wCe.charCodeAt(zj)]=zj;var zj,itt;ey[45]=62;ey[95]=63;function att(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function NTr(t){var e=att(t),r=e[0],n=e[1];return(r+n)*3/4-n}function jTr(t,e,r){return(e+r)*3/4-r}function DTr(t){var e,r=att(t),n=r[0],o=r[1],i=new RTr(jTr(t,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u<s;u+=4)e=ey[t.charCodeAt(u)]<<18|ey[t.charCodeAt(u+1)]<<12|ey[t.charCodeAt(u+2)]<<6|ey[t.charCodeAt(u+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=ey[t.charCodeAt(u)]<<2|ey[t.charCodeAt(u+1)]>>4,i[a++]=e&255),o===1&&(e=ey[t.charCodeAt(u)]<<10|ey[t.charCodeAt(u+1)]<<4|ey[t.charCodeAt(u+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function LTr(t){return Lv[t>>18&63]+Lv[t>>12&63]+Lv[t>>6&63]+Lv[t&63]}function FTr(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),o.push(LTr(n));return o.join("")}function kTr(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,s=r-n;a<s;a+=i)o.push(FTr(t,a,a+i>s?s:a+i));return n===1?(e=t[r-1],o.push(Lv[e>>2]+Lv[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(Lv[e>>10]+Lv[e>>4&63]+Lv[e<<2&63]+"=")),o.join("")}});var stt=x(SCe=>{SCe.read=function(t,e,r,n,o){var i,a,s=o*8-n-1,u=(1<<s)-1,l=u>>1,c=-7,d=r?o-1:0,f=r?-1:1,p=t[e+d];for(d+=f,i=p&(1<<-c)-1,p>>=-c,c+=s;c>0;i=i*256+t[e+d],d+=f,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=a*256+t[e+d],d+=f,c-=8);if(i===0)i=1-l;else{if(i===u)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-l}return(p?-1:1)*a*Math.pow(2,i-n)};SCe.write=function(t,e,r,n,o,i){var a,s,u,l=i*8-o-1,c=(1<<l)-1,d=c>>1,f=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,m=n?1:-1,h=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+d>=1?e+=f/u:e+=f*Math.pow(2,1-d),e*u>=2&&(a++,u/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(e*u-1)*Math.pow(2,o),a=a+d):(s=e*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;t[r+p]=s&255,p+=m,s/=256,o-=8);for(a=a<<o|s,l+=o;l>0;t[r+p]=a&255,p+=m,a/=256,l-=8);t[r+p-m]|=h*128}});var ty=x(hz=>{"use strict";var CCe=xCe(),pz=stt(),utt=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;hz.Buffer=Ce;hz.SlowBuffer=HTr;hz.INSPECT_MAX_BYTES=50;var Fee=2147483647;hz.kMaxLength=Fee;Ce.TYPED_ARRAY_SUPPORT=$Tr();!Ce.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function $Tr(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(Ce.prototype,"parent",{enumerable:!0,get:function(){if(Ce.isBuffer(this))return this.buffer}});Object.defineProperty(Ce.prototype,"offset",{enumerable:!0,get:function(){if(Ce.isBuffer(this))return this.byteOffset}});function DE(t){if(t>Fee)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,Ce.prototype),e}function Ce(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return TCe(t)}return ftt(t,e,r)}Ce.poolSize=8192;function ftt(t,e,r){if(typeof t=="string")return zTr(t,e);if(ArrayBuffer.isView(t))return UTr(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Fv(t,ArrayBuffer)||t&&Fv(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Fv(t,SharedArrayBuffer)||t&&Fv(t.buffer,SharedArrayBuffer)))return ECe(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return Ce.from(n,e,r);let o=qTr(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return Ce.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}Ce.from=function(t,e,r){return ftt(t,e,r)};Object.setPrototypeOf(Ce.prototype,Uint8Array.prototype);Object.setPrototypeOf(Ce,Uint8Array);function ptt(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function BTr(t,e,r){return ptt(t),t<=0?DE(t):e!==void 0?typeof r=="string"?DE(t).fill(e,r):DE(t).fill(e):DE(t)}Ce.alloc=function(t,e,r){return BTr(t,e,r)};function TCe(t){return ptt(t),DE(t<0?0:ACe(t)|0)}Ce.allocUnsafe=function(t){return TCe(t)};Ce.allocUnsafeSlow=function(t){return TCe(t)};function zTr(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Ce.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=mtt(t,e)|0,n=DE(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function OCe(t){let e=t.length<0?0:ACe(t.length)|0,r=DE(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function UTr(t){if(Fv(t,Uint8Array)){let e=new Uint8Array(t);return ECe(e.buffer,e.byteOffset,e.byteLength)}return OCe(t)}function ECe(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,Ce.prototype),n}function qTr(t){if(Ce.isBuffer(t)){let e=ACe(t.length)|0,r=DE(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||MCe(t.length)?DE(0):OCe(t);if(t.type==="Buffer"&&Array.isArray(t.data))return OCe(t.data)}function ACe(t){if(t>=Fee)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Fee.toString(16)+" bytes");return t|0}function HTr(t){return+t!=t&&(t=0),Ce.alloc(+t)}Ce.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==Ce.prototype};Ce.compare=function(e,r){if(Fv(e,Uint8Array)&&(e=Ce.from(e,e.offset,e.byteLength)),Fv(r,Uint8Array)&&(r=Ce.from(r,r.offset,r.byteLength)),!Ce.isBuffer(e)||!Ce.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,o=r.length;for(let i=0,a=Math.min(n,o);i<a;++i)if(e[i]!==r[i]){n=e[i],o=r[i];break}return n<o?-1:o<n?1:0};Ce.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};Ce.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return Ce.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let o=Ce.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){let a=e[n];if(Fv(a,Uint8Array))i+a.length>o.length?(Ce.isBuffer(a)||(a=Ce.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if(Ce.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function mtt(t,e){if(Ce.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Fv(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return PCe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Stt(t).length;default:if(o)return n?-1:PCe(t).length;e=(""+e).toLowerCase(),o=!0}}Ce.byteLength=mtt;function VTr(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return tAr(this,e,r);case"utf8":case"utf-8":return gtt(this,e,r);case"ascii":return QTr(this,e,r);case"latin1":case"binary":return eAr(this,e,r);case"base64":return YTr(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rAr(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}Ce.prototype._isBuffer=!0;function Uj(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}Ce.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)Uj(this,r,r+1);return this};Ce.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)Uj(this,r,r+3),Uj(this,r+1,r+2);return this};Ce.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)Uj(this,r,r+7),Uj(this,r+1,r+6),Uj(this,r+2,r+5),Uj(this,r+3,r+4);return this};Ce.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?gtt(this,0,e):VTr.apply(this,arguments)};Ce.prototype.toLocaleString=Ce.prototype.toString;Ce.prototype.equals=function(e){if(!Ce.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:Ce.compare(this,e)===0};Ce.prototype.inspect=function(){let e="",r=hz.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};utt&&(Ce.prototype[utt]=Ce.prototype.inspect);Ce.prototype.compare=function(e,r,n,o,i){if(Fv(e,Uint8Array)&&(e=Ce.from(e,e.offset,e.byteLength)),!Ce.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),i===void 0&&(i=this.length),r<0||n>e.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&r>=n)return 0;if(o>=i)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,i>>>=0,this===e)return 0;let a=i-o,s=n-r,u=Math.min(a,s),l=this.slice(o,i),c=e.slice(r,n);for(let d=0;d<u;++d)if(l[d]!==c[d]){a=l[d],s=c[d];break}return a<s?-1:s<a?1:0};function htt(t,e,r,n,o){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,MCe(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0)if(o)r=0;else return-1;if(typeof e=="string"&&(e=Ce.from(e,n)),Ce.isBuffer(e))return e.length===0?-1:ltt(t,e,r,n,o);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ltt(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function ltt(t,e,r,n,o){let i=1,a=t.length,s=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;i=2,a/=2,s/=2,r/=2}function u(c,d){return i===1?c[d]:c.readUInt16BE(d*i)}let l;if(o){let c=-1;for(l=r;l<a;l++)if(u(t,l)===u(e,c===-1?0:l-c)){if(c===-1&&(c=l),l-c+1===s)return c*i}else c!==-1&&(l-=l-c),c=-1}else for(r+s>a&&(r=a-s),l=r;l>=0;l--){let c=!0;for(let d=0;d<s;d++)if(u(t,l+d)!==u(e,d)){c=!1;break}if(c)return l}return-1}Ce.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};Ce.prototype.indexOf=function(e,r,n){return htt(this,e,r,n,!0)};Ce.prototype.lastIndexOf=function(e,r,n){return htt(this,e,r,n,!1)};function WTr(t,e,r,n){r=Number(r)||0;let o=t.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;let i=e.length;n>i/2&&(n=i/2);let a;for(a=0;a<n;++a){let s=parseInt(e.substr(a*2,2),16);if(MCe(s))return a;t[r+a]=s}return a}function KTr(t,e,r,n){return kee(PCe(e,t.length-r),t,r,n)}function GTr(t,e,r,n){return kee(aAr(e),t,r,n)}function JTr(t,e,r,n){return kee(Stt(e),t,r,n)}function ZTr(t,e,r,n){return kee(sAr(e,t.length-r),t,r,n)}Ce.prototype.write=function(e,r,n,o){if(r===void 0)o="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")o=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let i=this.length-r;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let a=!1;for(;;)switch(o){case"hex":return WTr(this,e,r,n);case"utf8":case"utf-8":return KTr(this,e,r,n);case"ascii":case"latin1":case"binary":return GTr(this,e,r,n);case"base64":return JTr(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ZTr(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};Ce.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function YTr(t,e,r){return e===0&&r===t.length?CCe.fromByteArray(t):CCe.fromByteArray(t.slice(e,r))}function gtt(t,e,r){r=Math.min(t.length,r);let n=[],o=e;for(;o<r;){let i=t[o],a=null,s=i>239?4:i>223?3:i>191?2:1;if(o+s<=r){let u,l,c,d;switch(s){case 1:i<128&&(a=i);break;case 2:u=t[o+1],(u&192)===128&&(d=(i&31)<<6|u&63,d>127&&(a=d));break;case 3:u=t[o+1],l=t[o+2],(u&192)===128&&(l&192)===128&&(d=(i&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:u=t[o+1],l=t[o+2],c=t[o+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(d=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,d>65535&&d<1114112&&(a=d))}}a===null?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),o+=s}return XTr(n)}var ctt=4096;function XTr(t){let e=t.length;if(e<=ctt)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=ctt));return r}function QTr(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]&127);return n}function eAr(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function tAr(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let o="";for(let i=e;i<r;++i)o+=uAr[t[i]];return o}function rAr(t,e,r){let n=t.slice(e,r),o="";for(let i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+n[i+1]*256);return o}Ce.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let o=this.subarray(e,r);return Object.setPrototypeOf(o,Ce.prototype),o};function Fc(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}Ce.prototype.readUintLE=Ce.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Fc(e,r,this.length);let o=this[e],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[e+a]*i;return o};Ce.prototype.readUintBE=Ce.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Fc(e,r,this.length);let o=this[e+--r],i=1;for(;r>0&&(i*=256);)o+=this[e+--r]*i;return o};Ce.prototype.readUint8=Ce.prototype.readUInt8=function(e,r){return e=e>>>0,r||Fc(e,1,this.length),this[e]};Ce.prototype.readUint16LE=Ce.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Fc(e,2,this.length),this[e]|this[e+1]<<8};Ce.prototype.readUint16BE=Ce.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Fc(e,2,this.length),this[e]<<8|this[e+1]};Ce.prototype.readUint32LE=Ce.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Fc(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};Ce.prototype.readUint32BE=Ce.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Fc(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};Ce.prototype.readBigUInt64LE=uI(function(e){e=e>>>0,mz(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&A8(e,this.length-8);let o=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(o)+(BigInt(i)<<BigInt(32))});Ce.prototype.readBigUInt64BE=uI(function(e){e=e>>>0,mz(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&A8(e,this.length-8);let o=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(o)<<BigInt(32))+BigInt(i)});Ce.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Fc(e,r,this.length);let o=this[e],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[e+a]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*r)),o};Ce.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Fc(e,r,this.length);let o=r,i=1,a=this[e+--o];for(;o>0&&(i*=256);)a+=this[e+--o]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*r)),a};Ce.prototype.readInt8=function(e,r){return e=e>>>0,r||Fc(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};Ce.prototype.readInt16LE=function(e,r){e=e>>>0,r||Fc(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};Ce.prototype.readInt16BE=function(e,r){e=e>>>0,r||Fc(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};Ce.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Fc(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};Ce.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Fc(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};Ce.prototype.readBigInt64LE=uI(function(e){e=e>>>0,mz(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&A8(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(o)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});Ce.prototype.readBigInt64BE=uI(function(e){e=e>>>0,mz(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&A8(e,this.length-8);let o=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});Ce.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Fc(e,4,this.length),pz.read(this,e,!0,23,4)};Ce.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Fc(e,4,this.length),pz.read(this,e,!1,23,4)};Ce.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Fc(e,8,this.length),pz.read(this,e,!0,52,8)};Ce.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Fc(e,8,this.length),pz.read(this,e,!1,52,8)};function Nm(t,e,r,n,o,i){if(!Ce.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}Ce.prototype.writeUintLE=Ce.prototype.writeUIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){let s=Math.pow(2,8*n)-1;Nm(this,e,r,n,s,0)}let i=1,a=0;for(this[r]=e&255;++a<n&&(i*=256);)this[r+a]=e/i&255;return r+n};Ce.prototype.writeUintBE=Ce.prototype.writeUIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){let s=Math.pow(2,8*n)-1;Nm(this,e,r,n,s,0)}let i=n-1,a=1;for(this[r+i]=e&255;--i>=0&&(a*=256);)this[r+i]=e/a&255;return r+n};Ce.prototype.writeUint8=Ce.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Nm(this,e,r,1,255,0),this[r]=e&255,r+1};Ce.prototype.writeUint16LE=Ce.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Nm(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};Ce.prototype.writeUint16BE=Ce.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Nm(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};Ce.prototype.writeUint32LE=Ce.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Nm(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};Ce.prototype.writeUint32BE=Ce.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Nm(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function ytt(t,e,r,n,o){xtt(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i=i>>8,t[r++]=i,i=i>>8,t[r++]=i,i=i>>8,t[r++]=i;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,r}function btt(t,e,r,n,o){xtt(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i=i>>8,t[r+6]=i,i=i>>8,t[r+5]=i,i=i>>8,t[r+4]=i;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a=a>>8,t[r+2]=a,a=a>>8,t[r+1]=a,a=a>>8,t[r]=a,r+8}Ce.prototype.writeBigUInt64LE=uI(function(e,r=0){return ytt(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});Ce.prototype.writeBigUInt64BE=uI(function(e,r=0){return btt(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});Ce.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Nm(this,e,r,n,u-1,-u)}let i=0,a=1,s=0;for(this[r]=e&255;++i<n&&(a*=256);)e<0&&s===0&&this[r+i-1]!==0&&(s=1),this[r+i]=(e/a>>0)-s&255;return r+n};Ce.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Nm(this,e,r,n,u-1,-u)}let i=n-1,a=1,s=0;for(this[r+i]=e&255;--i>=0&&(a*=256);)e<0&&s===0&&this[r+i+1]!==0&&(s=1),this[r+i]=(e/a>>0)-s&255;return r+n};Ce.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Nm(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};Ce.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Nm(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};Ce.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Nm(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};Ce.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Nm(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};Ce.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Nm(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};Ce.prototype.writeBigInt64LE=uI(function(e,r=0){return ytt(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});Ce.prototype.writeBigInt64BE=uI(function(e,r=0){return btt(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function _tt(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function vtt(t,e,r,n,o){return e=+e,r=r>>>0,o||_tt(t,e,r,4,34028234663852886e22,-34028234663852886e22),pz.write(t,e,r,n,23,4),r+4}Ce.prototype.writeFloatLE=function(e,r,n){return vtt(this,e,r,!0,n)};Ce.prototype.writeFloatBE=function(e,r,n){return vtt(this,e,r,!1,n)};function wtt(t,e,r,n,o){return e=+e,r=r>>>0,o||_tt(t,e,r,8,17976931348623157e292,-17976931348623157e292),pz.write(t,e,r,n,52,8),r+8}Ce.prototype.writeDoubleLE=function(e,r,n){return wtt(this,e,r,!0,n)};Ce.prototype.writeDoubleBE=function(e,r,n){return wtt(this,e,r,!1,n)};Ce.prototype.copy=function(e,r,n,o){if(!Ce.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),r>=e.length&&(r=e.length),r||(r=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-r<o-n&&(o=e.length-r+n);let i=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),r),i};Ce.prototype.fill=function(e,r,n,o){if(typeof e=="string"){if(typeof r=="string"?(o=r,r=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!Ce.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){let a=e.charCodeAt(0);(o==="utf8"&&a<128||o==="latin1")&&(e=a)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let i;if(typeof e=="number")for(i=r;i<n;++i)this[i]=e;else{let a=Ce.isBuffer(e)?e:Ce.from(e,o),s=a.length;if(s===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-r;++i)this[i+r]=a[i%s]}return this};var fz={};function ICe(t,e,r){fz[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}ICe("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ICe("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);ICe("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=dtt(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=dtt(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function dtt(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function nAr(t,e,r){mz(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&A8(e,t.length-(r+1))}function xtt(t,e,r,n,o,i){if(t>r||t<e){let a=typeof e=="bigint"?"n":"",s;throw i>3?e===0||e===BigInt(0)?s=`>= 0${a} and < 2${a} ** ${(i+1)*8}${a}`:s=`>= -(2${a} ** ${(i+1)*8-1}${a}) and < 2 ** ${(i+1)*8-1}${a}`:s=`>= ${e}${a} and <= ${r}${a}`,new fz.ERR_OUT_OF_RANGE("value",s,t)}nAr(n,o,i)}function mz(t,e){if(typeof t!="number")throw new fz.ERR_INVALID_ARG_TYPE(e,"number",t)}function A8(t,e,r){throw Math.floor(t)!==t?(mz(t,r),new fz.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new fz.ERR_BUFFER_OUT_OF_BOUNDS:new fz.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var oAr=/[^+/0-9A-Za-z-_]/g;function iAr(t){if(t=t.split("=")[0],t=t.trim().replace(oAr,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function PCe(t,e){e=e||1/0;let r,n=t.length,o=null,i=[];for(let a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return i}function aAr(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function sAr(t,e){let r,n,o,i=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function Stt(t){return CCe.toByteArray(iAr(t))}function kee(t,e,r,n){let o;for(o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function Fv(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function MCe(t){return t!==t}var uAr=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e}();function uI(t){return typeof BigInt>"u"?lAr:t}function lAr(){throw new Error("BigInt not supported")}});function I8(){return Ott.Platform.isDesktop&&$ee||($ee=require("electron")?.remote?.safeStorage),$ee}async function LCe(){return await crypto.subtle.importKey("raw",cAr,Bee.name,!1,["encrypt","decrypt"])}async function Ett(t){if(!t.enableEncryption)return t;let e={...t},r=Object.keys(t).filter(n=>n.toLowerCase().includes("apikey")||n==="plusLicenseKey");for(let n of r){let o=t[n];e[n]=await RCe(o)}return Array.isArray(t.activeModels)&&(e.activeModels=await Promise.all(t.activeModels.map(async n=>({...n,apiKey:await RCe(n.apiKey||"")})))),Array.isArray(t.activeEmbeddingModels)&&(e.activeEmbeddingModels=await Promise.all(t.activeEmbeddingModels.map(async n=>({...n,apiKey:await RCe(n.apiKey||"")})))),e}async function RCe(t){if(!t||t.startsWith(FCe))return t;Ptt(t)&&(t=t.replace(zee,""));try{if(I8()?.isEncryptionAvailable()){let o=I8().encryptString(t);return jCe+o.toString("base64")}let e=await LCe(),r=new TextEncoder().encode(t),n=await crypto.subtle.encrypt(Bee,e,r);return DCe+fAr(n)}catch(e){return console.error("Encryption failed:",e),t}}async function Co(t){if(!t||dAr(t))return t;if(Ptt(t))return t.replace(zee,"");if(t.startsWith(jCe)){let r=t.replace(jCe,""),n=NCe.Buffer.from(r,"base64");return I8().decryptString(n)}if(t.startsWith(DCe)){let r=t.replace(DCe,""),n=await LCe(),o=Ctt(r),i=await crypto.subtle.decrypt(Bee,n,o);return new TextDecoder().decode(i)}let e=t.replace(FCe,"");try{if(I8()?.isEncryptionAvailable())try{let i=NCe.Buffer.from(e,"base64");return I8().decryptString(i)}catch{}let r=await LCe(),n=Ctt(e),o=await crypto.subtle.decrypt(Bee,r,n);return new TextDecoder().decode(o)}catch(r){return console.error("Decryption failed:",r),"Copilot failed to decrypt API keys!"}}function dAr(t){return!t.startsWith(FCe)&&!t.startsWith(zee)}function Ptt(t){return t.startsWith(zee)}function fAr(t){let e=new Uint8Array(t),r="";for(let n=0;n<e.byteLength;n++)r+=String.fromCharCode(e[n]);return window.btoa(r)}function Ctt(t){let e=window.atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r.buffer}var NCe,Ott,$ee,jCe,DCe,FCe,zee,cAr,Bee,qj=b(()=>{NCe=j(ty()),Ott=require("obsidian"),$ee=null;jCe="enc_desk_",DCe="enc_web_",FCe="enc_",zee="dec_",cAr=new TextEncoder().encode("obsidian-copilot-v1"),Bee={name:"AES-GCM",iv:new Uint8Array(12)}});function Mtt(t){Gi.set(qee,t)}function Vee(){return Gi.get(qee)}function Rtt(t){return Gi.sub(qee,t)}function lI(){return QB(qee,{store:Gi})}function ry(){return Gi.get(Hee)}function Hj(t){Gi.set(Hee,t)}function Ntt(t){return Gi.sub(Hee,t)}function Dp(){return QB(Hee,{store:Gi})}function Vj(t){Gi.set(Uee,t)}function Su(){return Gi.get(Uee)}function gz(t){return Gi.sub(Uee,()=>{t(Gi.get(Uee))})}function kv(t){Gi.set(Itt,t)}function Wee(){return QB(Itt,{store:Gi})}function Wj(){return ry()==="project"}function $Ce(t){Gi.set(kCe,t)}function Kj(){return Gi.get(kCe)}function jtt(t){let e=Kj();$Ce([...e,t])}function Dtt(t){let e=Kj();$Ce(e.filter(r=>r.id!==t))}function Ltt(){$Ce([])}function Ftt(){return QB(kCe,{store:Gi})}function ktt(t){Gi.set(M8,t)}function $v(t,e){Gi.set(M8,r=>({...r,[t]:e(r[t])}))}function Kee(){return QB(M8,{store:Gi})}var Ttt,qee,Att,Hee,Uee,Itt,M8,kCe,la=b(()=>{xu();_t();b8();Ttt=Lh(null),qee=Lh(t=>{let e=t(Ttt);return e!==null?e:t(nI).defaultModelKey},(t,e,r)=>{e(Ttt,r)}),Att=Lh(null),Hee=Lh(t=>{let e=t(Att);return e!==null?e:t(nI).defaultChainType},(t,e,r)=>{e(Att,r)}),Uee=Lh(null),Itt=Lh(!1),M8=Lh({success:[],failed:[],processingFiles:[],total:[]}),kCe=Lh([])});var Gtt=x(ca=>{"use strict";function qCe(t,e){var r=t.length;t.push(e);e:for(;0<r;){var n=r-1>>>1,o=t[n];if(0<Gee(o,e))t[n]=e,t[r]=o,r=n;else break e}}function Bb(t){return t.length===0?null:t[0]}function Zee(t){if(t.length===0)return null;var e=t[0],r=t.pop();if(r!==e){t[0]=r;e:for(var n=0,o=t.length,i=o>>>1;n<i;){var a=2*(n+1)-1,s=t[a],u=a+1,l=t[u];if(0>Gee(s,r))u<o&&0>Gee(l,s)?(t[n]=l,t[u]=r,n=u):(t[n]=s,t[a]=r,n=a);else if(u<o&&0>Gee(l,r))t[n]=l,t[u]=r,n=u;else break e}}return e}function Gee(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?($tt=performance,ca.unstable_now=function(){return $tt.now()}):(BCe=Date,Btt=BCe.now(),ca.unstable_now=function(){return BCe.now()-Btt});var $tt,BCe,Btt,Bv=[],cI=[],pAr=1,ny=null,Lf=3,Yee=!1,Gj=!1,N8=!1,qtt=typeof setTimeout=="function"?setTimeout:null,Htt=typeof clearTimeout=="function"?clearTimeout:null,ztt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function HCe(t){for(var e=Bb(cI);e!==null;){if(e.callback===null)Zee(cI);else if(e.startTime<=t)Zee(cI),e.sortIndex=e.expirationTime,qCe(Bv,e);else break;e=Bb(cI)}}function VCe(t){if(N8=!1,HCe(t),!Gj)if(Bb(Bv)!==null)Gj=!0,KCe(WCe);else{var e=Bb(cI);e!==null&&GCe(VCe,e.startTime-t)}}function WCe(t,e){Gj=!1,N8&&(N8=!1,Htt(j8),j8=-1),Yee=!0;var r=Lf;try{for(HCe(e),ny=Bb(Bv);ny!==null&&(!(ny.expirationTime>e)||t&&!Ktt());){var n=ny.callback;if(typeof n=="function"){ny.callback=null,Lf=ny.priorityLevel;var o=n(ny.expirationTime<=e);e=ca.unstable_now(),typeof o=="function"?ny.callback=o:ny===Bb(Bv)&&Zee(Bv),HCe(e)}else Zee(Bv);ny=Bb(Bv)}if(ny!==null)var i=!0;else{var a=Bb(cI);a!==null&&GCe(VCe,a.startTime-e),i=!1}return i}finally{ny=null,Lf=r,Yee=!1}}var Xee=!1,Jee=null,j8=-1,Vtt=5,Wtt=-1;function Ktt(){return!(ca.unstable_now()-Wtt<Vtt)}function zCe(){if(Jee!==null){var t=ca.unstable_now();Wtt=t;var e=!0;try{e=Jee(!0,t)}finally{e?R8():(Xee=!1,Jee=null)}}else Xee=!1}var R8;typeof ztt=="function"?R8=function(){ztt(zCe)}:typeof MessageChannel<"u"?(UCe=new MessageChannel,Utt=UCe.port2,UCe.port1.onmessage=zCe,R8=function(){Utt.postMessage(null)}):R8=function(){qtt(zCe,0)};var UCe,Utt;function KCe(t){Jee=t,Xee||(Xee=!0,R8())}function GCe(t,e){j8=qtt(function(){t(ca.unstable_now())},e)}ca.unstable_IdlePriority=5;ca.unstable_ImmediatePriority=1;ca.unstable_LowPriority=4;ca.unstable_NormalPriority=3;ca.unstable_Profiling=null;ca.unstable_UserBlockingPriority=2;ca.unstable_cancelCallback=function(t){t.callback=null};ca.unstable_continueExecution=function(){Gj||Yee||(Gj=!0,KCe(WCe))};ca.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Vtt=0<t?Math.floor(1e3/t):5};ca.unstable_getCurrentPriorityLevel=function(){return Lf};ca.unstable_getFirstCallbackNode=function(){return Bb(Bv)};ca.unstable_next=function(t){switch(Lf){case 1:case 2:case 3:var e=3;break;default:e=Lf}var r=Lf;Lf=e;try{return t()}finally{Lf=r}};ca.unstable_pauseExecution=function(){};ca.unstable_requestPaint=function(){};ca.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=Lf;Lf=t;try{return e()}finally{Lf=r}};ca.unstable_scheduleCallback=function(t,e,r){var n=ca.unstable_now();switch(typeof r=="object"&&r!==null?(r=r.delay,r=typeof r=="number"&&0<r?n+r:n):r=n,t){case 1:var o=-1;break;case 2:o=250;break;case 5:o=1073741823;break;case 4:o=1e4;break;default:o=5e3}return o=r+o,t={id:pAr++,callback:e,priorityLevel:t,startTime:r,expirationTime:o,sortIndex:-1},r>n?(t.sortIndex=r,qCe(cI,t),Bb(Bv)===null&&t===Bb(cI)&&(N8?(Htt(j8),j8=-1):N8=!0,GCe(VCe,r-n))):(t.sortIndex=o,qCe(Bv,t),Gj||Yee||(Gj=!0,KCe(WCe))),t};ca.unstable_shouldYield=Ktt;ca.unstable_wrapCallback=function(t){var e=Lf;return function(){var r=Lf;Lf=e;try{return t.apply(this,arguments)}finally{Lf=r}}}});var Ztt=x((Iuo,Jtt)=>{"use strict";Jtt.exports=Gtt()});var rit=x(qh=>{"use strict";var nnt=Z(),zh=Ztt();function qe(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)e+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var ont=new Set,r5={};function sD(t,e){Fz(t,e),Fz(t+"Capture",e)}function Fz(t,e){for(r5[t]=e,t=0;t<e.length;t++)ont.add(e[t])}var zE=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yOe=Object.prototype.hasOwnProperty,mAr=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Ytt={},Xtt={};function hAr(t){return yOe.call(Xtt,t)?!0:yOe.call(Ytt,t)?!1:mAr.test(t)?Xtt[t]=!0:(Ytt[t]=!0,!1)}function gAr(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function yAr(t,e,r,n){if(e===null||typeof e>"u"||gAr(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function kp(t,e,r,n,o,i,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=o,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=a}var Td={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Td[t]=new kp(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Td[e]=new kp(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Td[t]=new kp(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Td[t]=new kp(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Td[t]=new kp(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Td[t]=new kp(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Td[t]=new kp(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Td[t]=new kp(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Td[t]=new kp(t,5,!1,t.toLowerCase(),null,!1,!1)});var lEe=/[\-:]([a-z])/g;function cEe(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(lEe,cEe);Td[e]=new kp(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(lEe,cEe);Td[e]=new kp(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(lEe,cEe);Td[e]=new kp(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Td[t]=new kp(t,1,!1,t.toLowerCase(),null,!1,!1)});Td.xlinkHref=new kp("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Td[t]=new kp(t,1,!1,t.toLowerCase(),null,!0,!0)});function dEe(t,e,r,n){var o=Td.hasOwnProperty(e)?Td[e]:null;(o!==null?o.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(yAr(e,r,o,n)&&(r=null),n||o===null?hAr(e)&&(r===null?t.removeAttribute(e):t.setAttribute(e,""+r)):o.mustUseProperty?t[o.propertyName]=r===null?o.type===3?!1:"":r:(e=o.attributeName,n=o.attributeNamespace,r===null?t.removeAttribute(e):(o=o.type,r=o===3||o===4&&r===!0?"":""+r,n?t.setAttributeNS(n,e,r):t.setAttribute(e,r))))}var VE=nnt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Qee=Symbol.for("react.element"),_z=Symbol.for("react.portal"),vz=Symbol.for("react.fragment"),fEe=Symbol.for("react.strict_mode"),bOe=Symbol.for("react.profiler"),int=Symbol.for("react.provider"),ant=Symbol.for("react.context"),pEe=Symbol.for("react.forward_ref"),_Oe=Symbol.for("react.suspense"),vOe=Symbol.for("react.suspense_list"),mEe=Symbol.for("react.memo"),fI=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var snt=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var Qtt=Symbol.iterator;function D8(t){return t===null||typeof t!="object"?null:(t=Qtt&&t[Qtt]||t["@@iterator"],typeof t=="function"?t:null)}var cs=Object.assign,JCe;function q8(t){if(JCe===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);JCe=e&&e[1]||""}return`
`+JCe+t}var ZCe=!1;function YCe(t,e){if(!t||ZCe)return"";ZCe=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(l){var n=l}Reflect.construct(t,[],e)}else{try{e.call()}catch(l){n=l}t.call(e.prototype)}else{try{throw Error()}catch(l){n=l}t()}}catch(l){if(l&&n&&typeof l.stack=="string"){for(var o=l.stack.split(`
`),i=n.stack.split(`
`),a=o.length-1,s=i.length-1;1<=a&&0<=s&&o[a]!==i[s];)s--;for(;1<=a&&0<=s;a--,s--)if(o[a]!==i[s]){if(a!==1||s!==1)do if(a--,s--,0>s||o[a]!==i[s]){var u=`
`+o[a].replace(" at new "," at ");return t.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",t.displayName)),u}while(1<=a&&0<=s);break}}}finally{ZCe=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?q8(t):""}function bAr(t){switch(t.tag){case 5:return q8(t.type);case 16:return q8("Lazy");case 13:return q8("Suspense");case 19:return q8("SuspenseList");case 0:case 2:case 15:return t=YCe(t.type,!1),t;case 11:return t=YCe(t.type.render,!1),t;case 1:return t=YCe(t.type,!0),t;default:return""}}function wOe(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case vz:return"Fragment";case _z:return"Portal";case bOe:return"Profiler";case fEe:return"StrictMode";case _Oe:return"Suspense";case vOe:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case ant:return(t.displayName||"Context")+".Consumer";case int:return(t._context.displayName||"Context")+".Provider";case pEe:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case mEe:return e=t.displayName||null,e!==null?e:wOe(t.type)||"Memo";case fI:e=t._payload,t=t._init;try{return wOe(t(e))}catch{}}return null}function _Ar(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return wOe(e);case 8:return e===fEe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function EI(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function unt(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function vAr(t){var e=unt(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,i=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return o.call(this)},set:function(a){n=""+a,i.call(this,a)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function ete(t){t._valueTracker||(t._valueTracker=vAr(t))}function lnt(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=unt(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Tte(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function xOe(t,e){var r=e.checked;return cs({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function ert(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=EI(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function cnt(t,e){e=e.checked,e!=null&&dEe(t,"checked",e,!1)}function SOe(t,e){cnt(t,e);var r=EI(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?COe(t,e.type,r):e.hasOwnProperty("defaultValue")&&COe(t,e.type,EI(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function trt(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function COe(t,e,r){(e!=="number"||Tte(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var H8=Array.isArray;function Mz(t,e,r,n){if(t=t.options,e){e={};for(var o=0;o<r.length;o++)e["$"+r[o]]=!0;for(r=0;r<t.length;r++)o=e.hasOwnProperty("$"+t[r].value),t[r].selected!==o&&(t[r].selected=o),o&&n&&(t[r].defaultSelected=!0)}else{for(r=""+EI(r),e=null,o=0;o<t.length;o++){if(t[o].value===r){t[o].selected=!0,n&&(t[o].defaultSelected=!0);return}e!==null||t[o].disabled||(e=t[o])}e!==null&&(e.selected=!0)}}function OOe(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(qe(91));return cs({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function rrt(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(qe(92));if(H8(r)){if(1<r.length)throw Error(qe(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:EI(r)}}function dnt(t,e){var r=EI(e.value),n=EI(e.defaultValue);r!=null&&(r=""+r,r!==t.value&&(t.value=r),e.defaultValue==null&&t.defaultValue!==r&&(t.defaultValue=r)),n!=null&&(t.defaultValue=""+n)}function nrt(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function fnt(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function EOe(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?fnt(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var tte,pnt=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,r,n,o){MSApp.execUnsafeLocalFunction(function(){return t(e,r,n,o)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(tte=tte||document.createElement("div"),tte.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=tte.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function n5(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var K8={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},wAr=["Webkit","ms","Moz","O"];Object.keys(K8).forEach(function(t){wAr.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),K8[e]=K8[t]})});function mnt(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||K8.hasOwnProperty(t)&&K8[t]?(""+e).trim():e+"px"}function hnt(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=mnt(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,o):t[r]=o}}var xAr=cs({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function POe(t,e){if(e){if(xAr[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(qe(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(qe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(qe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(qe(62))}}function TOe(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var AOe=null;function hEe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var IOe=null,Rz=null,Nz=null;function ort(t){if(t=w5(t)){if(typeof IOe!="function")throw Error(qe(280));var e=t.stateNode;e&&(e=rre(e),IOe(t.stateNode,t.type,e))}}function gnt(t){Rz?Nz?Nz.push(t):Nz=[t]:Rz=t}function ynt(){if(Rz){var t=Rz,e=Nz;if(Nz=Rz=null,ort(t),e)for(t=0;t<e.length;t++)ort(e[t])}}function bnt(t,e){return t(e)}function _nt(){}var XCe=!1;function vnt(t,e,r){if(XCe)return t(e,r);XCe=!0;try{return bnt(t,e,r)}finally{XCe=!1,(Rz!==null||Nz!==null)&&(_nt(),ynt())}}function o5(t,e){var r=t.stateNode;if(r===null)return null;var n=rre(r);if(n===null)return null;r=n[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(t=t.type,n=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!n;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(qe(231,e,typeof r));return r}var MOe=!1;if(zE)try{yz={},Object.defineProperty(yz,"passive",{get:function(){MOe=!0}}),window.addEventListener("test",yz,yz),window.removeEventListener("test",yz,yz)}catch{MOe=!1}var yz;function SAr(t,e,r,n,o,i,a,s,u){var l=Array.prototype.slice.call(arguments,3);try{e.apply(r,l)}catch(c){this.onError(c)}}var G8=!1,Ate=null,Ite=!1,ROe=null,CAr={onError:function(t){G8=!0,Ate=t}};function OAr(t,e,r,n,o,i,a,s,u){G8=!1,Ate=null,SAr.apply(CAr,arguments)}function EAr(t,e,r,n,o,i,a,s,u){if(OAr.apply(this,arguments),G8){if(G8){var l=Ate;G8=!1,Ate=null}else throw Error(qe(198));Ite||(Ite=!0,ROe=l)}}function uD(t){var e=t,r=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,(e.flags&4098)!==0&&(r=e.return),t=e.return;while(t)}return e.tag===3?r:null}function wnt(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function irt(t){if(uD(t)!==t)throw Error(qe(188))}function PAr(t){var e=t.alternate;if(!e){if(e=uD(t),e===null)throw Error(qe(188));return e!==t?null:t}for(var r=t,n=e;;){var o=r.return;if(o===null)break;var i=o.alternate;if(i===null){if(n=o.return,n!==null){r=n;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===r)return irt(o),t;if(i===n)return irt(o),e;i=i.sibling}throw Error(qe(188))}if(r.return!==n.return)r=o,n=i;else{for(var a=!1,s=o.child;s;){if(s===r){a=!0,r=o,n=i;break}if(s===n){a=!0,n=o,r=i;break}s=s.sibling}if(!a){for(s=i.child;s;){if(s===r){a=!0,r=i,n=o;break}if(s===n){a=!0,n=i,r=o;break}s=s.sibling}if(!a)throw Error(qe(189))}}if(r.alternate!==n)throw Error(qe(190))}if(r.tag!==3)throw Error(qe(188));return r.stateNode.current===r?t:e}function xnt(t){return t=PAr(t),t!==null?Snt(t):null}function Snt(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Snt(t);if(e!==null)return e;t=t.sibling}return null}var Cnt=zh.unstable_scheduleCallback,art=zh.unstable_cancelCallback,TAr=zh.unstable_shouldYield,AAr=zh.unstable_requestPaint,ou=zh.unstable_now,IAr=zh.unstable_getCurrentPriorityLevel,gEe=zh.unstable_ImmediatePriority,Ont=zh.unstable_UserBlockingPriority,Mte=zh.unstable_NormalPriority,MAr=zh.unstable_LowPriority,Ent=zh.unstable_IdlePriority,Xte=null,Hv=null;function RAr(t){if(Hv&&typeof Hv.onCommitFiberRoot=="function")try{Hv.onCommitFiberRoot(Xte,t,void 0,(t.current.flags&128)===128)}catch{}}var Vb=Math.clz32?Math.clz32:DAr,NAr=Math.log,jAr=Math.LN2;function DAr(t){return t>>>=0,t===0?32:31-(NAr(t)/jAr|0)|0}var rte=64,nte=4194304;function V8(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Rte(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,o=t.suspendedLanes,i=t.pingedLanes,a=r&268435455;if(a!==0){var s=a&~o;s!==0?n=V8(s):(i&=a,i!==0&&(n=V8(i)))}else a=r&~o,a!==0?n=V8(a):i!==0&&(n=V8(i));if(n===0)return 0;if(e!==0&&e!==n&&(e&o)===0&&(o=n&-n,i=e&-e,o>=i||o===16&&(i&4194240)!==0))return e;if((n&4)!==0&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0<e;)r=31-Vb(e),o=1<<r,n|=t[r],e&=~o;return n}function LAr(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function FAr(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var a=31-Vb(i),s=1<<a,u=o[a];u===-1?((s&r)===0||(s&n)!==0)&&(o[a]=LAr(s,e)):u<=e&&(t.expiredLanes|=s),i&=~s}}function NOe(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Pnt(){var t=rte;return rte<<=1,(rte&4194240)===0&&(rte=64),t}function QCe(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function _5(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Vb(e),t[e]=r}function kAr(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0<r;){var o=31-Vb(r),i=1<<o;e[o]=0,n[o]=-1,t[o]=-1,r&=~i}}function yEe(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-Vb(r),o=1<<n;o&e|t[n]&e&&(t[n]|=e),r&=~o}}var ki=0;function Tnt(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var Ant,bEe,Int,Mnt,Rnt,jOe=!1,ote=[],bI=null,_I=null,vI=null,i5=new Map,a5=new Map,mI=[],$Ar="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function srt(t,e){switch(t){case"focusin":case"focusout":bI=null;break;case"dragenter":case"dragleave":_I=null;break;case"mouseover":case"mouseout":vI=null;break;case"pointerover":case"pointerout":i5.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":a5.delete(e.pointerId)}}function L8(t,e,r,n,o,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:r,eventSystemFlags:n,nativeEvent:i,targetContainers:[o]},e!==null&&(e=w5(e),e!==null&&bEe(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function BAr(t,e,r,n,o){switch(e){case"focusin":return bI=L8(bI,t,e,r,n,o),!0;case"dragenter":return _I=L8(_I,t,e,r,n,o),!0;case"mouseover":return vI=L8(vI,t,e,r,n,o),!0;case"pointerover":var i=o.pointerId;return i5.set(i,L8(i5.get(i)||null,t,e,r,n,o)),!0;case"gotpointercapture":return i=o.pointerId,a5.set(i,L8(a5.get(i)||null,t,e,r,n,o)),!0}return!1}function Nnt(t){var e=Yj(t.target);if(e!==null){var r=uD(e);if(r!==null){if(e=r.tag,e===13){if(e=wnt(r),e!==null){t.blockedOn=e,Rnt(t.priority,function(){Int(r)});return}}else if(e===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function bte(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=DOe(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);AOe=n,r.target.dispatchEvent(n),AOe=null}else return e=w5(r),e!==null&&bEe(e),t.blockedOn=r,!1;e.shift()}return!0}function urt(t,e,r){bte(t)&&r.delete(e)}function zAr(){jOe=!1,bI!==null&&bte(bI)&&(bI=null),_I!==null&&bte(_I)&&(_I=null),vI!==null&&bte(vI)&&(vI=null),i5.forEach(urt),a5.forEach(urt)}function F8(t,e){t.blockedOn===e&&(t.blockedOn=null,jOe||(jOe=!0,zh.unstable_scheduleCallback(zh.unstable_NormalPriority,zAr)))}function s5(t){function e(o){return F8(o,t)}if(0<ote.length){F8(ote[0],t);for(var r=1;r<ote.length;r++){var n=ote[r];n.blockedOn===t&&(n.blockedOn=null)}}for(bI!==null&&F8(bI,t),_I!==null&&F8(_I,t),vI!==null&&F8(vI,t),i5.forEach(e),a5.forEach(e),r=0;r<mI.length;r++)n=mI[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<mI.length&&(r=mI[0],r.blockedOn===null);)Nnt(r),r.blockedOn===null&&mI.shift()}var jz=VE.ReactCurrentBatchConfig,Nte=!0;function UAr(t,e,r,n){var o=ki,i=jz.transition;jz.transition=null;try{ki=1,_Ee(t,e,r,n)}finally{ki=o,jz.transition=i}}function qAr(t,e,r,n){var o=ki,i=jz.transition;jz.transition=null;try{ki=4,_Ee(t,e,r,n)}finally{ki=o,jz.transition=i}}function _Ee(t,e,r,n){if(Nte){var o=DOe(t,e,r,n);if(o===null)aOe(t,e,n,jte,r),srt(t,n);else if(BAr(o,t,e,r,n))n.stopPropagation();else if(srt(t,n),e&4&&-1<$Ar.indexOf(t)){for(;o!==null;){var i=w5(o);if(i!==null&&Ant(i),i=DOe(t,e,r,n),i===null&&aOe(t,e,n,jte,r),i===o)break;o=i}o!==null&&n.stopPropagation()}else aOe(t,e,n,null,r)}}var jte=null;function DOe(t,e,r,n){if(jte=null,t=hEe(n),t=Yj(t),t!==null)if(e=uD(t),e===null)t=null;else if(r=e.tag,r===13){if(t=wnt(e),t!==null)return t;t=null}else if(r===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return jte=t,null}function jnt(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(IAr()){case gEe:return 1;case Ont:return 4;case Mte:case MAr:return 16;case Ent:return 536870912;default:return 16}default:return 16}}var gI=null,vEe=null,_te=null;function Dnt(){if(_te)return _te;var t,e=vEe,r=e.length,n,o="value"in gI?gI.value:gI.textContent,i=o.length;for(t=0;t<r&&e[t]===o[t];t++);var a=r-t;for(n=1;n<=a&&e[r-n]===o[i-n];n++);return _te=o.slice(t,1<n?1-n:void 0)}function vte(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function ite(){return!0}function lrt(){return!1}function Uh(t){function e(r,n,o,i,a){this._reactName=r,this._targetInst=o,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var s in t)t.hasOwnProperty(s)&&(r=t[s],this[s]=r?r(i):i[s]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?ite:lrt,this.isPropagationStopped=lrt,this}return cs(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=ite)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=ite)},persist:function(){},isPersistent:ite}),e}var Hz={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wEe=Uh(Hz),v5=cs({},Hz,{view:0,detail:0}),HAr=Uh(v5),eOe,tOe,k8,Qte=cs({},v5,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xEe,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==k8&&(k8&&t.type==="mousemove"?(eOe=t.screenX-k8.screenX,tOe=t.screenY-k8.screenY):tOe=eOe=0,k8=t),eOe)},movementY:function(t){return"movementY"in t?t.movementY:tOe}}),crt=Uh(Qte),VAr=cs({},Qte,{dataTransfer:0}),WAr=Uh(VAr),KAr=cs({},v5,{relatedTarget:0}),rOe=Uh(KAr),GAr=cs({},Hz,{animationName:0,elapsedTime:0,pseudoElement:0}),JAr=Uh(GAr),ZAr=cs({},Hz,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),YAr=Uh(ZAr),XAr=cs({},Hz,{data:0}),drt=Uh(XAr),QAr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},eIr={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},tIr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rIr(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=tIr[t])?!!e[t]:!1}function xEe(){return rIr}var nIr=cs({},v5,{key:function(t){if(t.key){var e=QAr[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=vte(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?eIr[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xEe,charCode:function(t){return t.type==="keypress"?vte(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?vte(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),oIr=Uh(nIr),iIr=cs({},Qte,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),frt=Uh(iIr),aIr=cs({},v5,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xEe}),sIr=Uh(aIr),uIr=cs({},Hz,{propertyName:0,elapsedTime:0,pseudoElement:0}),lIr=Uh(uIr),cIr=cs({},Qte,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),dIr=Uh(cIr),fIr=[9,13,27,32],SEe=zE&&"CompositionEvent"in window,J8=null;zE&&"documentMode"in document&&(J8=document.documentMode);var pIr=zE&&"TextEvent"in window&&!J8,Lnt=zE&&(!SEe||J8&&8<J8&&11>=J8),prt=" ",mrt=!1;function Fnt(t,e){switch(t){case"keyup":return fIr.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function knt(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var wz=!1;function mIr(t,e){switch(t){case"compositionend":return knt(e);case"keypress":return e.which!==32?null:(mrt=!0,prt);case"textInput":return t=e.data,t===prt&&mrt?null:t;default:return null}}function hIr(t,e){if(wz)return t==="compositionend"||!SEe&&Fnt(t,e)?(t=Dnt(),_te=vEe=gI=null,wz=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Lnt&&e.locale!=="ko"?null:e.data;default:return null}}var gIr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function hrt(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!gIr[t.type]:e==="textarea"}function $nt(t,e,r,n){gnt(n),e=Dte(e,"onChange"),0<e.length&&(r=new wEe("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var Z8=null,u5=null;function yIr(t){Znt(t,0)}function ere(t){var e=Cz(t);if(lnt(e))return t}function bIr(t,e){if(t==="change")return e}var Bnt=!1;zE&&(zE?(ste="oninput"in document,ste||(nOe=document.createElement("div"),nOe.setAttribute("oninput","return;"),ste=typeof nOe.oninput=="function"),ate=ste):ate=!1,Bnt=ate&&(!document.documentMode||9<document.documentMode));var ate,ste,nOe;function grt(){Z8&&(Z8.detachEvent("onpropertychange",znt),u5=Z8=null)}function znt(t){if(t.propertyName==="value"&&ere(u5)){var e=[];$nt(e,u5,t,hEe(t)),vnt(yIr,e)}}function _Ir(t,e,r){t==="focusin"?(grt(),Z8=e,u5=r,Z8.attachEvent("onpropertychange",znt)):t==="focusout"&&grt()}function vIr(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ere(u5)}function wIr(t,e){if(t==="click")return ere(e)}function xIr(t,e){if(t==="input"||t==="change")return ere(e)}function SIr(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Kb=typeof Object.is=="function"?Object.is:SIr;function l5(t,e){if(Kb(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var o=r[n];if(!yOe.call(e,o)||!Kb(t[o],e[o]))return!1}return!0}function yrt(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function brt(t,e){var r=yrt(t);t=0;for(var n;r;){if(r.nodeType===3){if(n=t+r.textContent.length,t<=e&&n>=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=yrt(r)}}function Unt(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Unt(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function qnt(){for(var t=window,e=Tte();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Tte(t.document)}return e}function CEe(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function CIr(t){var e=qnt(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&Unt(r.ownerDocument.documentElement,r)){if(n!==null&&CEe(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var o=r.textContent.length,i=Math.min(n.start,o);n=n.end===void 0?i:Math.min(n.end,o),!t.extend&&i>n&&(o=n,n=i,i=o),o=brt(r,i);var a=brt(r,n);o&&a&&(t.rangeCount!==1||t.anchorNode!==o.node||t.anchorOffset!==o.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(o.node,o.offset),t.removeAllRanges(),i>n?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<e.length;r++)t=e[r],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var OIr=zE&&"documentMode"in document&&11>=document.documentMode,xz=null,LOe=null,Y8=null,FOe=!1;function _rt(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;FOe||xz==null||xz!==Tte(n)||(n=xz,"selectionStart"in n&&CEe(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Y8&&l5(Y8,n)||(Y8=n,n=Dte(LOe,"onSelect"),0<n.length&&(e=new wEe("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=xz)))}function ute(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var Sz={animationend:ute("Animation","AnimationEnd"),animationiteration:ute("Animation","AnimationIteration"),animationstart:ute("Animation","AnimationStart"),transitionend:ute("Transition","TransitionEnd")},oOe={},Hnt={};zE&&(Hnt=document.createElement("div").style,"AnimationEvent"in window||(delete Sz.animationend.animation,delete Sz.animationiteration.animation,delete Sz.animationstart.animation),"TransitionEvent"in window||delete Sz.transitionend.transition);function tre(t){if(oOe[t])return oOe[t];if(!Sz[t])return t;var e=Sz[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in Hnt)return oOe[t]=e[r];return t}var Vnt=tre("animationend"),Wnt=tre("animationiteration"),Knt=tre("animationstart"),Gnt=tre("transitionend"),Jnt=new Map,vrt="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function TI(t,e){Jnt.set(t,e),sD(e,[t])}for(lte=0;lte<vrt.length;lte++)cte=vrt[lte],wrt=cte.toLowerCase(),xrt=cte[0].toUpperCase()+cte.slice(1),TI(wrt,"on"+xrt);var cte,wrt,xrt,lte;TI(Vnt,"onAnimationEnd");TI(Wnt,"onAnimationIteration");TI(Knt,"onAnimationStart");TI("dblclick","onDoubleClick");TI("focusin","onFocus");TI("focusout","onBlur");TI(Gnt,"onTransitionEnd");Fz("onMouseEnter",["mouseout","mouseover"]);Fz("onMouseLeave",["mouseout","mouseover"]);Fz("onPointerEnter",["pointerout","pointerover"]);Fz("onPointerLeave",["pointerout","pointerover"]);sD("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));sD("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));sD("onBeforeInput",["compositionend","keypress","textInput","paste"]);sD("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));sD("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));sD("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var W8="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),EIr=new Set("cancel close invalid load scroll toggle".split(" ").concat(W8));function Srt(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,EAr(n,e,void 0,t),t.currentTarget=null}function Znt(t,e){e=(e&4)!==0;for(var r=0;r<t.length;r++){var n=t[r],o=n.event;n=n.listeners;e:{var i=void 0;if(e)for(var a=n.length-1;0<=a;a--){var s=n[a],u=s.instance,l=s.currentTarget;if(s=s.listener,u!==i&&o.isPropagationStopped())break e;Srt(o,s,l),i=u}else for(a=0;a<n.length;a++){if(s=n[a],u=s.instance,l=s.currentTarget,s=s.listener,u!==i&&o.isPropagationStopped())break e;Srt(o,s,l),i=u}}}if(Ite)throw t=ROe,Ite=!1,ROe=null,t}function xa(t,e){var r=e[UOe];r===void 0&&(r=e[UOe]=new Set);var n=t+"__bubble";r.has(n)||(Ynt(e,t,2,!1),r.add(n))}function iOe(t,e,r){var n=0;e&&(n|=4),Ynt(r,t,n,e)}var dte="_reactListening"+Math.random().toString(36).slice(2);function c5(t){if(!t[dte]){t[dte]=!0,ont.forEach(function(r){r!=="selectionchange"&&(EIr.has(r)||iOe(r,!1,t),iOe(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[dte]||(e[dte]=!0,iOe("selectionchange",!1,e))}}function Ynt(t,e,r,n){switch(jnt(e)){case 1:var o=UAr;break;case 4:o=qAr;break;default:o=_Ee}r=o.bind(null,e,r,t),o=void 0,!MOe||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(o=!0),n?o!==void 0?t.addEventListener(e,r,{capture:!0,passive:o}):t.addEventListener(e,r,!0):o!==void 0?t.addEventListener(e,r,{passive:o}):t.addEventListener(e,r,!1)}function aOe(t,e,r,n,o){var i=n;if((e&1)===0&&(e&2)===0&&n!==null)e:for(;;){if(n===null)return;var a=n.tag;if(a===3||a===4){var s=n.stateNode.containerInfo;if(s===o||s.nodeType===8&&s.parentNode===o)break;if(a===4)for(a=n.return;a!==null;){var u=a.tag;if((u===3||u===4)&&(u=a.stateNode.containerInfo,u===o||u.nodeType===8&&u.parentNode===o))return;a=a.return}for(;s!==null;){if(a=Yj(s),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}s=s.parentNode}}n=n.return}vnt(function(){var l=i,c=hEe(r),d=[];e:{var f=Jnt.get(t);if(f!==void 0){var p=wEe,m=t;switch(t){case"keypress":if(vte(r)===0)break e;case"keydown":case"keyup":p=oIr;break;case"focusin":m="focus",p=rOe;break;case"focusout":m="blur",p=rOe;break;case"beforeblur":case"afterblur":p=rOe;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=crt;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=WAr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=sIr;break;case Vnt:case Wnt:case Knt:p=JAr;break;case Gnt:p=lIr;break;case"scroll":p=HAr;break;case"wheel":p=dIr;break;case"copy":case"cut":case"paste":p=YAr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=frt}var h=(e&4)!==0,y=!h&&t==="scroll",g=h?f!==null?f+"Capture":null:f;h=[];for(var _=l,w;_!==null;){w=_;var S=w.stateNode;if(w.tag===5&&S!==null&&(w=S,g!==null&&(S=o5(_,g),S!=null&&h.push(d5(_,S,w)))),y)break;_=_.return}0<h.length&&(f=new p(f,m,null,r,c),d.push({event:f,listeners:h}))}}if((e&7)===0){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&r!==AOe&&(m=r.relatedTarget||r.fromElement)&&(Yj(m)||m[UE]))break e;if((p||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=r.relatedTarget||r.toElement,p=l,m=m?Yj(m):null,m!==null&&(y=uD(m),m!==y||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=l),p!==m)){if(h=crt,S="onMouseLeave",g="onMouseEnter",_="mouse",(t==="pointerout"||t==="pointerover")&&(h=frt,S="onPointerLeave",g="onPointerEnter",_="pointer"),y=p==null?f:Cz(p),w=m==null?f:Cz(m),f=new h(S,_+"leave",p,r,c),f.target=y,f.relatedTarget=w,S=null,Yj(c)===l&&(h=new h(g,_+"enter",m,r,c),h.target=w,h.relatedTarget=y,S=h),y=S,p&&m)t:{for(h=p,g=m,_=0,w=h;w;w=bz(w))_++;for(w=0,S=g;S;S=bz(S))w++;for(;0<_-w;)h=bz(h),_--;for(;0<w-_;)g=bz(g),w--;for(;_--;){if(h===g||g!==null&&h===g.alternate)break t;h=bz(h),g=bz(g)}h=null}else h=null;p!==null&&Crt(d,f,p,h,!1),m!==null&&y!==null&&Crt(d,y,m,h,!0)}}e:{if(f=l?Cz(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var C=bIr;else if(hrt(f))if(Bnt)C=xIr;else{C=vIr;var E=_Ir}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(C=wIr);if(C&&(C=C(t,l))){$nt(d,C,r,c);break e}E&&E(t,f,l),t==="focusout"&&(E=f._wrapperState)&&E.controlled&&f.type==="number"&&COe(f,"number",f.value)}switch(E=l?Cz(l):window,t){case"focusin":(hrt(E)||E.contentEditable==="true")&&(xz=E,LOe=l,Y8=null);break;case"focusout":Y8=LOe=xz=null;break;case"mousedown":FOe=!0;break;case"contextmenu":case"mouseup":case"dragend":FOe=!1,_rt(d,r,c);break;case"selectionchange":if(OIr)break;case"keydown":case"keyup":_rt(d,r,c)}var P;if(SEe)e:{switch(t){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else wz?Fnt(t,r)&&(T="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(T="onCompositionStart");T&&(Lnt&&r.locale!=="ko"&&(wz||T!=="onCompositionStart"?T==="onCompositionEnd"&&wz&&(P=Dnt()):(gI=c,vEe="value"in gI?gI.value:gI.textContent,wz=!0)),E=Dte(l,T),0<E.length&&(T=new drt(T,t,null,r,c),d.push({event:T,listeners:E}),P?T.data=P:(P=knt(r),P!==null&&(T.data=P)))),(P=pIr?mIr(t,r):hIr(t,r))&&(l=Dte(l,"onBeforeInput"),0<l.length&&(c=new drt("onBeforeInput","beforeinput",null,r,c),d.push({event:c,listeners:l}),c.data=P))}Znt(d,e)})}function d5(t,e,r){return{instance:t,listener:e,currentTarget:r}}function Dte(t,e){for(var r=e+"Capture",n=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=o5(t,r),i!=null&&n.unshift(d5(t,i,o)),i=o5(t,e),i!=null&&n.push(d5(t,i,o))),t=t.return}return n}function bz(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Crt(t,e,r,n,o){for(var i=e._reactName,a=[];r!==null&&r!==n;){var s=r,u=s.alternate,l=s.stateNode;if(u!==null&&u===n)break;s.tag===5&&l!==null&&(s=l,o?(u=o5(r,i),u!=null&&a.unshift(d5(r,u,s))):o||(u=o5(r,i),u!=null&&a.push(d5(r,u,s)))),r=r.return}a.length!==0&&t.push({event:e,listeners:a})}var PIr=/\r\n?/g,TIr=/\u0000|\uFFFD/g;function Ort(t){return(typeof t=="string"?t:""+t).replace(PIr,`
`).replace(TIr,"")}function fte(t,e,r){if(e=Ort(e),Ort(t)!==e&&r)throw Error(qe(425))}function Lte(){}var kOe=null,$Oe=null;function BOe(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var zOe=typeof setTimeout=="function"?setTimeout:void 0,AIr=typeof clearTimeout=="function"?clearTimeout:void 0,Ert=typeof Promise=="function"?Promise:void 0,IIr=typeof queueMicrotask=="function"?queueMicrotask:typeof Ert<"u"?function(t){return Ert.resolve(null).then(t).catch(MIr)}:zOe;function MIr(t){setTimeout(function(){throw t})}function sOe(t,e){var r=e,n=0;do{var o=r.nextSibling;if(t.removeChild(r),o&&o.nodeType===8)if(r=o.data,r==="/$"){if(n===0){t.removeChild(o),s5(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=o}while(r);s5(e)}function wI(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function Prt(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"){if(e===0)return t;e--}else r==="/$"&&e++}t=t.previousSibling}return null}var Vz=Math.random().toString(36).slice(2),qv="__reactFiber$"+Vz,f5="__reactProps$"+Vz,UE="__reactContainer$"+Vz,UOe="__reactEvents$"+Vz,RIr="__reactListeners$"+Vz,NIr="__reactHandles$"+Vz;function Yj(t){var e=t[qv];if(e)return e;for(var r=t.parentNode;r;){if(e=r[UE]||r[qv]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=Prt(t);t!==null;){if(r=t[qv])return r;t=Prt(t)}return e}t=r,r=t.parentNode}return null}function w5(t){return t=t[qv]||t[UE],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Cz(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(qe(33))}function rre(t){return t[f5]||null}var qOe=[],Oz=-1;function AI(t){return{current:t}}function Sa(t){0>Oz||(t.current=qOe[Oz],qOe[Oz]=null,Oz--)}function da(t,e){Oz++,qOe[Oz]=t.current,t.current=e}var PI={},Bf=AI(PI),Lm=AI(!1),rD=PI;function kz(t,e){var r=t.type.contextTypes;if(!r)return PI;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in r)o[i]=e[i];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function Fm(t){return t=t.childContextTypes,t!=null}function Fte(){Sa(Lm),Sa(Bf)}function Trt(t,e,r){if(Bf.current!==PI)throw Error(qe(168));da(Bf,e),da(Lm,r)}function Xnt(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var o in n)if(!(o in e))throw Error(qe(108,_Ar(t)||"Unknown",o));return cs({},r,n)}function kte(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||PI,rD=Bf.current,da(Bf,t),da(Lm,Lm.current),!0}function Art(t,e,r){var n=t.stateNode;if(!n)throw Error(qe(169));r?(t=Xnt(t,e,rD),n.__reactInternalMemoizedMergedChildContext=t,Sa(Lm),Sa(Bf),da(Bf,t)):Sa(Lm),da(Lm,r)}var FE=null,nre=!1,uOe=!1;function Qnt(t){FE===null?FE=[t]:FE.push(t)}function jIr(t){nre=!0,Qnt(t)}function II(){if(!uOe&&FE!==null){uOe=!0;var t=0,e=ki;try{var r=FE;for(ki=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}FE=null,nre=!1}catch(o){throw FE!==null&&(FE=FE.slice(t+1)),Cnt(gEe,II),o}finally{ki=e,uOe=!1}}return null}var Ez=[],Pz=0,$te=null,Bte=0,oy=[],iy=0,nD=null,kE=1,$E="";function Jj(t,e){Ez[Pz++]=Bte,Ez[Pz++]=$te,$te=t,Bte=e}function eot(t,e,r){oy[iy++]=kE,oy[iy++]=$E,oy[iy++]=nD,nD=t;var n=kE;t=$E;var o=32-Vb(n)-1;n&=~(1<<o),r+=1;var i=32-Vb(e)+o;if(30<i){var a=o-o%5;i=(n&(1<<a)-1).toString(32),n>>=a,o-=a,kE=1<<32-Vb(e)+o|r<<o|n,$E=i+t}else kE=1<<i|r<<o|n,$E=t}function OEe(t){t.return!==null&&(Jj(t,1),eot(t,1,0))}function EEe(t){for(;t===$te;)$te=Ez[--Pz],Ez[Pz]=null,Bte=Ez[--Pz],Ez[Pz]=null;for(;t===nD;)nD=oy[--iy],oy[iy]=null,$E=oy[--iy],oy[iy]=null,kE=oy[--iy],oy[iy]=null}var Bh=null,$h=null,Ua=!1,Hb=null;function tot(t,e){var r=ay(5,null,null,0);r.elementType="DELETED",r.stateNode=e,r.return=t,e=t.deletions,e===null?(t.deletions=[r],t.flags|=16):e.push(r)}function Irt(t,e){switch(t.tag){case 5:var r=t.type;return e=e.nodeType!==1||r.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Bh=t,$h=wI(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Bh=t,$h=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=nD!==null?{id:kE,overflow:$E}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=ay(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,Bh=t,$h=null,!0):!1;default:return!1}}function HOe(t){return(t.mode&1)!==0&&(t.flags&128)===0}function VOe(t){if(Ua){var e=$h;if(e){var r=e;if(!Irt(t,e)){if(HOe(t))throw Error(qe(418));e=wI(r.nextSibling);var n=Bh;e&&Irt(t,e)?tot(n,r):(t.flags=t.flags&-4097|2,Ua=!1,Bh=t)}}else{if(HOe(t))throw Error(qe(418));t.flags=t.flags&-4097|2,Ua=!1,Bh=t}}}function Mrt(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Bh=t}function pte(t){if(t!==Bh)return!1;if(!Ua)return Mrt(t),Ua=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!BOe(t.type,t.memoizedProps)),e&&(e=$h)){if(HOe(t))throw rot(),Error(qe(418));for(;e;)tot(t,e),e=wI(e.nextSibling)}if(Mrt(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(qe(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){$h=wI(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}$h=null}}else $h=Bh?wI(t.stateNode.nextSibling):null;return!0}function rot(){for(var t=$h;t;)t=wI(t.nextSibling)}function $z(){$h=Bh=null,Ua=!1}function PEe(t){Hb===null?Hb=[t]:Hb.push(t)}var DIr=VE.ReactCurrentBatchConfig;function Ub(t,e){if(t&&t.defaultProps){e=cs({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}var zte=AI(null),Ute=null,Tz=null,TEe=null;function AEe(){TEe=Tz=Ute=null}function IEe(t){var e=zte.current;Sa(zte),t._currentValue=e}function WOe(t,e,r){for(;t!==null;){var n=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),t===r)break;t=t.return}}function Dz(t,e){Ute=t,TEe=Tz=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&e)!==0&&(Dm=!0),t.firstContext=null)}function uy(t){var e=t._currentValue;if(TEe!==t)if(t={context:t,memoizedValue:e,next:null},Tz===null){if(Ute===null)throw Error(qe(308));Tz=t,Ute.dependencies={lanes:0,firstContext:t}}else Tz=Tz.next=t;return e}var Xj=null;function MEe(t){Xj===null?Xj=[t]:Xj.push(t)}function not(t,e,r,n){var o=e.interleaved;return o===null?(r.next=r,MEe(e)):(r.next=o.next,o.next=r),e.interleaved=r,qE(t,n)}function qE(t,e){t.lanes|=e;var r=t.alternate;for(r!==null&&(r.lanes|=e),r=t,t=t.return;t!==null;)t.childLanes|=e,r=t.alternate,r!==null&&(r.childLanes|=e),r=t,t=t.return;return r.tag===3?r.stateNode:null}var pI=!1;function REe(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function oot(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function BE(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function xI(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,(ko&2)!==0){var o=n.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),n.pending=e,qE(t,r)}return o=n.interleaved,o===null?(e.next=e,MEe(n)):(e.next=o.next,o.next=e),n.interleaved=e,qE(t,r)}function wte(t,e,r){if(e=e.updateQueue,e!==null&&(e=e.shared,(r&4194240)!==0)){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,yEe(t,r)}}function Rrt(t,e){var r=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var o=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var a={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?o=i=a:i=i.next=a,r=r.next}while(r!==null);i===null?o=i=e:i=i.next=e}else o=i=e;r={baseState:n.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:n.shared,effects:n.effects},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=e:t.next=e,r.lastBaseUpdate=e}function qte(t,e,r,n){var o=t.updateQueue;pI=!1;var i=o.firstBaseUpdate,a=o.lastBaseUpdate,s=o.shared.pending;if(s!==null){o.shared.pending=null;var u=s,l=u.next;u.next=null,a===null?i=l:a.next=l,a=u;var c=t.alternate;c!==null&&(c=c.updateQueue,s=c.lastBaseUpdate,s!==a&&(s===null?c.firstBaseUpdate=l:s.next=l,c.lastBaseUpdate=u))}if(i!==null){var d=o.baseState;a=0,c=l=u=null,s=i;do{var f=s.lane,p=s.eventTime;if((n&f)===f){c!==null&&(c=c.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var m=t,h=s;switch(f=e,p=r,h.tag){case 1:if(m=h.payload,typeof m=="function"){d=m.call(p,d,f);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m=="function"?m.call(p,d,f):m,f==null)break e;d=cs({},d,f);break e;case 2:pI=!0}}s.callback!==null&&s.lane!==0&&(t.flags|=64,f=o.effects,f===null?o.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(l=c=p,u=d):c=c.next=p,a|=f;if(s=s.next,s===null){if(s=o.shared.pending,s===null)break;f=s,s=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(c===null&&(u=d),o.baseState=u,o.firstBaseUpdate=l,o.lastBaseUpdate=c,e=o.shared.interleaved,e!==null){o=e;do a|=o.lane,o=o.next;while(o!==e)}else i===null&&(o.shared.lanes=0);iD|=a,t.lanes=a,t.memoizedState=d}}function Nrt(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var n=t[e],o=n.callback;if(o!==null){if(n.callback=null,n=r,typeof o!="function")throw Error(qe(191,o));o.call(n)}}}var iot=new nnt.Component().refs;function KOe(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:cs({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var ore={isMounted:function(t){return(t=t._reactInternals)?uD(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=Fp(),o=CI(t),i=BE(n,o);i.payload=e,r!=null&&(i.callback=r),e=xI(t,i,o),e!==null&&(Wb(e,t,o,n),wte(e,t,o))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=Fp(),o=CI(t),i=BE(n,o);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=xI(t,i,o),e!==null&&(Wb(e,t,o,n),wte(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=Fp(),n=CI(t),o=BE(r,n);o.tag=2,e!=null&&(o.callback=e),e=xI(t,o,n),e!==null&&(Wb(e,t,n,r),wte(e,t,n))}};function jrt(t,e,r,n,o,i,a){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(n,i,a):e.prototype&&e.prototype.isPureReactComponent?!l5(r,n)||!l5(o,i):!0}function aot(t,e,r){var n=!1,o=PI,i=e.contextType;return typeof i=="object"&&i!==null?i=uy(i):(o=Fm(e)?rD:Bf.current,n=e.contextTypes,i=(n=n!=null)?kz(t,o):PI),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=ore,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function Drt(t,e,r,n){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(r,n),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(r,n),e.state!==t&&ore.enqueueReplaceState(e,e.state,null)}function GOe(t,e,r,n){var o=t.stateNode;o.props=r,o.state=t.memoizedState,o.refs=iot,REe(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=uy(i):(i=Fm(e)?rD:Bf.current,o.context=kz(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(KOe(t,e,i,r),o.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(e=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),e!==o.state&&ore.enqueueReplaceState(o,o.state,null),qte(t,r,o,n),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function $8(t,e,r){if(t=r.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(qe(309));var n=r.stateNode}if(!n)throw Error(qe(147,t));var o=n,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(a){var s=o.refs;s===iot&&(s=o.refs={}),a===null?delete s[i]:s[i]=a},e._stringRef=i,e)}if(typeof t!="string")throw Error(qe(284));if(!r._owner)throw Error(qe(290,t))}return t}function mte(t,e){throw t=Object.prototype.toString.call(e),Error(qe(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Lrt(t){var e=t._init;return e(t._payload)}function sot(t){function e(g,_){if(t){var w=g.deletions;w===null?(g.deletions=[_],g.flags|=16):w.push(_)}}function r(g,_){if(!t)return null;for(;_!==null;)e(g,_),_=_.sibling;return null}function n(g,_){for(g=new Map;_!==null;)_.key!==null?g.set(_.key,_):g.set(_.index,_),_=_.sibling;return g}function o(g,_){return g=OI(g,_),g.index=0,g.sibling=null,g}function i(g,_,w){return g.index=w,t?(w=g.alternate,w!==null?(w=w.index,w<_?(g.flags|=2,_):w):(g.flags|=2,_)):(g.flags|=1048576,_)}function a(g){return t&&g.alternate===null&&(g.flags|=2),g}function s(g,_,w,S){return _===null||_.tag!==6?(_=hOe(w,g.mode,S),_.return=g,_):(_=o(_,w),_.return=g,_)}function u(g,_,w,S){var C=w.type;return C===vz?c(g,_,w.props.children,S,w.key):_!==null&&(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===fI&&Lrt(C)===_.type)?(S=o(_,w.props),S.ref=$8(g,_,w),S.return=g,S):(S=Pte(w.type,w.key,w.props,null,g.mode,S),S.ref=$8(g,_,w),S.return=g,S)}function l(g,_,w,S){return _===null||_.tag!==4||_.stateNode.containerInfo!==w.containerInfo||_.stateNode.implementation!==w.implementation?(_=gOe(w,g.mode,S),_.return=g,_):(_=o(_,w.children||[]),_.return=g,_)}function c(g,_,w,S,C){return _===null||_.tag!==7?(_=tD(w,g.mode,S,C),_.return=g,_):(_=o(_,w),_.return=g,_)}function d(g,_,w){if(typeof _=="string"&&_!==""||typeof _=="number")return _=hOe(""+_,g.mode,w),_.return=g,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Qee:return w=Pte(_.type,_.key,_.props,null,g.mode,w),w.ref=$8(g,null,_),w.return=g,w;case _z:return _=gOe(_,g.mode,w),_.return=g,_;case fI:var S=_._init;return d(g,S(_._payload),w)}if(H8(_)||D8(_))return _=tD(_,g.mode,w,null),_.return=g,_;mte(g,_)}return null}function f(g,_,w,S){var C=_!==null?_.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:s(g,_,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Qee:return w.key===C?u(g,_,w,S):null;case _z:return w.key===C?l(g,_,w,S):null;case fI:return C=w._init,f(g,_,C(w._payload),S)}if(H8(w)||D8(w))return C!==null?null:c(g,_,w,S,null);mte(g,w)}return null}function p(g,_,w,S,C){if(typeof S=="string"&&S!==""||typeof S=="number")return g=g.get(w)||null,s(_,g,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Qee:return g=g.get(S.key===null?w:S.key)||null,u(_,g,S,C);case _z:return g=g.get(S.key===null?w:S.key)||null,l(_,g,S,C);case fI:var E=S._init;return p(g,_,w,E(S._payload),C)}if(H8(S)||D8(S))return g=g.get(w)||null,c(_,g,S,C,null);mte(_,S)}return null}function m(g,_,w,S){for(var C=null,E=null,P=_,T=_=0,I=null;P!==null&&T<w.length;T++){P.index>T?(I=P,P=null):I=P.sibling;var N=f(g,P,w[T],S);if(N===null){P===null&&(P=I);break}t&&P&&N.alternate===null&&e(g,P),_=i(N,_,T),E===null?C=N:E.sibling=N,E=N,P=I}if(T===w.length)return r(g,P),Ua&&Jj(g,T),C;if(P===null){for(;T<w.length;T++)P=d(g,w[T],S),P!==null&&(_=i(P,_,T),E===null?C=P:E.sibling=P,E=P);return Ua&&Jj(g,T),C}for(P=n(g,P);T<w.length;T++)I=p(P,g,T,w[T],S),I!==null&&(t&&I.alternate!==null&&P.delete(I.key===null?T:I.key),_=i(I,_,T),E===null?C=I:E.sibling=I,E=I);return t&&P.forEach(function(M){return e(g,M)}),Ua&&Jj(g,T),C}function h(g,_,w,S){var C=D8(w);if(typeof C!="function")throw Error(qe(150));if(w=C.call(w),w==null)throw Error(qe(151));for(var E=C=null,P=_,T=_=0,I=null,N=w.next();P!==null&&!N.done;T++,N=w.next()){P.index>T?(I=P,P=null):I=P.sibling;var M=f(g,P,N.value,S);if(M===null){P===null&&(P=I);break}t&&P&&M.alternate===null&&e(g,P),_=i(M,_,T),E===null?C=M:E.sibling=M,E=M,P=I}if(N.done)return r(g,P),Ua&&Jj(g,T),C;if(P===null){for(;!N.done;T++,N=w.next())N=d(g,N.value,S),N!==null&&(_=i(N,_,T),E===null?C=N:E.sibling=N,E=N);return Ua&&Jj(g,T),C}for(P=n(g,P);!N.done;T++,N=w.next())N=p(P,g,T,N.value,S),N!==null&&(t&&N.alternate!==null&&P.delete(N.key===null?T:N.key),_=i(N,_,T),E===null?C=N:E.sibling=N,E=N);return t&&P.forEach(function(D){return e(g,D)}),Ua&&Jj(g,T),C}function y(g,_,w,S){if(typeof w=="object"&&w!==null&&w.type===vz&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Qee:e:{for(var C=w.key,E=_;E!==null;){if(E.key===C){if(C=w.type,C===vz){if(E.tag===7){r(g,E.sibling),_=o(E,w.props.children),_.return=g,g=_;break e}}else if(E.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===fI&&Lrt(C)===E.type){r(g,E.sibling),_=o(E,w.props),_.ref=$8(g,E,w),_.return=g,g=_;break e}r(g,E);break}else e(g,E);E=E.sibling}w.type===vz?(_=tD(w.props.children,g.mode,S,w.key),_.return=g,g=_):(S=Pte(w.type,w.key,w.props,null,g.mode,S),S.ref=$8(g,_,w),S.return=g,g=S)}return a(g);case _z:e:{for(E=w.key;_!==null;){if(_.key===E)if(_.tag===4&&_.stateNode.containerInfo===w.containerInfo&&_.stateNode.implementation===w.implementation){r(g,_.sibling),_=o(_,w.children||[]),_.return=g,g=_;break e}else{r(g,_);break}else e(g,_);_=_.sibling}_=gOe(w,g.mode,S),_.return=g,g=_}return a(g);case fI:return E=w._init,y(g,_,E(w._payload),S)}if(H8(w))return m(g,_,w,S);if(D8(w))return h(g,_,w,S);mte(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,_!==null&&_.tag===6?(r(g,_.sibling),_=o(_,w),_.return=g,g=_):(r(g,_),_=hOe(w,g.mode,S),_.return=g,g=_),a(g)):r(g,_)}return y}var Bz=sot(!0),uot=sot(!1),x5={},Vv=AI(x5),p5=AI(x5),m5=AI(x5);function Qj(t){if(t===x5)throw Error(qe(174));return t}function NEe(t,e){switch(da(m5,e),da(p5,t),da(Vv,x5),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:EOe(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=EOe(e,t)}Sa(Vv),da(Vv,e)}function zz(){Sa(Vv),Sa(p5),Sa(m5)}function lot(t){Qj(m5.current);var e=Qj(Vv.current),r=EOe(e,t.type);e!==r&&(da(p5,t),da(Vv,r))}function jEe(t){p5.current===t&&(Sa(Vv),Sa(p5))}var us=AI(0);function Hte(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if((e.flags&128)!==0)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var lOe=[];function DEe(){for(var t=0;t<lOe.length;t++)lOe[t]._workInProgressVersionPrimary=null;lOe.length=0}var xte=VE.ReactCurrentDispatcher,cOe=VE.ReactCurrentBatchConfig,oD=0,ls=null,cc=null,kc=null,Vte=!1,X8=!1,h5=0,LIr=0;function Ff(){throw Error(qe(321))}function LEe(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!Kb(t[r],e[r]))return!1;return!0}function FEe(t,e,r,n,o,i){if(oD=i,ls=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,xte.current=t===null||t.memoizedState===null?BIr:zIr,t=r(n,o),X8){i=0;do{if(X8=!1,h5=0,25<=i)throw Error(qe(301));i+=1,kc=cc=null,e.updateQueue=null,xte.current=UIr,t=r(n,o)}while(X8)}if(xte.current=Wte,e=cc!==null&&cc.next!==null,oD=0,kc=cc=ls=null,Vte=!1,e)throw Error(qe(300));return t}function kEe(){var t=h5!==0;return h5=0,t}function Uv(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return kc===null?ls.memoizedState=kc=t:kc=kc.next=t,kc}function ly(){if(cc===null){var t=ls.alternate;t=t!==null?t.memoizedState:null}else t=cc.next;var e=kc===null?ls.memoizedState:kc.next;if(e!==null)kc=e,cc=t;else{if(t===null)throw Error(qe(310));cc=t,t={memoizedState:cc.memoizedState,baseState:cc.baseState,baseQueue:cc.baseQueue,queue:cc.queue,next:null},kc===null?ls.memoizedState=kc=t:kc=kc.next=t}return kc}function g5(t,e){return typeof e=="function"?e(t):e}function dOe(t){var e=ly(),r=e.queue;if(r===null)throw Error(qe(311));r.lastRenderedReducer=t;var n=cc,o=n.baseQueue,i=r.pending;if(i!==null){if(o!==null){var a=o.next;o.next=i.next,i.next=a}n.baseQueue=o=i,r.pending=null}if(o!==null){i=o.next,n=n.baseState;var s=a=null,u=null,l=i;do{var c=l.lane;if((oD&c)===c)u!==null&&(u=u.next={lane:0,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),n=l.hasEagerState?l.eagerState:t(n,l.action);else{var d={lane:c,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null};u===null?(s=u=d,a=n):u=u.next=d,ls.lanes|=c,iD|=c}l=l.next}while(l!==null&&l!==i);u===null?a=n:u.next=s,Kb(n,e.memoizedState)||(Dm=!0),e.memoizedState=n,e.baseState=a,e.baseQueue=u,r.lastRenderedState=n}if(t=r.interleaved,t!==null){o=t;do i=o.lane,ls.lanes|=i,iD|=i,o=o.next;while(o!==t)}else o===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function fOe(t){var e=ly(),r=e.queue;if(r===null)throw Error(qe(311));r.lastRenderedReducer=t;var n=r.dispatch,o=r.pending,i=e.memoizedState;if(o!==null){r.pending=null;var a=o=o.next;do i=t(i,a.action),a=a.next;while(a!==o);Kb(i,e.memoizedState)||(Dm=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function cot(){}function dot(t,e){var r=ls,n=ly(),o=e(),i=!Kb(n.memoizedState,o);if(i&&(n.memoizedState=o,Dm=!0),n=n.queue,$Ee(mot.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||kc!==null&&kc.memoizedState.tag&1){if(r.flags|=2048,y5(9,pot.bind(null,r,n,o,e),void 0,null),$c===null)throw Error(qe(349));(oD&30)!==0||fot(r,e,o)}return o}function fot(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=ls.updateQueue,e===null?(e={lastEffect:null,stores:null},ls.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function pot(t,e,r,n){e.value=r,e.getSnapshot=n,hot(e)&&got(t)}function mot(t,e,r){return r(function(){hot(e)&&got(t)})}function hot(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!Kb(t,r)}catch{return!0}}function got(t){var e=qE(t,1);e!==null&&Wb(e,t,1,-1)}function Frt(t){var e=Uv();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:g5,lastRenderedState:t},e.queue=t,t=t.dispatch=$Ir.bind(null,ls,t),[e.memoizedState,t]}function y5(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=ls.updateQueue,e===null?(e={lastEffect:null,stores:null},ls.updateQueue=e,e.lastEffect=t.next=t):(r=e.lastEffect,r===null?e.lastEffect=t.next=t:(n=r.next,r.next=t,t.next=n,e.lastEffect=t)),t}function yot(){return ly().memoizedState}function Ste(t,e,r,n){var o=Uv();ls.flags|=t,o.memoizedState=y5(1|e,r,void 0,n===void 0?null:n)}function ire(t,e,r,n){var o=ly();n=n===void 0?null:n;var i=void 0;if(cc!==null){var a=cc.memoizedState;if(i=a.destroy,n!==null&&LEe(n,a.deps)){o.memoizedState=y5(e,r,i,n);return}}ls.flags|=t,o.memoizedState=y5(1|e,r,i,n)}function krt(t,e){return Ste(8390656,8,t,e)}function $Ee(t,e){return ire(2048,8,t,e)}function bot(t,e){return ire(4,2,t,e)}function _ot(t,e){return ire(4,4,t,e)}function vot(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function wot(t,e,r){return r=r!=null?r.concat([t]):null,ire(4,4,vot.bind(null,e,t),r)}function BEe(){}function xot(t,e){var r=ly();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&LEe(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function Sot(t,e){var r=ly();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&LEe(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function Cot(t,e,r){return(oD&21)===0?(t.baseState&&(t.baseState=!1,Dm=!0),t.memoizedState=r):(Kb(r,e)||(r=Pnt(),ls.lanes|=r,iD|=r,t.baseState=!0),e)}function FIr(t,e){var r=ki;ki=r!==0&&4>r?r:4,t(!0);var n=cOe.transition;cOe.transition={};try{t(!1),e()}finally{ki=r,cOe.transition=n}}function Oot(){return ly().memoizedState}function kIr(t,e,r){var n=CI(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},Eot(t))Pot(e,r);else if(r=not(t,e,r,n),r!==null){var o=Fp();Wb(r,t,n,o),Tot(r,e,n)}}function $Ir(t,e,r){var n=CI(t),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(Eot(t))Pot(e,o);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var a=e.lastRenderedState,s=i(a,r);if(o.hasEagerState=!0,o.eagerState=s,Kb(s,a)){var u=e.interleaved;u===null?(o.next=o,MEe(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}r=not(t,e,o,n),r!==null&&(o=Fp(),Wb(r,t,n,o),Tot(r,e,n))}}function Eot(t){var e=t.alternate;return t===ls||e!==null&&e===ls}function Pot(t,e){X8=Vte=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Tot(t,e,r){if((r&4194240)!==0){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,yEe(t,r)}}var Wte={readContext:uy,useCallback:Ff,useContext:Ff,useEffect:Ff,useImperativeHandle:Ff,useInsertionEffect:Ff,useLayoutEffect:Ff,useMemo:Ff,useReducer:Ff,useRef:Ff,useState:Ff,useDebugValue:Ff,useDeferredValue:Ff,useTransition:Ff,useMutableSource:Ff,useSyncExternalStore:Ff,useId:Ff,unstable_isNewReconciler:!1},BIr={readContext:uy,useCallback:function(t,e){return Uv().memoizedState=[t,e===void 0?null:e],t},useContext:uy,useEffect:krt,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,Ste(4194308,4,vot.bind(null,e,t),r)},useLayoutEffect:function(t,e){return Ste(4194308,4,t,e)},useInsertionEffect:function(t,e){return Ste(4,2,t,e)},useMemo:function(t,e){var r=Uv();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=Uv();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=kIr.bind(null,ls,t),[n.memoizedState,t]},useRef:function(t){var e=Uv();return t={current:t},e.memoizedState=t},useState:Frt,useDebugValue:BEe,useDeferredValue:function(t){return Uv().memoizedState=t},useTransition:function(){var t=Frt(!1),e=t[0];return t=FIr.bind(null,t[1]),Uv().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ls,o=Uv();if(Ua){if(r===void 0)throw Error(qe(407));r=r()}else{if(r=e(),$c===null)throw Error(qe(349));(oD&30)!==0||fot(n,e,r)}o.memoizedState=r;var i={value:r,getSnapshot:e};return o.queue=i,krt(mot.bind(null,n,i,t),[t]),n.flags|=2048,y5(9,pot.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=Uv(),e=$c.identifierPrefix;if(Ua){var r=$E,n=kE;r=(n&~(1<<32-Vb(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=h5++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=LIr++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},zIr={readContext:uy,useCallback:xot,useContext:uy,useEffect:$Ee,useImperativeHandle:wot,useInsertionEffect:bot,useLayoutEffect:_ot,useMemo:Sot,useReducer:dOe,useRef:yot,useState:function(){return dOe(g5)},useDebugValue:BEe,useDeferredValue:function(t){var e=ly();return Cot(e,cc.memoizedState,t)},useTransition:function(){var t=dOe(g5)[0],e=ly().memoizedState;return[t,e]},useMutableSource:cot,useSyncExternalStore:dot,useId:Oot,unstable_isNewReconciler:!1},UIr={readContext:uy,useCallback:xot,useContext:uy,useEffect:$Ee,useImperativeHandle:wot,useInsertionEffect:bot,useLayoutEffect:_ot,useMemo:Sot,useReducer:fOe,useRef:yot,useState:function(){return fOe(g5)},useDebugValue:BEe,useDeferredValue:function(t){var e=ly();return cc===null?e.memoizedState=t:Cot(e,cc.memoizedState,t)},useTransition:function(){var t=fOe(g5)[0],e=ly().memoizedState;return[t,e]},useMutableSource:cot,useSyncExternalStore:dot,useId:Oot,unstable_isNewReconciler:!1};function Uz(t,e){try{var r="",n=e;do r+=bAr(n),n=n.return;while(n);var o=r}catch(i){o=`
Error generating stack: `+i.message+`
`+i.stack}return{value:t,source:e,stack:o,digest:null}}function pOe(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function JOe(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var qIr=typeof WeakMap=="function"?WeakMap:Map;function Aot(t,e,r){r=BE(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){Gte||(Gte=!0,iEe=n),JOe(t,e)},r}function Iot(t,e,r){r=BE(-1,r),r.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var o=e.value;r.payload=function(){return n(o)},r.callback=function(){JOe(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){JOe(t,e),typeof n!="function"&&(SI===null?SI=new Set([this]):SI.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function $rt(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new qIr;var o=new Set;n.set(e,o)}else o=n.get(e),o===void 0&&(o=new Set,n.set(e,o));o.has(r)||(o.add(r),t=nMr.bind(null,t,e,r),e.then(t,t))}function Brt(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function zrt(t,e,r,n,o){return(t.mode&1)===0?(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=BE(-1,1),e.tag=2,xI(r,e,1))),r.lanes|=1),t):(t.flags|=65536,t.lanes=o,t)}var HIr=VE.ReactCurrentOwner,Dm=!1;function Lp(t,e,r,n){e.child=t===null?uot(e,null,r,n):Bz(e,t.child,r,n)}function Urt(t,e,r,n,o){r=r.render;var i=e.ref;return Dz(e,o),n=FEe(t,e,r,n,i,o),r=kEe(),t!==null&&!Dm?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,HE(t,e,o)):(Ua&&r&&OEe(e),e.flags|=1,Lp(t,e,n,o),e.child)}function qrt(t,e,r,n,o){if(t===null){var i=r.type;return typeof i=="function"&&!GEe(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,Mot(t,e,i,n,o)):(t=Pte(r.type,null,n,e,e.mode,o),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,(t.lanes&o)===0){var a=i.memoizedProps;if(r=r.compare,r=r!==null?r:l5,r(a,n)&&t.ref===e.ref)return HE(t,e,o)}return e.flags|=1,t=OI(i,n),t.ref=e.ref,t.return=e,e.child=t}function Mot(t,e,r,n,o){if(t!==null){var i=t.memoizedProps;if(l5(i,n)&&t.ref===e.ref)if(Dm=!1,e.pendingProps=n=i,(t.lanes&o)!==0)(t.flags&131072)!==0&&(Dm=!0);else return e.lanes=t.lanes,HE(t,e,o)}return ZOe(t,e,r,n,o)}function Rot(t,e,r){var n=e.pendingProps,o=n.children,i=t!==null?t.memoizedState:null;if(n.mode==="hidden")if((e.mode&1)===0)e.memoizedState={baseLanes:0,cachePool:null,transitions:null},da(Iz,kh),kh|=r;else{if((r&1073741824)===0)return t=i!==null?i.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,da(Iz,kh),kh|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,da(Iz,kh),kh|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,da(Iz,kh),kh|=n;return Lp(t,e,o,r),e.child}function Not(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function ZOe(t,e,r,n,o){var i=Fm(r)?rD:Bf.current;return i=kz(e,i),Dz(e,o),r=FEe(t,e,r,n,i,o),n=kEe(),t!==null&&!Dm?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,HE(t,e,o)):(Ua&&n&&OEe(e),e.flags|=1,Lp(t,e,r,o),e.child)}function Hrt(t,e,r,n,o){if(Fm(r)){var i=!0;kte(e)}else i=!1;if(Dz(e,o),e.stateNode===null)Cte(t,e),aot(e,r,n),GOe(e,r,n,o),n=!0;else if(t===null){var a=e.stateNode,s=e.memoizedProps;a.props=s;var u=a.context,l=r.contextType;typeof l=="object"&&l!==null?l=uy(l):(l=Fm(r)?rD:Bf.current,l=kz(e,l));var c=r.getDerivedStateFromProps,d=typeof c=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(s!==n||u!==l)&&Drt(e,a,n,l),pI=!1;var f=e.memoizedState;a.state=f,qte(e,n,a,o),u=e.memoizedState,s!==n||f!==u||Lm.current||pI?(typeof c=="function"&&(KOe(e,r,c,n),u=e.memoizedState),(s=pI||jrt(e,r,s,n,f,u,l))?(d||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(e.flags|=4194308)):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=u),a.props=n,a.state=u,a.context=l,n=s):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{a=e.stateNode,oot(t,e),s=e.memoizedProps,l=e.type===e.elementType?s:Ub(e.type,s),a.props=l,d=e.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=uy(u):(u=Fm(r)?rD:Bf.current,u=kz(e,u));var p=r.getDerivedStateFromProps;(c=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(s!==d||f!==u)&&Drt(e,a,n,u),pI=!1,f=e.memoizedState,a.state=f,qte(e,n,a,o);var m=e.memoizedState;s!==d||f!==m||Lm.current||pI?(typeof p=="function"&&(KOe(e,r,p,n),m=e.memoizedState),(l=pI||jrt(e,r,l,n,f,m,u)||!1)?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,m,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,m,u)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=m),a.props=n,a.state=m,a.context=u,n=l):(typeof a.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),n=!1)}return YOe(t,e,r,n,i,o)}function YOe(t,e,r,n,o,i){Not(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return o&&Art(e,r,!1),HE(t,e,i);n=e.stateNode,HIr.current=e;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=Bz(e,t.child,null,i),e.child=Bz(e,null,s,i)):Lp(t,e,s,i),e.memoizedState=n.state,o&&Art(e,r,!0),e.child}function jot(t){var e=t.stateNode;e.pendingContext?Trt(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Trt(t,e.context,!1),NEe(t,e.containerInfo)}function Vrt(t,e,r,n,o){return $z(),PEe(o),e.flags|=256,Lp(t,e,r,n),e.child}var XOe={dehydrated:null,treeContext:null,retryLane:0};function QOe(t){return{baseLanes:t,cachePool:null,transitions:null}}function Dot(t,e,r){var n=e.pendingProps,o=us.current,i=!1,a=(e.flags&128)!==0,s;if((s=a)||(s=t!==null&&t.memoizedState===null?!1:(o&2)!==0),s?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(o|=1),da(us,o&1),t===null)return VOe(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((e.mode&1)===0?e.lanes=1:t.data==="$!"?e.lanes=8:e.lanes=1073741824,null):(a=n.children,t=n.fallback,i?(n=e.mode,i=e.child,a={mode:"hidden",children:a},(n&1)===0&&i!==null?(i.childLanes=0,i.pendingProps=a):i=ure(a,n,0,null),t=tD(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=QOe(r),e.memoizedState=XOe,t):zEe(e,a));if(o=t.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return VIr(t,e,a,n,s,o,r);if(i){i=n.fallback,a=e.mode,o=t.child,s=o.sibling;var u={mode:"hidden",children:n.children};return(a&1)===0&&e.child!==o?(n=e.child,n.childLanes=0,n.pendingProps=u,e.deletions=null):(n=OI(o,u),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=OI(s,i):(i=tD(i,a,r,null),i.flags|=2),i.return=e,n.return=e,n.sibling=i,e.child=n,n=i,i=e.child,a=t.child.memoizedState,a=a===null?QOe(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=t.childLanes&~r,e.memoizedState=XOe,n}return i=t.child,t=i.sibling,n=OI(i,{mode:"visible",children:n.children}),(e.mode&1)===0&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function zEe(t,e){return e=ure({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function hte(t,e,r,n){return n!==null&&PEe(n),Bz(e,t.child,null,r),t=zEe(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function VIr(t,e,r,n,o,i,a){if(r)return e.flags&256?(e.flags&=-257,n=pOe(Error(qe(422))),hte(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,o=e.mode,n=ure({mode:"visible",children:n.children},o,0,null),i=tD(i,o,a,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,(e.mode&1)!==0&&Bz(e,t.child,null,a),e.child.memoizedState=QOe(a),e.memoizedState=XOe,i);if((e.mode&1)===0)return hte(t,e,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(qe(419)),n=pOe(i,n,void 0),hte(t,e,a,n)}if(s=(a&t.childLanes)!==0,Dm||s){if(n=$c,n!==null){switch(a&-a){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=(o&(n.suspendedLanes|a))!==0?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,qE(t,o),Wb(n,t,o,-1))}return KEe(),n=pOe(Error(qe(421))),hte(t,e,a,n)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=oMr.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,$h=wI(o.nextSibling),Bh=e,Ua=!0,Hb=null,t!==null&&(oy[iy++]=kE,oy[iy++]=$E,oy[iy++]=nD,kE=t.id,$E=t.overflow,nD=e),e=zEe(e,n.children),e.flags|=4096,e)}function Wrt(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),WOe(t.return,e,r)}function mOe(t,e,r,n,o){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:o}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=o)}function Lot(t,e,r){var n=e.pendingProps,o=n.revealOrder,i=n.tail;if(Lp(t,e,n.children,r),n=us.current,(n&2)!==0)n=n&1|2,e.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Wrt(t,r,e);else if(t.tag===19)Wrt(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(da(us,n),(e.mode&1)===0)e.memoizedState=null;else switch(o){case"forwards":for(r=e.child,o=null;r!==null;)t=r.alternate,t!==null&&Hte(t)===null&&(o=r),r=r.sibling;r=o,r===null?(o=e.child,e.child=null):(o=r.sibling,r.sibling=null),mOe(e,!1,o,r,i);break;case"backwards":for(r=null,o=e.child,e.child=null;o!==null;){if(t=o.alternate,t!==null&&Hte(t)===null){e.child=o;break}t=o.sibling,o.sibling=r,r=o,o=t}mOe(e,!0,r,null,i);break;case"together":mOe(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Cte(t,e){(e.mode&1)===0&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function HE(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),iD|=e.lanes,(r&e.childLanes)===0)return null;if(t!==null&&e.child!==t.child)throw Error(qe(153));if(e.child!==null){for(t=e.child,r=OI(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=OI(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function WIr(t,e,r){switch(e.tag){case 3:jot(e),$z();break;case 5:lot(e);break;case 1:Fm(e.type)&&kte(e);break;case 4:NEe(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,o=e.memoizedProps.value;da(zte,n._currentValue),n._currentValue=o;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(da(us,us.current&1),e.flags|=128,null):(r&e.child.childLanes)!==0?Dot(t,e,r):(da(us,us.current&1),t=HE(t,e,r),t!==null?t.sibling:null);da(us,us.current&1);break;case 19:if(n=(r&e.childLanes)!==0,(t.flags&128)!==0){if(n)return Lot(t,e,r);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),da(us,us.current),n)break;return null;case 22:case 23:return e.lanes=0,Rot(t,e,r)}return HE(t,e,r)}var Fot,eEe,kot,$ot;Fot=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};eEe=function(){};kot=function(t,e,r,n){var o=t.memoizedProps;if(o!==n){t=e.stateNode,Qj(Vv.current);var i=null;switch(r){case"input":o=xOe(t,o),n=xOe(t,n),i=[];break;case"select":o=cs({},o,{value:void 0}),n=cs({},n,{value:void 0}),i=[];break;case"textarea":o=OOe(t,o),n=OOe(t,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=Lte)}POe(r,n);var a;r=null;for(l in o)if(!n.hasOwnProperty(l)&&o.hasOwnProperty(l)&&o[l]!=null)if(l==="style"){var s=o[l];for(a in s)s.hasOwnProperty(a)&&(r||(r={}),r[a]="")}else l!=="dangerouslySetInnerHTML"&&l!=="children"&&l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(r5.hasOwnProperty(l)?i||(i=[]):(i=i||[]).push(l,null));for(l in n){var u=n[l];if(s=o?.[l],n.hasOwnProperty(l)&&u!==s&&(u!=null||s!=null))if(l==="style")if(s){for(a in s)!s.hasOwnProperty(a)||u&&u.hasOwnProperty(a)||(r||(r={}),r[a]="");for(a in u)u.hasOwnProperty(a)&&s[a]!==u[a]&&(r||(r={}),r[a]=u[a])}else r||(i||(i=[]),i.push(l,r)),r=u;else l==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,s=s?s.__html:void 0,u!=null&&s!==u&&(i=i||[]).push(l,u)):l==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(l,""+u):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&(r5.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&xa("scroll",t),i||s===u||(i=[])):(i=i||[]).push(l,u))}r&&(i=i||[]).push("style",r);var l=i;(e.updateQueue=l)&&(e.flags|=4)}};$ot=function(t,e,r,n){r!==n&&(e.flags|=4)};function B8(t,e){if(!Ua)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function kf(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,n=0;if(e)for(var o=t.child;o!==null;)r|=o.lanes|o.childLanes,n|=o.subtreeFlags&14680064,n|=o.flags&14680064,o.return=t,o=o.sibling;else for(o=t.child;o!==null;)r|=o.lanes|o.childLanes,n|=o.subtreeFlags,n|=o.flags,o.return=t,o=o.sibling;return t.subtreeFlags|=n,t.childLanes=r,e}function KIr(t,e,r){var n=e.pendingProps;switch(EEe(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kf(e),null;case 1:return Fm(e.type)&&Fte(),kf(e),null;case 3:return n=e.stateNode,zz(),Sa(Lm),Sa(Bf),DEe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(pte(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,Hb!==null&&(uEe(Hb),Hb=null))),eEe(t,e),kf(e),null;case 5:jEe(e);var o=Qj(m5.current);if(r=e.type,t!==null&&e.stateNode!=null)kot(t,e,r,n,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(qe(166));return kf(e),null}if(t=Qj(Vv.current),pte(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[qv]=e,n[f5]=i,t=(e.mode&1)!==0,r){case"dialog":xa("cancel",n),xa("close",n);break;case"iframe":case"object":case"embed":xa("load",n);break;case"video":case"audio":for(o=0;o<W8.length;o++)xa(W8[o],n);break;case"source":xa("error",n);break;case"img":case"image":case"link":xa("error",n),xa("load",n);break;case"details":xa("toggle",n);break;case"input":ert(n,i),xa("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},xa("invalid",n);break;case"textarea":rrt(n,i),xa("invalid",n)}POe(r,i),o=null;for(var a in i)if(i.hasOwnProperty(a)){var s=i[a];a==="children"?typeof s=="string"?n.textContent!==s&&(i.suppressHydrationWarning!==!0&&fte(n.textContent,s,t),o=["children",s]):typeof s=="number"&&n.textContent!==""+s&&(i.suppressHydrationWarning!==!0&&fte(n.textContent,s,t),o=["children",""+s]):r5.hasOwnProperty(a)&&s!=null&&a==="onScroll"&&xa("scroll",n)}switch(r){case"input":ete(n),trt(n,i,!0);break;case"textarea":ete(n),nrt(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=Lte)}n=o,e.updateQueue=n,n!==null&&(e.flags|=4)}else{a=o.nodeType===9?o:o.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=fnt(r)),t==="http://www.w3.org/1999/xhtml"?r==="script"?(t=a.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=a.createElement(r,{is:n.is}):(t=a.createElement(r),r==="select"&&(a=t,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):t=a.createElementNS(t,r),t[qv]=e,t[f5]=n,Fot(t,e,!1,!1),e.stateNode=t;e:{switch(a=TOe(r,n),r){case"dialog":xa("cancel",t),xa("close",t),o=n;break;case"iframe":case"object":case"embed":xa("load",t),o=n;break;case"video":case"audio":for(o=0;o<W8.length;o++)xa(W8[o],t);o=n;break;case"source":xa("error",t),o=n;break;case"img":case"image":case"link":xa("error",t),xa("load",t),o=n;break;case"details":xa("toggle",t),o=n;break;case"input":ert(t,n),o=xOe(t,n),xa("invalid",t);break;case"option":o=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=cs({},n,{value:void 0}),xa("invalid",t);break;case"textarea":rrt(t,n),o=OOe(t,n),xa("invalid",t);break;default:o=n}POe(r,o),s=o;for(i in s)if(s.hasOwnProperty(i)){var u=s[i];i==="style"?hnt(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&pnt(t,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&n5(t,u):typeof u=="number"&&n5(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(r5.hasOwnProperty(i)?u!=null&&i==="onScroll"&&xa("scroll",t):u!=null&&dEe(t,i,u,a))}switch(r){case"input":ete(t),trt(t,n,!1);break;case"textarea":ete(t),nrt(t);break;case"option":n.value!=null&&t.setAttribute("value",""+EI(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?Mz(t,!!n.multiple,i,!1):n.defaultValue!=null&&Mz(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=Lte)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return kf(e),null;case 6:if(t&&e.stateNode!=null)$ot(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(qe(166));if(r=Qj(m5.current),Qj(Vv.current),pte(e)){if(n=e.stateNode,r=e.memoizedProps,n[qv]=e,(i=n.nodeValue!==r)&&(t=Bh,t!==null))switch(t.tag){case 3:fte(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&fte(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[qv]=e,e.stateNode=n}return kf(e),null;case 13:if(Sa(us),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Ua&&$h!==null&&(e.mode&1)!==0&&(e.flags&128)===0)rot(),$z(),e.flags|=98560,i=!1;else if(i=pte(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(qe(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(qe(317));i[qv]=e}else $z(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;kf(e),i=!1}else Hb!==null&&(uEe(Hb),Hb=null),i=!0;if(!i)return e.flags&65536?e:null}return(e.flags&128)!==0?(e.lanes=r,e):(n=n!==null,n!==(t!==null&&t.memoizedState!==null)&&n&&(e.child.flags|=8192,(e.mode&1)!==0&&(t===null||(us.current&1)!==0?dc===0&&(dc=3):KEe())),e.updateQueue!==null&&(e.flags|=4),kf(e),null);case 4:return zz(),eEe(t,e),t===null&&c5(e.stateNode.containerInfo),kf(e),null;case 10:return IEe(e.type._context),kf(e),null;case 17:return Fm(e.type)&&Fte(),kf(e),null;case 19:if(Sa(us),i=e.memoizedState,i===null)return kf(e),null;if(n=(e.flags&128)!==0,a=i.rendering,a===null)if(n)B8(i,!1);else{if(dc!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(a=Hte(t),a!==null){for(e.flags|=128,B8(i,!1),n=a.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),e.subtreeFlags=0,n=r,r=e.child;r!==null;)i=r,t=n,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,t=a.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),r=r.sibling;return da(us,us.current&1|2),e.child}t=t.sibling}i.tail!==null&&ou()>qz&&(e.flags|=128,n=!0,B8(i,!1),e.lanes=4194304)}else{if(!n)if(t=Hte(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),B8(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Ua)return kf(e),null}else 2*ou()-i.renderingStartTime>qz&&r!==1073741824&&(e.flags|=128,n=!0,B8(i,!1),e.lanes=4194304);i.isBackwards?(a.sibling=e.child,e.child=a):(r=i.last,r!==null?r.sibling=a:e.child=a,i.last=a)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=ou(),e.sibling=null,r=us.current,da(us,n?r&1|2:r&1),e):(kf(e),null);case 22:case 23:return WEe(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&(e.mode&1)!==0?(kh&1073741824)!==0&&(kf(e),e.subtreeFlags&6&&(e.flags|=8192)):kf(e),null;case 24:return null;case 25:return null}throw Error(qe(156,e.tag))}function GIr(t,e){switch(EEe(e),e.tag){case 1:return Fm(e.type)&&Fte(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return zz(),Sa(Lm),Sa(Bf),DEe(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 5:return jEe(e),null;case 13:if(Sa(us),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(qe(340));$z()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Sa(us),null;case 4:return zz(),null;case 10:return IEe(e.type._context),null;case 22:case 23:return WEe(),null;case 24:return null;default:return null}}var gte=!1,$f=!1,JIr=typeof WeakSet=="function"?WeakSet:Set,Tt=null;function Az(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Ds(t,e,n)}else r.current=null}function tEe(t,e,r){try{r()}catch(n){Ds(t,e,n)}}var Krt=!1;function ZIr(t,e){if(kOe=Nte,t=qnt(),CEe(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var o=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var a=0,s=-1,u=-1,l=0,c=0,d=t,f=null;t:for(;;){for(var p;d!==r||o!==0&&d.nodeType!==3||(s=a+o),d!==i||n!==0&&d.nodeType!==3||(u=a+n),d.nodeType===3&&(a+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===t)break t;if(f===r&&++l===o&&(s=a),f===i&&++c===n&&(u=a),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}r=s===-1||u===-1?null:{start:s,end:u}}else r=null}r=r||{start:0,end:0}}else r=null;for($Oe={focusedElem:t,selectionRange:r},Nte=!1,Tt=e;Tt!==null;)if(e=Tt,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Tt=t;else for(;Tt!==null;){e=Tt;try{var m=e.alternate;if((e.flags&1024)!==0)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var h=m.memoizedProps,y=m.memoizedState,g=e.stateNode,_=g.getSnapshotBeforeUpdate(e.elementType===e.type?h:Ub(e.type,h),y);g.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(qe(163))}}catch(S){Ds(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,Tt=t;break}Tt=e.return}return m=Krt,Krt=!1,m}function Q8(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&t)===t){var i=o.destroy;o.destroy=void 0,i!==void 0&&tEe(e,r,i)}o=o.next}while(o!==n)}}function are(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function rEe(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function Bot(t){var e=t.alternate;e!==null&&(t.alternate=null,Bot(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[qv],delete e[f5],delete e[UOe],delete e[RIr],delete e[NIr])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function zot(t){return t.tag===5||t.tag===3||t.tag===4}function Grt(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||zot(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function nEe(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Lte));else if(n!==4&&(t=t.child,t!==null))for(nEe(t,e,r),t=t.sibling;t!==null;)nEe(t,e,r),t=t.sibling}function oEe(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(oEe(t,e,r),t=t.sibling;t!==null;)oEe(t,e,r),t=t.sibling}var Ed=null,qb=!1;function dI(t,e,r){for(r=r.child;r!==null;)Uot(t,e,r),r=r.sibling}function Uot(t,e,r){if(Hv&&typeof Hv.onCommitFiberUnmount=="function")try{Hv.onCommitFiberUnmount(Xte,r)}catch{}switch(r.tag){case 5:$f||Az(r,e);case 6:var n=Ed,o=qb;Ed=null,dI(t,e,r),Ed=n,qb=o,Ed!==null&&(qb?(t=Ed,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Ed.removeChild(r.stateNode));break;case 18:Ed!==null&&(qb?(t=Ed,r=r.stateNode,t.nodeType===8?sOe(t.parentNode,r):t.nodeType===1&&sOe(t,r),s5(t)):sOe(Ed,r.stateNode));break;case 4:n=Ed,o=qb,Ed=r.stateNode.containerInfo,qb=!0,dI(t,e,r),Ed=n,qb=o;break;case 0:case 11:case 14:case 15:if(!$f&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){o=n=n.next;do{var i=o,a=i.destroy;i=i.tag,a!==void 0&&((i&2)!==0||(i&4)!==0)&&tEe(r,e,a),o=o.next}while(o!==n)}dI(t,e,r);break;case 1:if(!$f&&(Az(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Ds(r,e,s)}dI(t,e,r);break;case 21:dI(t,e,r);break;case 22:r.mode&1?($f=(n=$f)||r.memoizedState!==null,dI(t,e,r),$f=n):dI(t,e,r);break;default:dI(t,e,r)}}function Jrt(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new JIr),e.forEach(function(n){var o=iMr.bind(null,t,n);r.has(n)||(r.add(n),n.then(o,o))})}}function zb(t,e){var r=e.deletions;if(r!==null)for(var n=0;n<r.length;n++){var o=r[n];try{var i=t,a=e,s=a;e:for(;s!==null;){switch(s.tag){case 5:Ed=s.stateNode,qb=!1;break e;case 3:Ed=s.stateNode.containerInfo,qb=!0;break e;case 4:Ed=s.stateNode.containerInfo,qb=!0;break e}s=s.return}if(Ed===null)throw Error(qe(160));Uot(i,a,o),Ed=null,qb=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){Ds(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)qot(e,t),e=e.sibling}function qot(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(zb(e,t),zv(t),n&4){try{Q8(3,t,t.return),are(3,t)}catch(h){Ds(t,t.return,h)}try{Q8(5,t,t.return)}catch(h){Ds(t,t.return,h)}}break;case 1:zb(e,t),zv(t),n&512&&r!==null&&Az(r,r.return);break;case 5:if(zb(e,t),zv(t),n&512&&r!==null&&Az(r,r.return),t.flags&32){var o=t.stateNode;try{n5(o,"")}catch(h){Ds(t,t.return,h)}}if(n&4&&(o=t.stateNode,o!=null)){var i=t.memoizedProps,a=r!==null?r.memoizedProps:i,s=t.type,u=t.updateQueue;if(t.updateQueue=null,u!==null)try{s==="input"&&i.type==="radio"&&i.name!=null&&cnt(o,i),TOe(s,a);var l=TOe(s,i);for(a=0;a<u.length;a+=2){var c=u[a],d=u[a+1];c==="style"?hnt(o,d):c==="dangerouslySetInnerHTML"?pnt(o,d):c==="children"?n5(o,d):dEe(o,c,d,l)}switch(s){case"input":SOe(o,i);break;case"textarea":dnt(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Mz(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?Mz(o,!!i.multiple,i.defaultValue,!0):Mz(o,!!i.multiple,i.multiple?[]:"",!1))}o[f5]=i}catch(h){Ds(t,t.return,h)}}break;case 6:if(zb(e,t),zv(t),n&4){if(t.stateNode===null)throw Error(qe(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(h){Ds(t,t.return,h)}}break;case 3:if(zb(e,t),zv(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{s5(e.containerInfo)}catch(h){Ds(t,t.return,h)}break;case 4:zb(e,t),zv(t);break;case 13:zb(e,t),zv(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(HEe=ou())),n&4&&Jrt(t);break;case 22:if(c=r!==null&&r.memoizedState!==null,t.mode&1?($f=(l=$f)||c,zb(e,t),$f=l):zb(e,t),zv(t),n&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&(t.mode&1)!==0)for(Tt=t,c=t.child;c!==null;){for(d=Tt=c;Tt!==null;){switch(f=Tt,p=f.child,f.tag){case 0:case 11:case 14:case 15:Q8(4,f,f.return);break;case 1:Az(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){n=f,r=f.return;try{e=n,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(h){Ds(n,r,h)}}break;case 5:Az(f,f.return);break;case 22:if(f.memoizedState!==null){Yrt(d);continue}}p!==null?(p.return=f,Tt=p):Yrt(d)}c=c.sibling}e:for(c=null,d=t;;){if(d.tag===5){if(c===null){c=d;try{o=d.stateNode,l?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(s=d.stateNode,u=d.memoizedProps.style,a=u!=null&&u.hasOwnProperty("display")?u.display:null,s.style.display=mnt("display",a))}catch(h){Ds(t,t.return,h)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(h){Ds(t,t.return,h)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:zb(e,t),zv(t),n&4&&Jrt(t);break;case 21:break;default:zb(e,t),zv(t)}}function zv(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(zot(r)){var n=r;break e}r=r.return}throw Error(qe(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(n5(o,""),n.flags&=-33);var i=Grt(t);oEe(t,i,o);break;case 3:case 4:var a=n.stateNode.containerInfo,s=Grt(t);nEe(t,s,a);break;default:throw Error(qe(161))}}catch(u){Ds(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function YIr(t,e,r){Tt=t,Hot(t,e,r)}function Hot(t,e,r){for(var n=(t.mode&1)!==0;Tt!==null;){var o=Tt,i=o.child;if(o.tag===22&&n){var a=o.memoizedState!==null||gte;if(!a){var s=o.alternate,u=s!==null&&s.memoizedState!==null||$f;s=gte;var l=$f;if(gte=a,($f=u)&&!l)for(Tt=o;Tt!==null;)a=Tt,u=a.child,a.tag===22&&a.memoizedState!==null?Xrt(o):u!==null?(u.return=a,Tt=u):Xrt(o);for(;i!==null;)Tt=i,Hot(i,e,r),i=i.sibling;Tt=o,gte=s,$f=l}Zrt(t,e,r)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,Tt=i):Zrt(t,e,r)}}function Zrt(t){for(;Tt!==null;){var e=Tt;if((e.flags&8772)!==0){var r=e.alternate;try{if((e.flags&8772)!==0)switch(e.tag){case 0:case 11:case 15:$f||are(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!$f)if(r===null)n.componentDidMount();else{var o=e.elementType===e.type?r.memoizedProps:Ub(e.type,r.memoizedProps);n.componentDidUpdate(o,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&Nrt(e,i,n);break;case 3:var a=e.updateQueue;if(a!==null){if(r=null,e.child!==null)switch(e.child.tag){case 5:r=e.child.stateNode;break;case 1:r=e.child.stateNode}Nrt(e,a,r)}break;case 5:var s=e.stateNode;if(r===null&&e.flags&4){r=s;var u=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&r.focus();break;case"img":u.src&&(r.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var l=e.alternate;if(l!==null){var c=l.memoizedState;if(c!==null){var d=c.dehydrated;d!==null&&s5(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(qe(163))}$f||e.flags&512&&rEe(e)}catch(f){Ds(e,e.return,f)}}if(e===t){Tt=null;break}if(r=e.sibling,r!==null){r.return=e.return,Tt=r;break}Tt=e.return}}function Yrt(t){for(;Tt!==null;){var e=Tt;if(e===t){Tt=null;break}var r=e.sibling;if(r!==null){r.return=e.return,Tt=r;break}Tt=e.return}}function Xrt(t){for(;Tt!==null;){var e=Tt;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{are(4,e)}catch(u){Ds(e,r,u)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var o=e.return;try{n.componentDidMount()}catch(u){Ds(e,o,u)}}var i=e.return;try{rEe(e)}catch(u){Ds(e,i,u)}break;case 5:var a=e.return;try{rEe(e)}catch(u){Ds(e,a,u)}}}catch(u){Ds(e,e.return,u)}if(e===t){Tt=null;break}var s=e.sibling;if(s!==null){s.return=e.return,Tt=s;break}Tt=e.return}}var XIr=Math.ceil,Kte=VE.ReactCurrentDispatcher,UEe=VE.ReactCurrentOwner,sy=VE.ReactCurrentBatchConfig,ko=0,$c=null,Cu=null,Pd=0,kh=0,Iz=AI(0),dc=0,b5=null,iD=0,sre=0,qEe=0,e5=null,jm=null,HEe=0,qz=1/0,LE=null,Gte=!1,iEe=null,SI=null,yte=!1,yI=null,Jte=0,t5=0,aEe=null,Ote=-1,Ete=0;function Fp(){return(ko&6)!==0?ou():Ote!==-1?Ote:Ote=ou()}function CI(t){return(t.mode&1)===0?1:(ko&2)!==0&&Pd!==0?Pd&-Pd:DIr.transition!==null?(Ete===0&&(Ete=Pnt()),Ete):(t=ki,t!==0||(t=window.event,t=t===void 0?16:jnt(t.type)),t)}function Wb(t,e,r,n){if(50<t5)throw t5=0,aEe=null,Error(qe(185));_5(t,r,n),((ko&2)===0||t!==$c)&&(t===$c&&((ko&2)===0&&(sre|=r),dc===4&&hI(t,Pd)),km(t,n),r===1&&ko===0&&(e.mode&1)===0&&(qz=ou()+500,nre&&II()))}function km(t,e){var r=t.callbackNode;FAr(t,e);var n=Rte(t,t===$c?Pd:0);if(n===0)r!==null&&art(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&art(r),e===1)t.tag===0?jIr(Qrt.bind(null,t)):Qnt(Qrt.bind(null,t)),IIr(function(){(ko&6)===0&&II()}),r=null;else{switch(Tnt(n)){case 1:r=gEe;break;case 4:r=Ont;break;case 16:r=Mte;break;case 536870912:r=Ent;break;default:r=Mte}r=Xot(r,Vot.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function Vot(t,e){if(Ote=-1,Ete=0,(ko&6)!==0)throw Error(qe(327));var r=t.callbackNode;if(Lz()&&t.callbackNode!==r)return null;var n=Rte(t,t===$c?Pd:0);if(n===0)return null;if((n&30)!==0||(n&t.expiredLanes)!==0||e)e=Zte(t,n);else{e=n;var o=ko;ko|=2;var i=Kot();($c!==t||Pd!==e)&&(LE=null,qz=ou()+500,eD(t,e));do try{tMr();break}catch(s){Wot(t,s)}while(!0);AEe(),Kte.current=i,ko=o,Cu!==null?e=0:($c=null,Pd=0,e=dc)}if(e!==0){if(e===2&&(o=NOe(t),o!==0&&(n=o,e=sEe(t,o))),e===1)throw r=b5,eD(t,0),hI(t,n),km(t,ou()),r;if(e===6)hI(t,n);else{if(o=t.current.alternate,(n&30)===0&&!QIr(o)&&(e=Zte(t,n),e===2&&(i=NOe(t),i!==0&&(n=i,e=sEe(t,i))),e===1))throw r=b5,eD(t,0),hI(t,n),km(t,ou()),r;switch(t.finishedWork=o,t.finishedLanes=n,e){case 0:case 1:throw Error(qe(345));case 2:Zj(t,jm,LE);break;case 3:if(hI(t,n),(n&130023424)===n&&(e=HEe+500-ou(),10<e)){if(Rte(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){Fp(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=zOe(Zj.bind(null,t,jm,LE),e);break}Zj(t,jm,LE);break;case 4:if(hI(t,n),(n&4194240)===n)break;for(e=t.eventTimes,o=-1;0<n;){var a=31-Vb(n);i=1<<a,a=e[a],a>o&&(o=a),n&=~i}if(n=o,n=ou()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*XIr(n/1960))-n,10<n){t.timeoutHandle=zOe(Zj.bind(null,t,jm,LE),n);break}Zj(t,jm,LE);break;case 5:Zj(t,jm,LE);break;default:throw Error(qe(329))}}}return km(t,ou()),t.callbackNode===r?Vot.bind(null,t):null}function sEe(t,e){var r=e5;return t.current.memoizedState.isDehydrated&&(eD(t,e).flags|=256),t=Zte(t,e),t!==2&&(e=jm,jm=r,e!==null&&uEe(e)),t}function uEe(t){jm===null?jm=t:jm.push.apply(jm,t)}function QIr(t){for(var e=t;;){if(e.flags&16384){var r=e.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var o=r[n],i=o.getSnapshot;o=o.value;try{if(!Kb(i(),o))return!1}catch{return!1}}}if(r=e.child,e.subtreeFlags&16384&&r!==null)r.return=e,e=r;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function hI(t,e){for(e&=~qEe,e&=~sre,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-Vb(e),n=1<<r;t[r]=-1,e&=~n}}function Qrt(t){if((ko&6)!==0)throw Error(qe(327));Lz();var e=Rte(t,0);if((e&1)===0)return km(t,ou()),null;var r=Zte(t,e);if(t.tag!==0&&r===2){var n=NOe(t);n!==0&&(e=n,r=sEe(t,n))}if(r===1)throw r=b5,eD(t,0),hI(t,e),km(t,ou()),r;if(r===6)throw Error(qe(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Zj(t,jm,LE),km(t,ou()),null}function VEe(t,e){var r=ko;ko|=1;try{return t(e)}finally{ko=r,ko===0&&(qz=ou()+500,nre&&II())}}function aD(t){yI!==null&&yI.tag===0&&(ko&6)===0&&Lz();var e=ko;ko|=1;var r=sy.transition,n=ki;try{if(sy.transition=null,ki=1,t)return t()}finally{ki=n,sy.transition=r,ko=e,(ko&6)===0&&II()}}function WEe(){kh=Iz.current,Sa(Iz)}function eD(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,AIr(r)),Cu!==null)for(r=Cu.return;r!==null;){var n=r;switch(EEe(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Fte();break;case 3:zz(),Sa(Lm),Sa(Bf),DEe();break;case 5:jEe(n);break;case 4:zz();break;case 13:Sa(us);break;case 19:Sa(us);break;case 10:IEe(n.type._context);break;case 22:case 23:WEe()}r=r.return}if($c=t,Cu=t=OI(t.current,null),Pd=kh=e,dc=0,b5=null,qEe=sre=iD=0,jm=e5=null,Xj!==null){for(e=0;e<Xj.length;e++)if(r=Xj[e],n=r.interleaved,n!==null){r.interleaved=null;var o=n.next,i=r.pending;if(i!==null){var a=i.next;i.next=o,n.next=a}r.pending=n}Xj=null}return t}function Wot(t,e){do{var r=Cu;try{if(AEe(),xte.current=Wte,Vte){for(var n=ls.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}Vte=!1}if(oD=0,kc=cc=ls=null,X8=!1,h5=0,UEe.current=null,r===null||r.return===null){dc=1,b5=e,Cu=null;break}e:{var i=t,a=r.return,s=r,u=e;if(e=Pd,s.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var l=u,c=s,d=c.tag;if((c.mode&1)===0&&(d===0||d===11||d===15)){var f=c.alternate;f?(c.updateQueue=f.updateQueue,c.memoizedState=f.memoizedState,c.lanes=f.lanes):(c.updateQueue=null,c.memoizedState=null)}var p=Brt(a);if(p!==null){p.flags&=-257,zrt(p,a,s,i,e),p.mode&1&&$rt(i,l,e),e=p,u=l;var m=e.updateQueue;if(m===null){var h=new Set;h.add(u),e.updateQueue=h}else m.add(u);break e}else{if((e&1)===0){$rt(i,l,e),KEe();break e}u=Error(qe(426))}}else if(Ua&&s.mode&1){var y=Brt(a);if(y!==null){(y.flags&65536)===0&&(y.flags|=256),zrt(y,a,s,i,e),PEe(Uz(u,s));break e}}i=u=Uz(u,s),dc!==4&&(dc=2),e5===null?e5=[i]:e5.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var g=Aot(i,u,e);Rrt(i,g);break e;case 1:s=u;var _=i.type,w=i.stateNode;if((i.flags&128)===0&&(typeof _.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(SI===null||!SI.has(w)))){i.flags|=65536,e&=-e,i.lanes|=e;var S=Iot(i,s,e);Rrt(i,S);break e}}i=i.return}while(i!==null)}Jot(r)}catch(C){e=C,Cu===r&&r!==null&&(Cu=r=r.return);continue}break}while(!0)}function Kot(){var t=Kte.current;return Kte.current=Wte,t===null?Wte:t}function KEe(){(dc===0||dc===3||dc===2)&&(dc=4),$c===null||(iD&268435455)===0&&(sre&268435455)===0||hI($c,Pd)}function Zte(t,e){var r=ko;ko|=2;var n=Kot();($c!==t||Pd!==e)&&(LE=null,eD(t,e));do try{eMr();break}catch(o){Wot(t,o)}while(!0);if(AEe(),ko=r,Kte.current=n,Cu!==null)throw Error(qe(261));return $c=null,Pd=0,dc}function eMr(){for(;Cu!==null;)Got(Cu)}function tMr(){for(;Cu!==null&&!TAr();)Got(Cu)}function Got(t){var e=Yot(t.alternate,t,kh);t.memoizedProps=t.pendingProps,e===null?Jot(t):Cu=e,UEe.current=null}function Jot(t){var e=t;do{var r=e.alternate;if(t=e.return,(e.flags&32768)===0){if(r=KIr(r,e,kh),r!==null){Cu=r;return}}else{if(r=GIr(r,e),r!==null){r.flags&=32767,Cu=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{dc=6,Cu=null;return}}if(e=e.sibling,e!==null){Cu=e;return}Cu=e=t}while(e!==null);dc===0&&(dc=5)}function Zj(t,e,r){var n=ki,o=sy.transition;try{sy.transition=null,ki=1,rMr(t,e,r,n)}finally{sy.transition=o,ki=n}return null}function rMr(t,e,r,n){do Lz();while(yI!==null);if((ko&6)!==0)throw Error(qe(327));r=t.finishedWork;var o=t.finishedLanes;if(r===null)return null;if(t.finishedWork=null,t.finishedLanes=0,r===t.current)throw Error(qe(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(kAr(t,i),t===$c&&(Cu=$c=null,Pd=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||yte||(yte=!0,Xot(Mte,function(){return Lz(),null})),i=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||i){i=sy.transition,sy.transition=null;var a=ki;ki=1;var s=ko;ko|=4,UEe.current=null,ZIr(t,r),qot(r,t),CIr($Oe),Nte=!!kOe,$Oe=kOe=null,t.current=r,YIr(r,t,o),AAr(),ko=s,ki=a,sy.transition=i}else t.current=r;if(yte&&(yte=!1,yI=t,Jte=o),i=t.pendingLanes,i===0&&(SI=null),RAr(r.stateNode,n),km(t,ou()),e!==null)for(n=t.onRecoverableError,r=0;r<e.length;r++)o=e[r],n(o.value,{componentStack:o.stack,digest:o.digest});if(Gte)throw Gte=!1,t=iEe,iEe=null,t;return(Jte&1)!==0&&t.tag!==0&&Lz(),i=t.pendingLanes,(i&1)!==0?t===aEe?t5++:(t5=0,aEe=t):t5=0,II(),null}function Lz(){if(yI!==null){var t=Tnt(Jte),e=sy.transition,r=ki;try{if(sy.transition=null,ki=16>t?16:t,yI===null)var n=!1;else{if(t=yI,yI=null,Jte=0,(ko&6)!==0)throw Error(qe(331));var o=ko;for(ko|=4,Tt=t.current;Tt!==null;){var i=Tt,a=i.child;if((Tt.flags&16)!==0){var s=i.deletions;if(s!==null){for(var u=0;u<s.length;u++){var l=s[u];for(Tt=l;Tt!==null;){var c=Tt;switch(c.tag){case 0:case 11:case 15:Q8(8,c,i)}var d=c.child;if(d!==null)d.return=c,Tt=d;else for(;Tt!==null;){c=Tt;var f=c.sibling,p=c.return;if(Bot(c),c===l){Tt=null;break}if(f!==null){f.return=p,Tt=f;break}Tt=p}}}var m=i.alternate;if(m!==null){var h=m.child;if(h!==null){m.child=null;do{var y=h.sibling;h.sibling=null,h=y}while(h!==null)}}Tt=i}}if((i.subtreeFlags&2064)!==0&&a!==null)a.return=i,Tt=a;else e:for(;Tt!==null;){if(i=Tt,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:Q8(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,Tt=g;break e}Tt=i.return}}var _=t.current;for(Tt=_;Tt!==null;){a=Tt;var w=a.child;if((a.subtreeFlags&2064)!==0&&w!==null)w.return=a,Tt=w;else e:for(a=_;Tt!==null;){if(s=Tt,(s.flags&2048)!==0)try{switch(s.tag){case 0:case 11:case 15:are(9,s)}}catch(C){Ds(s,s.return,C)}if(s===a){Tt=null;break e}var S=s.sibling;if(S!==null){S.return=s.return,Tt=S;break e}Tt=s.return}}if(ko=o,II(),Hv&&typeof Hv.onPostCommitFiberRoot=="function")try{Hv.onPostCommitFiberRoot(Xte,t)}catch{}n=!0}return n}finally{ki=r,sy.transition=e}}return!1}function ent(t,e,r){e=Uz(r,e),e=Aot(t,e,1),t=xI(t,e,1),e=Fp(),t!==null&&(_5(t,1,e),km(t,e))}function Ds(t,e,r){if(t.tag===3)ent(t,t,r);else for(;e!==null;){if(e.tag===3){ent(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(SI===null||!SI.has(n))){t=Uz(r,t),t=Iot(e,t,1),e=xI(e,t,1),t=Fp(),e!==null&&(_5(e,1,t),km(e,t));break}}e=e.return}}function nMr(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=Fp(),t.pingedLanes|=t.suspendedLanes&r,$c===t&&(Pd&r)===r&&(dc===4||dc===3&&(Pd&130023424)===Pd&&500>ou()-HEe?eD(t,0):qEe|=r),km(t,e)}function Zot(t,e){e===0&&((t.mode&1)===0?e=1:(e=nte,nte<<=1,(nte&130023424)===0&&(nte=4194304)));var r=Fp();t=qE(t,e),t!==null&&(_5(t,e,r),km(t,r))}function oMr(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),Zot(t,r)}function iMr(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,o=t.memoizedState;o!==null&&(r=o.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(qe(314))}n!==null&&n.delete(e),Zot(t,r)}var Yot;Yot=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||Lm.current)Dm=!0;else{if((t.lanes&r)===0&&(e.flags&128)===0)return Dm=!1,WIr(t,e,r);Dm=(t.flags&131072)!==0}else Dm=!1,Ua&&(e.flags&1048576)!==0&&eot(e,Bte,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;Cte(t,e),t=e.pendingProps;var o=kz(e,Bf.current);Dz(e,r),o=FEe(null,e,n,t,o,r);var i=kEe();return e.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Fm(n)?(i=!0,kte(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,REe(e),o.updater=ore,e.stateNode=o,o._reactInternals=e,GOe(e,n,t,r),e=YOe(null,e,n,!0,i,r)):(e.tag=0,Ua&&i&&OEe(e),Lp(null,e,o,r),e=e.child),e;case 16:n=e.elementType;e:{switch(Cte(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=sMr(n),t=Ub(n,t),o){case 0:e=ZOe(null,e,n,t,r);break e;case 1:e=Hrt(null,e,n,t,r);break e;case 11:e=Urt(null,e,n,t,r);break e;case 14:e=qrt(null,e,n,Ub(n.type,t),r);break e}throw Error(qe(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:Ub(n,o),ZOe(t,e,n,o,r);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:Ub(n,o),Hrt(t,e,n,o,r);case 3:e:{if(jot(e),t===null)throw Error(qe(387));n=e.pendingProps,i=e.memoizedState,o=i.element,oot(t,e),qte(e,n,null,r);var a=e.memoizedState;if(n=a.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){o=Uz(Error(qe(423)),e),e=Vrt(t,e,n,r,o);break e}else if(n!==o){o=Uz(Error(qe(424)),e),e=Vrt(t,e,n,r,o);break e}else for($h=wI(e.stateNode.containerInfo.firstChild),Bh=e,Ua=!0,Hb=null,r=uot(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if($z(),n===o){e=HE(t,e,r);break e}Lp(t,e,n,r)}e=e.child}return e;case 5:return lot(e),t===null&&VOe(e),n=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,a=o.children,BOe(n,o)?a=null:i!==null&&BOe(n,i)&&(e.flags|=32),Not(t,e),Lp(t,e,a,r),e.child;case 6:return t===null&&VOe(e),null;case 13:return Dot(t,e,r);case 4:return NEe(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Bz(e,null,n,r):Lp(t,e,n,r),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:Ub(n,o),Urt(t,e,n,o,r);case 7:return Lp(t,e,e.pendingProps,r),e.child;case 8:return Lp(t,e,e.pendingProps.children,r),e.child;case 12:return Lp(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,o=e.pendingProps,i=e.memoizedProps,a=o.value,da(zte,n._currentValue),n._currentValue=a,i!==null)if(Kb(i.value,a)){if(i.children===o.children&&!Lm.current){e=HE(t,e,r);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var s=i.dependencies;if(s!==null){a=i.child;for(var u=s.firstContext;u!==null;){if(u.context===n){if(i.tag===1){u=BE(-1,r&-r),u.tag=2;var l=i.updateQueue;if(l!==null){l=l.shared;var c=l.pending;c===null?u.next=u:(u.next=c.next,c.next=u),l.pending=u}}i.lanes|=r,u=i.alternate,u!==null&&(u.lanes|=r),WOe(i.return,r,e),s.lanes|=r;break}u=u.next}}else if(i.tag===10)a=i.type===e.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(qe(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),WOe(a,r,e),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===e){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Lp(t,e,o.children,r),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,Dz(e,r),o=uy(o),n=n(o),e.flags|=1,Lp(t,e,n,r),e.child;case 14:return n=e.type,o=Ub(n,e.pendingProps),o=Ub(n.type,o),qrt(t,e,n,o,r);case 15:return Mot(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:Ub(n,o),Cte(t,e),e.tag=1,Fm(n)?(t=!0,kte(e)):t=!1,Dz(e,r),aot(e,n,o),GOe(e,n,o,r),YOe(null,e,n,!0,t,r);case 19:return Lot(t,e,r);case 22:return Rot(t,e,r)}throw Error(qe(156,e.tag))};function Xot(t,e){return Cnt(t,e)}function aMr(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ay(t,e,r,n){return new aMr(t,e,r,n)}function GEe(t){return t=t.prototype,!(!t||!t.isReactComponent)}function sMr(t){if(typeof t=="function")return GEe(t)?1:0;if(t!=null){if(t=t.$$typeof,t===pEe)return 11;if(t===mEe)return 14}return 2}function OI(t,e){var r=t.alternate;return r===null?(r=ay(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function Pte(t,e,r,n,o,i){var a=2;if(n=t,typeof t=="function")GEe(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case vz:return tD(r.children,o,i,e);case fEe:a=8,o|=8;break;case bOe:return t=ay(12,r,e,o|2),t.elementType=bOe,t.lanes=i,t;case _Oe:return t=ay(13,r,e,o),t.elementType=_Oe,t.lanes=i,t;case vOe:return t=ay(19,r,e,o),t.elementType=vOe,t.lanes=i,t;case snt:return ure(r,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case int:a=10;break e;case ant:a=9;break e;case pEe:a=11;break e;case mEe:a=14;break e;case fI:a=16,n=null;break e}throw Error(qe(130,t==null?t:typeof t,""))}return e=ay(a,r,e,o),e.elementType=t,e.type=n,e.lanes=i,e}function tD(t,e,r,n){return t=ay(7,t,n,e),t.lanes=r,t}function ure(t,e,r,n){return t=ay(22,t,n,e),t.elementType=snt,t.lanes=r,t.stateNode={isHidden:!1},t}function hOe(t,e,r){return t=ay(6,t,null,e),t.lanes=r,t}function gOe(t,e,r){return e=ay(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function uMr(t,e,r,n,o){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=QCe(0),this.expirationTimes=QCe(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=QCe(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function JEe(t,e,r,n,o,i,a,s,u){return t=new uMr(t,e,r,s,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=ay(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},REe(i),t}function lMr(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_z,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function Qot(t){if(!t)return PI;t=t._reactInternals;e:{if(uD(t)!==t||t.tag!==1)throw Error(qe(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Fm(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(qe(171))}if(t.tag===1){var r=t.type;if(Fm(r))return Xnt(t,r,e)}return e}function eit(t,e,r,n,o,i,a,s,u){return t=JEe(r,n,!0,t,o,i,a,s,u),t.context=Qot(null),r=t.current,n=Fp(),o=CI(r),i=BE(n,o),i.callback=e??null,xI(r,i,o),t.current.lanes=o,_5(t,o,n),km(t,n),t}function lre(t,e,r,n){var o=e.current,i=Fp(),a=CI(o);return r=Qot(r),e.context===null?e.context=r:e.pendingContext=r,e=BE(i,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=xI(o,e,a),t!==null&&(Wb(t,o,a,i),wte(t,o,a)),a}function Yte(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function tnt(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function ZEe(t,e){tnt(t,e),(t=t.alternate)&&tnt(t,e)}function cMr(){return null}var tit=typeof reportError=="function"?reportError:function(t){console.error(t)};function YEe(t){this._internalRoot=t}cre.prototype.render=YEe.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(qe(409));lre(t,e,null,null)};cre.prototype.unmount=YEe.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;aD(function(){lre(null,t,null,null)}),e[UE]=null}};function cre(t){this._internalRoot=t}cre.prototype.unstable_scheduleHydration=function(t){if(t){var e=Mnt();t={blockedOn:null,target:t,priority:e};for(var r=0;r<mI.length&&e!==0&&e<mI[r].priority;r++);mI.splice(r,0,t),r===0&&Nnt(t)}};function XEe(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function dre(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function rnt(){}function dMr(t,e,r,n,o){if(o){if(typeof n=="function"){var i=n;n=function(){var l=Yte(a);i.call(l)}}var a=eit(e,n,t,0,null,!1,!1,"",rnt);return t._reactRootContainer=a,t[UE]=a.current,c5(t.nodeType===8?t.parentNode:t),aD(),a}for(;o=t.lastChild;)t.removeChild(o);if(typeof n=="function"){var s=n;n=function(){var l=Yte(u);s.call(l)}}var u=JEe(t,0,!1,null,null,!1,!1,"",rnt);return t._reactRootContainer=u,t[UE]=u.current,c5(t.nodeType===8?t.parentNode:t),aD(function(){lre(e,u,r,n)}),u}function fre(t,e,r,n,o){var i=r._reactRootContainer;if(i){var a=i;if(typeof o=="function"){var s=o;o=function(){var u=Yte(a);s.call(u)}}lre(e,a,t,o)}else a=dMr(r,e,t,o,n);return Yte(a)}Ant=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=V8(e.pendingLanes);r!==0&&(yEe(e,r|1),km(e,ou()),(ko&6)===0&&(qz=ou()+500,II()))}break;case 13:aD(function(){var n=qE(t,1);if(n!==null){var o=Fp();Wb(n,t,1,o)}}),ZEe(t,1)}};bEe=function(t){if(t.tag===13){var e=qE(t,134217728);if(e!==null){var r=Fp();Wb(e,t,134217728,r)}ZEe(t,134217728)}};Int=function(t){if(t.tag===13){var e=CI(t),r=qE(t,e);if(r!==null){var n=Fp();Wb(r,t,e,n)}ZEe(t,e)}};Mnt=function(){return ki};Rnt=function(t,e){var r=ki;try{return ki=t,e()}finally{ki=r}};IOe=function(t,e,r){switch(e){case"input":if(SOe(t,r),e=r.name,r.type==="radio"&&e!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<r.length;e++){var n=r[e];if(n!==t&&n.form===t.form){var o=rre(n);if(!o)throw Error(qe(90));lnt(n),SOe(n,o)}}}break;case"textarea":dnt(t,r);break;case"select":e=r.value,e!=null&&Mz(t,!!r.multiple,e,!1)}};bnt=VEe;_nt=aD;var fMr={usingClientEntryPoint:!1,Events:[w5,Cz,rre,gnt,ynt,VEe]},z8={findFiberByHostInstance:Yj,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},pMr={bundleType:z8.bundleType,version:z8.version,rendererPackageName:z8.rendererPackageName,rendererConfig:z8.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:VE.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=xnt(t),t===null?null:t.stateNode},findFiberByHostInstance:z8.findFiberByHostInstance||cMr,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(U8=__REACT_DEVTOOLS_GLOBAL_HOOK__,!U8.isDisabled&&U8.supportsFiber))try{Xte=U8.inject(pMr),Hv=U8}catch{}var U8;qh.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=fMr;qh.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!XEe(e))throw Error(qe(200));return lMr(t,e,null,r)};qh.createRoot=function(t,e){if(!XEe(t))throw Error(qe(299));var r=!1,n="",o=tit;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=JEe(t,1,!1,null,null,r,!1,n,o),t[UE]=e.current,c5(t.nodeType===8?t.parentNode:t),new YEe(e)};qh.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(qe(188)):(t=Object.keys(t).join(","),Error(qe(268,t)));return t=xnt(e),t=t===null?null:t.stateNode,t};qh.flushSync=function(t){return aD(t)};qh.hydrate=function(t,e,r){if(!dre(e))throw Error(qe(200));return fre(null,t,e,!0,r)};qh.hydrateRoot=function(t,e,r){if(!XEe(t))throw Error(qe(405));var n=r!=null&&r.hydratedSources||null,o=!1,i="",a=tit;if(r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),e=eit(e,null,t,1,r??null,o,!1,i,a),t[UE]=e.current,c5(t),n)for(t=0;t<n.length;t++)r=n[t],o=r._getVersion,o=o(r._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[r,o]:e.mutableSourceEagerHydrationData.push(r,o);return new cre(e)};qh.render=function(t,e,r){if(!dre(e))throw Error(qe(200));return fre(null,t,e,!1,r)};qh.unmountComponentAtNode=function(t){if(!dre(t))throw Error(qe(40));return t._reactRootContainer?(aD(function(){fre(null,null,t,!1,function(){t._reactRootContainer=null,t[UE]=null})}),!0):!1};qh.unstable_batchedUpdates=VEe;qh.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!dre(r))throw Error(qe(200));if(t==null||t._reactInternals===void 0)throw Error(qe(38));return fre(t,e,r,!1,n)};qh.version="18.2.0-next-9e3b772b8-20220608"});var qa=x((Ruo,oit)=>{"use strict";function nit(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(nit)}catch(t){console.error(t)}}nit(),oit.exports=rit()});var Bc=x(QEe=>{"use strict";var iit=qa();QEe.createRoot=iit.createRoot,QEe.hydrateRoot=iit.hydrateRoot;var Nuo});function ait(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function sit(...t){return e=>{let r=!1,n=t.map(o=>{let i=ait(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():ait(t[o],null)}}}}var mMr,uit=b(()=>{mMr=j(Z(),1)});var cit=x(pre=>{"use strict";var hMr=Z(),gMr=Symbol.for("react.element"),yMr=Symbol.for("react.fragment"),bMr=Object.prototype.hasOwnProperty,_Mr=hMr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,vMr={key:!0,ref:!0,__self:!0,__source:!0};function lit(t,e,r){var n,o={},i=null,a=null;r!==void 0&&(i=""+r),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(a=e.ref);for(n in e)bMr.call(e,n)&&!vMr.hasOwnProperty(n)&&(o[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)o[n]===void 0&&(o[n]=e[n]);return{$$typeof:gMr,type:t,key:i,ref:a,props:o,_owner:_Mr.current}}pre.Fragment=yMr;pre.jsx=lit;pre.jsxs=lit});var at=x((Fuo,dit)=>{"use strict";dit.exports=cit()});function zf(t){let e=wMr(t),r=fc.forwardRef((n,o)=>{let{children:i,...a}=n,s=fc.Children.toArray(i),u=s.find(xMr);if(u){let l=u.props.children,c=s.map(d=>d===u?fc.Children.count(l)>1?fc.Children.only(null):fc.isValidElement(l)?l.props.children:null:d);return(0,Wz.jsx)(e,{...a,ref:o,children:fc.isValidElement(l)?fc.cloneElement(l,void 0,c):null})}return(0,Wz.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function wMr(t){let e=fc.forwardRef((r,n)=>{let{children:o,...i}=r;if(fc.isValidElement(o)){let a=CMr(o),s=SMr(i,o.props);return o.type!==fc.Fragment&&(s.ref=n?sit(n,a):a),fc.cloneElement(o,s)}return fc.Children.count(o)>1?fc.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}function mit(t){let e=({children:r})=>(0,Wz.jsx)(Wz.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=pit,e}function xMr(t){return fc.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===pit}function SMr(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function CMr(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var fc,Wz,fit,pit,Wv=b(()=>{fc=j(Z(),1);uit();Wz=j(at(),1);fit=zf("Slot");pit=Symbol("radix.slottable")});function hit(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(r=hit(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function mre(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=hit(t))&&(n&&(n+=" "),n+=e);return n}var ePe=b(()=>{});var git,yit,Kz,hre=b(()=>{ePe();git=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,yit=mre,Kz=(t,e)=>r=>{var n;if(e?.variants==null)return yit(t,r?.class,r?.className);let{variants:o,defaultVariants:i}=e,a=Object.keys(o).map(l=>{let c=r?.[l],d=i?.[l];if(c===null)return null;let f=git(c)||git(d);return o[l][f]}),s=r&&Object.entries(r).reduce((l,c)=>{let[d,f]=c;return f===void 0||(l[d]=f),l},{}),u=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((l,c)=>{let{class:d,className:f,...p}=c;return Object.entries(p).every(m=>{let[h,y]=m;return Array.isArray(y)?y.includes({...i,...s}[h]):{...i,...s}[h]===y})?[...l,d,f]:l},[]);return yit(t,a,u,r?.class,r?.className)}});function LMr(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=Cit(e))&&(n&&(n+=" "),n+=r);return n}function vit(t,...e){let r,n,o,i=a;function a(u){let l=e.reduce((c,d)=>d(c),t());return r=NMr(l),n=r.cache.get,o=r.cache.set,i=s,s(u)}function s(u){let l=n(u);if(l)return l;let c=DMr(u,r);return o(u,c),c}return function(){return i(LMr.apply(null,arguments))}}var nPe,OMr,xit,bit,EMr,PMr,rPe,_it,TMr,AMr,IMr,Sit,MMr,RMr,NMr,jMr,DMr,Cit,Ca,Oit,FMr,kMr,$Mr,BMr,zMr,UMr,qMr,WE,MI,Gz,tPe,S5,HMr,bn,RI,VMr,WMr,KMr,GMr,JMr,ZMr,C5,Jz,YMr,Eit,XMr,QMr,wit,eRr,O5,tRr,rRr,Pit,Tit=b(()=>{nPe="-",OMr=t=>{let e=PMr(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{let s=a.split(nPe);return s[0]===""&&s.length!==1&&s.shift(),xit(s,e)||EMr(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},xit=(t,e)=>{if(t.length===0)return e.classGroupId;let r=t[0],n=e.nextPart.get(r),o=n?xit(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(nPe);return e.validators.find(({validator:a})=>a(i))?.classGroupId},bit=/^\[(.+)\]$/,EMr=t=>{if(bit.test(t)){let e=bit.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},PMr=t=>{let{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return AMr(Object.entries(t.classGroups),r).forEach(([i,a])=>{rPe(a,n,i,e)}),n},rPe=(t,e,r,n)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:_it(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(TMr(o)){rPe(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{rPe(a,_it(e,i),r,n)})})},_it=(t,e)=>{let r=t;return e.split(nPe).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},TMr=t=>t.isThemeGetter,AMr=(t,e)=>e?t.map(([r,n])=>{let o=n.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,s])=>[e+a,s])):i);return[r,o]}):t,IMr=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map,o=(i,a)=>{r.set(i,a),e++,e>t&&(e=0,n=r,r=new Map)};return{get(i){let a=r.get(i);if(a!==void 0)return a;if((a=n.get(i))!==void 0)return o(i,a),a},set(i,a){r.has(i)?r.set(i,a):o(i,a)}}},Sit="!",MMr=t=>{let{separator:e,experimentalParseClassName:r}=t,n=e.length===1,o=e[0],i=e.length,a=s=>{let u=[],l=0,c=0,d;for(let y=0;y<s.length;y++){let g=s[y];if(l===0){if(g===o&&(n||s.slice(y,y+i)===e)){u.push(s.slice(c,y)),c=y+i;continue}if(g==="/"){d=y;continue}}g==="["?l++:g==="]"&&l--}let f=u.length===0?s:s.substring(c),p=f.startsWith(Sit),m=p?f.substring(1):f,h=d&&d>c?d-c:void 0;return{modifiers:u,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:h}};return r?s=>r({className:s,parseClassName:a}):a},RMr=t=>{if(t.length<=1)return t;let e=[],r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},NMr=t=>({cache:IMr(t.cacheSize),parseClassName:MMr(t),...OMr(t)}),jMr=/\s+/,DMr=(t,e)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=e,i=[],a=t.trim().split(jMr),s="";for(let u=a.length-1;u>=0;u-=1){let l=a[u],{modifiers:c,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=r(l),m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){s=l+(s.length>0?" "+s:s);continue}if(h=n(f),!h){s=l+(s.length>0?" "+s:s);continue}m=!1}let y=RMr(c).join(":"),g=d?y+Sit:y,_=g+h;if(i.includes(_))continue;i.push(_);let w=o(h,m);for(let S=0;S<w.length;++S){let C=w[S];i.push(g+C)}s=l+(s.length>0?" "+s:s)}return s};Cit=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=Cit(t[n]))&&(r&&(r+=" "),r+=e);return r};Ca=t=>{let e=r=>r[t]||[];return e.isThemeGetter=!0,e},Oit=/^\[(?:([a-z-]+):)?(.+)\]$/i,FMr=/^\d+\/\d+$/,kMr=new Set(["px","full","screen"]),$Mr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,BMr=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,zMr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,UMr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qMr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,WE=t=>Gz(t)||kMr.has(t)||FMr.test(t),MI=t=>Jz(t,"length",YMr),Gz=t=>!!t&&!Number.isNaN(Number(t)),tPe=t=>Jz(t,"number",Gz),S5=t=>!!t&&Number.isInteger(Number(t)),HMr=t=>t.endsWith("%")&&Gz(t.slice(0,-1)),bn=t=>Oit.test(t),RI=t=>$Mr.test(t),VMr=new Set(["length","size","percentage"]),WMr=t=>Jz(t,VMr,Eit),KMr=t=>Jz(t,"position",Eit),GMr=new Set(["image","url"]),JMr=t=>Jz(t,GMr,QMr),ZMr=t=>Jz(t,"",XMr),C5=()=>!0,Jz=(t,e,r)=>{let n=Oit.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},YMr=t=>BMr.test(t)&&!zMr.test(t),Eit=()=>!1,XMr=t=>UMr.test(t),QMr=t=>qMr.test(t),wit=()=>{let t=Ca("colors"),e=Ca("spacing"),r=Ca("blur"),n=Ca("brightness"),o=Ca("borderColor"),i=Ca("borderRadius"),a=Ca("borderSpacing"),s=Ca("borderWidth"),u=Ca("contrast"),l=Ca("grayscale"),c=Ca("hueRotate"),d=Ca("invert"),f=Ca("gap"),p=Ca("gradientColorStops"),m=Ca("gradientColorStopPositions"),h=Ca("inset"),y=Ca("margin"),g=Ca("opacity"),_=Ca("padding"),w=Ca("saturate"),S=Ca("scale"),C=Ca("sepia"),E=Ca("skew"),P=Ca("space"),T=Ca("translate"),I=()=>["auto","contain","none"],N=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto",bn,e],D=()=>[bn,e],k=()=>["",WE,MI],L=()=>["auto",Gz,bn],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",bn],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ee=()=>[Gz,bn];return{cacheSize:500,separator:":",theme:{colors:[C5],spacing:[WE,MI],blur:["none","",RI,bn],brightness:ee(),borderColor:[t],borderRadius:["none","","full",RI,bn],borderSpacing:D(),borderWidth:k(),contrast:ee(),grayscale:F(),hueRotate:ee(),invert:F(),gap:D(),gradientColorStops:[t],gradientColorStopPositions:[HMr,MI],inset:M(),margin:M(),opacity:ee(),padding:D(),saturate:ee(),scale:ee(),sepia:F(),skew:ee(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",bn]}],container:["container"],columns:[{columns:[RI]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...H(),bn]}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",S5,bn]}],basis:[{basis:M()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",bn]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",S5,bn]}],"grid-cols":[{"grid-cols":[C5]}],"col-start-end":[{col:["auto",{span:["full",S5,bn]},bn]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[C5]}],"row-start-end":[{row:["auto",{span:[S5,bn]},bn]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",bn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",bn]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...X()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...X(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...X(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[_]}],px:[{px:[_]}],py:[{py:[_]}],ps:[{ps:[_]}],pe:[{pe:[_]}],pt:[{pt:[_]}],pr:[{pr:[_]}],pb:[{pb:[_]}],pl:[{pl:[_]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",bn,e]}],"min-w":[{"min-w":[bn,e,"min","max","fit"]}],"max-w":[{"max-w":[bn,e,"none","full","min","max","fit","prose",{screen:[RI]},RI]}],h:[{h:[bn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[bn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[bn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[bn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",RI,MI]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",tPe]}],"font-family":[{font:[C5]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",bn]}],"line-clamp":[{"line-clamp":["none",Gz,tPe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",WE,bn]}],"list-image":[{"list-image":["none",bn]}],"list-style-type":[{list:["none","disc","decimal",bn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",WE,MI]}],"underline-offset":[{"underline-offset":["auto",WE,bn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",bn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",bn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),KMr]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",WMr]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},JMr]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...K(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:K()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...K()]}],"outline-offset":[{"outline-offset":[WE,bn]}],"outline-w":[{outline:[WE,MI]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:k()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[WE,MI]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",RI,ZMr]}],"shadow-color":[{shadow:[C5]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",RI,bn]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",bn]}],duration:[{duration:ee()}],ease:[{ease:["linear","in","out","in-out",bn]}],delay:[{delay:ee()}],animate:[{animate:["none","spin","ping","pulse","bounce",bn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[S5,bn]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",bn]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",bn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",bn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[WE,MI,tPe]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},eRr=(t,{cacheSize:e,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{O5(t,"cacheSize",e),O5(t,"prefix",r),O5(t,"separator",n),O5(t,"experimentalParseClassName",o);for(let s in a)tRr(t[s],a[s]);for(let s in i)rRr(t[s],i[s]);return t},O5=(t,e,r)=>{r!==void 0&&(t[e]=r)},tRr=(t,e)=>{if(e)for(let r in e)O5(t,r,e[r])},rRr=(t,e)=>{if(e)for(let r in e){let n=e[r];n!==void 0&&(t[r]=(t[r]||[]).concat(n))}},Pit=(t,...e)=>typeof t=="function"?vit(wit,t,...e):vit(()=>eRr(wit(),t),...e)});function he(...t){return nRr(mre(t))}var nRr,dn=b(()=>{ePe();Tit();nRr=Pit({prefix:"tw-",extend:{classGroups:{"text-color":["text-muted","text-success","text-warning","text-error","text-accent"],"font-size":["text-smallest","text-smaller","text-small","text-ui-smaller","text-ui-small","text-ui-medium","text-ui-larger"]}}})});var gre,oRr,me,Un=b(()=>{gre=j(Z());Wv();hre();dn();oRr=Kz("tw-inline-flex tw-items-center tw-justify-center tw-gap-1 tw-whitespace-nowrap tw-rounded-md tw-text-sm tw-font-medium tw-transition-colors focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring disabled:tw-pointer-events-none disabled:tw-opacity-50 [&_svg]:tw-shrink-0",{variants:{variant:{default:"mod-cta tw-bg-interactive-accent tw-text-on-accent tw-shadow hover:tw-bg-interactive-accent-hover",destructive:"clickable-icon tw-bg-modifier-error tw-text-on-accent hover:tw-bg-modifier-error hover:tw-text-on-accent",secondary:"tw-bg-secondary tw-text-normal tw-shadow-sm hover:tw-bg-interactive-hover",ghost:"clickable-icon tw-bg-transparent hover:tw-bg-interactive-accent hover:tw-text-on-accent",link:"tw-text-accent tw-underline-offset-4 hover:tw-underline",success:"clickable-icon tw-bg-modifier-success tw-text-on-accent hover:tw-bg-modifier-success hover:tw-text-on-accent",ghost2:"clickable-icon tw-bg-transparent tw-text-faint tw-outline-none hover:tw-bg-transparent hover:tw-bg-opacity-100 hover:tw-text-normal focus-visible:tw-text-normal focus-visible:tw-outline-none focus-visible:tw-ring-0"},size:{default:"tw-h-9 tw-px-4 tw-py-2",sm:"tw-h-6 tw-rounded-md tw-px-3 tw-text-xs",lg:"tw-h-10 tw-rounded-md tw-px-8",icon:"tw-size-7",fit:"tw-gap-1 tw-px-1 tw-text-xs"}},defaultVariants:{variant:"default",size:"default"}}),me=gre.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...o},i)=>gre.createElement(n?fit:"button",{className:he(oRr({variant:e,size:r,className:t})),ref:i,...o}));me.displayName="Button"});var Ait,yre,oPe=b(()=>{Ait=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),yre=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim()});var Iit,Mit=b(()=>{Iit={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}});var E5,Rit,Nit=b(()=>{E5=j(Z());Mit();oPe();Rit=(0,E5.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,E5.createElement)("svg",{ref:u,...Iit,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:yre("lucide",o),...s},[...a.map(([l,c])=>(0,E5.createElement)(l,c)),...Array.isArray(i)?i:[i]]))});var bre,ye,Ot=b(()=>{bre=j(Z());oPe();Nit();ye=(t,e)=>{let r=(0,bre.forwardRef)(({className:n,...o},i)=>(0,bre.createElement)(Rit,{ref:i,iconNode:e,className:yre(`lucide-${Ait(t)}`,n),...o}));return r.displayName=`${t}`,r}});var Zz,jit=b(()=>{Ot();Zz=ye("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]])});var P5,Dit=b(()=>{Ot();P5=ye("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])});var T5,Lit=b(()=>{Ot();T5=ye("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])});var Yz,Fit=b(()=>{Ot();Yz=ye("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]])});var ds,kit=b(()=>{Ot();ds=ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])});var $i,$it=b(()=>{Ot();$i=ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])});var $m,Bit=b(()=>{Ot();$m=ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])});var Gb,zit=b(()=>{Ot();Gb=ye("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])});var Kv,Uit=b(()=>{Ot();Kv=ye("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])});var NI,qit=b(()=>{Ot();NI=ye("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])});var A5,Hit=b(()=>{Ot();A5=ye("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]])});var jI,Vit=b(()=>{Ot();jI=ye("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]])});var Hh,Wit=b(()=>{Ot();Hh=ye("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])});var DI,Kit=b(()=>{Ot();DI=ye("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]])});var LI,Git=b(()=>{Ot();LI=ye("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])});var I5,Jit=b(()=>{Ot();I5=ye("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])});var M5,Zit=b(()=>{Ot();M5=ye("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]])});var FI,Yit=b(()=>{Ot();FI=ye("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]])});var Bm,Xit=b(()=>{Ot();Bm=ye("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])});var Jb,Qit=b(()=>{Ot();Jb=ye("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]])});var R5,eat=b(()=>{Ot();R5=ye("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]])});var KE,tat=b(()=>{Ot();KE=ye("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])});var N5,rat=b(()=>{Ot();N5=ye("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])});var Gv,nat=b(()=>{Ot();Gv=ye("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]])});var kI,oat=b(()=>{Ot();kI=ye("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]])});var lD,iat=b(()=>{Ot();lD=ye("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])});var j5,aat=b(()=>{Ot();j5=ye("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])});var GE,sat=b(()=>{Ot();GE=ye("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])});var D5,uat=b(()=>{Ot();D5=ye("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]])});var L5,lat=b(()=>{Ot();L5=ye("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]])});var F5,cat=b(()=>{Ot();F5=ye("FileInput",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]])});var k5,dat=b(()=>{Ot();k5=ye("FileOutput",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 7V4a2 2 0 0 1 2-2 2 2 0 0 0-2 2",key:"1vk7w2"}],["path",{d:"M4.063 20.999a2 2 0 0 0 2 1L18 22a2 2 0 0 0 2-2V7l-5-5H6",key:"1jink5"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]])});var zm,fat=b(()=>{Ot();zm=ye("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])});var $5,pat=b(()=>{Ot();$5=ye("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]])});var B5,mat=b(()=>{Ot();B5=ye("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]])});var cy,hat=b(()=>{Ot();cy=ye("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]])});var Zb,gat=b(()=>{Ot();Zb=ye("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])});var Yb,yat=b(()=>{Ot();Yb=ye("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]])});var z5,bat=b(()=>{Ot();z5=ye("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])});var U5,_at=b(()=>{Ot();U5=ye("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]])});var q5,vat=b(()=>{Ot();q5=ye("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])});var cD,wat=b(()=>{Ot();cD=ye("LibraryBig",[["rect",{width:"8",height:"18",x:"3",y:"3",rx:"1",key:"oynpb5"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z",key:"1qboyk"}]])});var JE,xat=b(()=>{Ot();JE=ye("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]])});var iu,Sat=b(()=>{Ot();iu=ye("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])});var H5,Cat=b(()=>{Ot();H5=ye("MessageCirclePlus",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])});var Xz,Oat=b(()=>{Ot();Xz=ye("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])});var dy,Eat=b(()=>{Ot();dy=ye("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]])});var Vh,Pat=b(()=>{Ot();Vh=ye("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]])});var Qz,Tat=b(()=>{Ot();Qz=ye("PencilLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]])});var eU,Aat=b(()=>{Ot();eU=ye("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])});var Wh,Iat=b(()=>{Ot();Wh=ye("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])});var V5,Mat=b(()=>{Ot();V5=ye("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]])});var Jv,Rat=b(()=>{Ot();Jv=ye("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])});var W5,Nat=b(()=>{Ot();W5=ye("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])});var K5,jat=b(()=>{Ot();K5=ye("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])});var dD,Dat=b(()=>{Ot();dD=ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])});var Uf,Lat=b(()=>{Ot();Uf=ye("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]])});var ZE,Fat=b(()=>{Ot();ZE=ye("SquareArrowOutUpRight",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]])});var Um,kat=b(()=>{Ot();Um=ye("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]])});var $I,$at=b(()=>{Ot();$I=ye("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]])});var G5,Bat=b(()=>{Ot();G5=ye("TextCursorInput",[["path",{d:"M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1",key:"18xjzo"}],["path",{d:"M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5",key:"fj48gi"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M9 7v10",key:"1vc8ob"}]])});var qm,zat=b(()=>{Ot();qm=ye("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])});var $p,Uat=b(()=>{Ot();$p=ye("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])});var YE,qat=b(()=>{Ot();YE=ye("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]])});var _i,Hat=b(()=>{Ot();_i=ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])});var J5,Vat=b(()=>{Ot();J5=ye("ZapOff",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])});var Z5,Wat=b(()=>{Ot();Z5=ye("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])});var _n=b(()=>{Uit();qit();Vit();Wit();Kit();Git();nat();oat();Sat();Eat();Pat();Lat();Fat();kat();Uat();jit();Dit();Lit();Fit();kit();$it();Bit();zit();Hit();Jit();Zit();Yit();Xit();Qit();eat();tat();rat();iat();aat();sat();uat();lat();cat();dat();fat();pat();mat();hat();gat();yat();bat();_at();vat();wat();xat();Cat();Oat();Tat();Aat();Iat();Mat();Rat();Nat();jat();Dat();$at();Bat();zat();qat();Hat();Vat();Wat();});function iRr({onCancel:t}){let e=ne(),r=iPe(e.defaultModelKey)&&iPe(e.embeddingModelKey);return Zv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Zv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Zv.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&Zv.default.createElement("div",{className:"tw-text-sm tw-text-warning"},"The Copilot Plus exclusive models will stop working. You can switch to the default models in the Settings.")),Zv.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},Zv.default.createElement(me,{variant:"ghost",onClick:t},"Close"),Zv.default.createElement(me,{variant:"default",onClick:()=>{fD(jE.EXPIRED_MODAL)}},"Renew Now ",Zv.default.createElement(lD,{className:"tw-size-4"}))))}var Zv,Kat,Gat,_re,Jat=b(()=>{Zv=j(Z()),Kat=require("obsidian"),Gat=j(Bc());Un();fy();er();_n();_t();_re=class extends Kat.Modal{constructor(e){super(e),this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:e}=this;this.root=(0,Gat.createRoot)(e);let r=()=>{this.close()};this.root.render(Zv.default.createElement(iRr,{onCancel:r}))}onClose(){this.root.unmount()}}});var Zat=x(vre=>{"use strict";Object.defineProperty(vre,"__esModule",{value:!0});vre.V2ChatStreamRequestCitationMode=void 0;vre.V2ChatStreamRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var Yat=x(wre=>{"use strict";Object.defineProperty(wre,"__esModule",{value:!0});wre.V2ChatRequestCitationMode=void 0;wre.V2ChatRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var Qat=x(Xat=>{"use strict";Object.defineProperty(Xat,"__esModule",{value:!0})});var tst=x(est=>{"use strict";Object.defineProperty(est,"__esModule",{value:!0})});var nst=x(rst=>{"use strict";Object.defineProperty(rst,"__esModule",{value:!0})});var ist=x(ost=>{"use strict";Object.defineProperty(ost,"__esModule",{value:!0})});var sst=x(ast=>{"use strict";Object.defineProperty(ast,"__esModule",{value:!0})});var lst=x(ust=>{"use strict";Object.defineProperty(ust,"__esModule",{value:!0})});var dst=x(cst=>{"use strict";Object.defineProperty(cst,"__esModule",{value:!0})});var pst=x(fst=>{"use strict";Object.defineProperty(fst,"__esModule",{value:!0})});var hst=x(mst=>{"use strict";Object.defineProperty(mst,"__esModule",{value:!0})});var yst=x(gst=>{"use strict";Object.defineProperty(gst,"__esModule",{value:!0})});var _st=x(bst=>{"use strict";Object.defineProperty(bst,"__esModule",{value:!0})});var wst=x(vst=>{"use strict";Object.defineProperty(vst,"__esModule",{value:!0})});var Sst=x(xst=>{"use strict";Object.defineProperty(xst,"__esModule",{value:!0})});var Ost=x(Cst=>{"use strict";Object.defineProperty(Cst,"__esModule",{value:!0})});var Pst=x(Est=>{"use strict";Object.defineProperty(Est,"__esModule",{value:!0})});var Ast=x(Tst=>{"use strict";Object.defineProperty(Tst,"__esModule",{value:!0})});var Mst=x(Ist=>{"use strict";Object.defineProperty(Ist,"__esModule",{value:!0})});var Nst=x(Rst=>{"use strict";Object.defineProperty(Rst,"__esModule",{value:!0})});var Dst=x(jst=>{"use strict";Object.defineProperty(jst,"__esModule",{value:!0})});var Fst=x(Lst=>{"use strict";Object.defineProperty(Lst,"__esModule",{value:!0})});var $st=x(kst=>{"use strict";Object.defineProperty(kst,"__esModule",{value:!0})});var zst=x(Bst=>{"use strict";Object.defineProperty(Bst,"__esModule",{value:!0})});var qst=x(Ust=>{"use strict";Object.defineProperty(Ust,"__esModule",{value:!0})});var Hst=x(xre=>{"use strict";Object.defineProperty(xre,"__esModule",{value:!0});xre.ChatFinishReason=void 0;xre.ChatFinishReason={Complete:"complete",StopSequence:"stop_sequence",MaxTokens:"max_tokens",ToolCall:"tool_call",Error:"error",ContentBlocked:"content_blocked",ErrorLimit:"error_limit"}});var Wst=x(Vst=>{"use strict";Object.defineProperty(Vst,"__esModule",{value:!0})});var Gst=x(Kst=>{"use strict";Object.defineProperty(Kst,"__esModule",{value:!0})});var Zst=x(Jst=>{"use strict";Object.defineProperty(Jst,"__esModule",{value:!0})});var Xst=x(Yst=>{"use strict";Object.defineProperty(Yst,"__esModule",{value:!0})});var eut=x(Qst=>{"use strict";Object.defineProperty(Qst,"__esModule",{value:!0})});var rut=x(tut=>{"use strict";Object.defineProperty(tut,"__esModule",{value:!0})});var out=x(nut=>{"use strict";Object.defineProperty(nut,"__esModule",{value:!0})});var aut=x(iut=>{"use strict";Object.defineProperty(iut,"__esModule",{value:!0})});var uut=x(sut=>{"use strict";Object.defineProperty(sut,"__esModule",{value:!0})});var cut=x(lut=>{"use strict";Object.defineProperty(lut,"__esModule",{value:!0})});var fut=x(dut=>{"use strict";Object.defineProperty(dut,"__esModule",{value:!0})});var mut=x(put=>{"use strict";Object.defineProperty(put,"__esModule",{value:!0})});var gut=x(hut=>{"use strict";Object.defineProperty(hut,"__esModule",{value:!0})});var but=x(yut=>{"use strict";Object.defineProperty(yut,"__esModule",{value:!0})});var vut=x(_ut=>{"use strict";Object.defineProperty(_ut,"__esModule",{value:!0})});var xut=x(wut=>{"use strict";Object.defineProperty(wut,"__esModule",{value:!0})});var Cut=x(Sut=>{"use strict";Object.defineProperty(Sut,"__esModule",{value:!0})});var Eut=x(Out=>{"use strict";Object.defineProperty(Out,"__esModule",{value:!0})});var Tut=x(Put=>{"use strict";Object.defineProperty(Put,"__esModule",{value:!0})});var Iut=x(Aut=>{"use strict";Object.defineProperty(Aut,"__esModule",{value:!0})});var Rut=x(Mut=>{"use strict";Object.defineProperty(Mut,"__esModule",{value:!0})});var jut=x(Nut=>{"use strict";Object.defineProperty(Nut,"__esModule",{value:!0})});var Lut=x(Dut=>{"use strict";Object.defineProperty(Dut,"__esModule",{value:!0})});var kut=x(Fut=>{"use strict";Object.defineProperty(Fut,"__esModule",{value:!0})});var But=x($ut=>{"use strict";Object.defineProperty($ut,"__esModule",{value:!0})});var Uut=x(zut=>{"use strict";Object.defineProperty(zut,"__esModule",{value:!0})});var Hut=x(qut=>{"use strict";Object.defineProperty(qut,"__esModule",{value:!0})});var Wut=x(Vut=>{"use strict";Object.defineProperty(Vut,"__esModule",{value:!0})});var Gut=x(Kut=>{"use strict";Object.defineProperty(Kut,"__esModule",{value:!0})});var Zut=x(Jut=>{"use strict";Object.defineProperty(Jut,"__esModule",{value:!0})});var Xut=x(Yut=>{"use strict";Object.defineProperty(Yut,"__esModule",{value:!0})});var elt=x(Qut=>{"use strict";Object.defineProperty(Qut,"__esModule",{value:!0})});var rlt=x(tlt=>{"use strict";Object.defineProperty(tlt,"__esModule",{value:!0})});var aPe=x(Rt=>{"use strict";var aRr=Rt&&Rt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kt=Rt&&Rt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&aRr(e,t,r)};Object.defineProperty(Rt,"__esModule",{value:!0});Kt(Zat(),Rt);Kt(Yat(),Rt);Kt(Qat(),Rt);Kt(tst(),Rt);Kt(nst(),Rt);Kt(ist(),Rt);Kt(sst(),Rt);Kt(lst(),Rt);Kt(dst(),Rt);Kt(pst(),Rt);Kt(hst(),Rt);Kt(yst(),Rt);Kt(_st(),Rt);Kt(wst(),Rt);Kt(Sst(),Rt);Kt(Ost(),Rt);Kt(Pst(),Rt);Kt(Ast(),Rt);Kt(Mst(),Rt);Kt(Nst(),Rt);Kt(Dst(),Rt);Kt(Fst(),Rt);Kt($st(),Rt);Kt(zst(),Rt);Kt(qst(),Rt);Kt(Hst(),Rt);Kt(Wst(),Rt);Kt(Gst(),Rt);Kt(Zst(),Rt);Kt(Xst(),Rt);Kt(eut(),Rt);Kt(rut(),Rt);Kt(out(),Rt);Kt(aut(),Rt);Kt(uut(),Rt);Kt(cut(),Rt);Kt(fut(),Rt);Kt(mut(),Rt);Kt(gut(),Rt);Kt(but(),Rt);Kt(vut(),Rt);Kt(xut(),Rt);Kt(Cut(),Rt);Kt(Eut(),Rt);Kt(Tut(),Rt);Kt(Iut(),Rt);Kt(Rut(),Rt);Kt(jut(),Rt);Kt(Lut(),Rt);Kt(kut(),Rt);Kt(But(),Rt);Kt(Uut(),Rt);Kt(Hut(),Rt);Kt(Wut(),Rt);Kt(Gut(),Rt);Kt(Zut(),Rt);Kt(Xut(),Rt);Kt(elt(),Rt);Kt(rlt(),Rt)});var sPe=x(nlt=>{"use strict";Object.defineProperty(nlt,"__esModule",{value:!0})});var olt=x(pD=>{"use strict";var sRr=pD&&pD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uRr=pD&&pD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sRr(e,t,r)};Object.defineProperty(pD,"__esModule",{value:!0});uRr(sPe(),pD)});var alt=x(BI=>{"use strict";var lRr=BI&&BI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ilt=BI&&BI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&lRr(e,t,r)};Object.defineProperty(BI,"__esModule",{value:!0});ilt(aPe(),BI);ilt(olt(),BI)});var slt=x(Sre=>{"use strict";Object.defineProperty(Sre,"__esModule",{value:!0});Sre.CreateEmbedJobRequestTruncate=void 0;Sre.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var uPe=x(mD=>{"use strict";var cRr=mD&&mD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dRr=mD&&mD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cRr(e,t,r)};Object.defineProperty(mD,"__esModule",{value:!0});dRr(slt(),mD)});var lPe=x(ult=>{"use strict";Object.defineProperty(ult,"__esModule",{value:!0})});var llt=x(hD=>{"use strict";var fRr=hD&&hD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pRr=hD&&hD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&fRr(e,t,r)};Object.defineProperty(hD,"__esModule",{value:!0});pRr(lPe(),hD)});var dlt=x(zI=>{"use strict";var mRr=zI&&zI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),clt=zI&&zI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mRr(e,t,r)};Object.defineProperty(zI,"__esModule",{value:!0});clt(uPe(),zI);clt(llt(),zI)});var plt=x(flt=>{"use strict";Object.defineProperty(flt,"__esModule",{value:!0})});var hlt=x(mlt=>{"use strict";Object.defineProperty(mlt,"__esModule",{value:!0})});var ylt=x(glt=>{"use strict";Object.defineProperty(glt,"__esModule",{value:!0})});var _lt=x(blt=>{"use strict";Object.defineProperty(blt,"__esModule",{value:!0})});var wlt=x(vlt=>{"use strict";Object.defineProperty(vlt,"__esModule",{value:!0})});var cPe=x(Xb=>{"use strict";var hRr=Xb&&Xb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y5=Xb&&Xb.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hRr(e,t,r)};Object.defineProperty(Xb,"__esModule",{value:!0});Y5(plt(),Xb);Y5(hlt(),Xb);Y5(ylt(),Xb);Y5(_lt(),Xb);Y5(wlt(),Xb)});var dPe=x(xlt=>{"use strict";Object.defineProperty(xlt,"__esModule",{value:!0})});var Slt=x(gD=>{"use strict";var gRr=gD&&gD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yRr=gD&&gD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&gRr(e,t,r)};Object.defineProperty(gD,"__esModule",{value:!0});yRr(dPe(),gD)});var Olt=x(UI=>{"use strict";var bRr=UI&&UI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Clt=UI&&UI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bRr(e,t,r)};Object.defineProperty(UI,"__esModule",{value:!0});Clt(cPe(),UI);Clt(Slt(),UI)});var Elt=x(Cre=>{"use strict";Object.defineProperty(Cre,"__esModule",{value:!0});Cre.BaseType=void 0;Cre.BaseType={BaseTypeUnspecified:"BASE_TYPE_UNSPECIFIED",BaseTypeGenerative:"BASE_TYPE_GENERATIVE",BaseTypeClassification:"BASE_TYPE_CLASSIFICATION",BaseTypeRerank:"BASE_TYPE_RERANK",BaseTypeChat:"BASE_TYPE_CHAT"}});var Plt=x(Ore=>{"use strict";Object.defineProperty(Ore,"__esModule",{value:!0});Ore.Strategy=void 0;Ore.Strategy={StrategyUnspecified:"STRATEGY_UNSPECIFIED",StrategyVanilla:"STRATEGY_VANILLA",StrategyTfew:"STRATEGY_TFEW"}});var Alt=x(Tlt=>{"use strict";Object.defineProperty(Tlt,"__esModule",{value:!0})});var Mlt=x(Ilt=>{"use strict";Object.defineProperty(Ilt,"__esModule",{value:!0})});var Nlt=x(Rlt=>{"use strict";Object.defineProperty(Rlt,"__esModule",{value:!0})});var Dlt=x(jlt=>{"use strict";Object.defineProperty(jlt,"__esModule",{value:!0})});var Llt=x(Ere=>{"use strict";Object.defineProperty(Ere,"__esModule",{value:!0});Ere.Status=void 0;Ere.Status={StatusUnspecified:"STATUS_UNSPECIFIED",StatusFinetuning:"STATUS_FINETUNING",StatusDeployingApi:"STATUS_DEPLOYING_API",StatusReady:"STATUS_READY",StatusFailed:"STATUS_FAILED",StatusDeleted:"STATUS_DELETED",StatusTemporarilyOffline:"STATUS_TEMPORARILY_OFFLINE",StatusPaused:"STATUS_PAUSED",StatusQueued:"STATUS_QUEUED"}});var klt=x(Flt=>{"use strict";Object.defineProperty(Flt,"__esModule",{value:!0})});var Blt=x($lt=>{"use strict";Object.defineProperty($lt,"__esModule",{value:!0})});var Ult=x(zlt=>{"use strict";Object.defineProperty(zlt,"__esModule",{value:!0})});var Hlt=x(qlt=>{"use strict";Object.defineProperty(qlt,"__esModule",{value:!0})});var Wlt=x(Vlt=>{"use strict";Object.defineProperty(Vlt,"__esModule",{value:!0})});var Glt=x(Klt=>{"use strict";Object.defineProperty(Klt,"__esModule",{value:!0})});var Zlt=x(Jlt=>{"use strict";Object.defineProperty(Jlt,"__esModule",{value:!0})});var Xlt=x(Ylt=>{"use strict";Object.defineProperty(Ylt,"__esModule",{value:!0})});var ect=x(Qlt=>{"use strict";Object.defineProperty(Qlt,"__esModule",{value:!0})});var rct=x(tct=>{"use strict";Object.defineProperty(tct,"__esModule",{value:!0})});var fPe=x(fs=>{"use strict";var _Rr=fs&&fs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ad=fs&&fs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_Rr(e,t,r)};Object.defineProperty(fs,"__esModule",{value:!0});Ad(Elt(),fs);Ad(Plt(),fs);Ad(Alt(),fs);Ad(Mlt(),fs);Ad(Nlt(),fs);Ad(Dlt(),fs);Ad(Llt(),fs);Ad(klt(),fs);Ad(Blt(),fs);Ad(Ult(),fs);Ad(Hlt(),fs);Ad(Wlt(),fs);Ad(Glt(),fs);Ad(Zlt(),fs);Ad(Xlt(),fs);Ad(ect(),fs);Ad(rct(),fs)});var nct=x(yD=>{"use strict";var vRr=yD&&yD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wRr=yD&&yD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vRr(e,t,r)};Object.defineProperty(yD,"__esModule",{value:!0});wRr(fPe(),yD)});var ict=x(Kh=>{"use strict";var oct=Kh&&Kh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xRr=Kh&&Kh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SRr=Kh&&Kh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oct(e,t,r);return xRr(e,t),e},CRr=Kh&&Kh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oct(e,t,r)};Object.defineProperty(Kh,"__esModule",{value:!0});Kh.finetuning=void 0;Kh.finetuning=SRr(nct());CRr(fPe(),Kh)});var pPe=x(act=>{"use strict";Object.defineProperty(act,"__esModule",{value:!0})});var sct=x(bD=>{"use strict";var ORr=bD&&bD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ERr=bD&&bD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ORr(e,t,r)};Object.defineProperty(bD,"__esModule",{value:!0});ERr(pPe(),bD)});var lct=x(qI=>{"use strict";var PRr=qI&&qI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uct=qI&&qI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&PRr(e,t,r)};Object.defineProperty(qI,"__esModule",{value:!0});uct(ict(),qI);uct(sct(),qI)});var mPe=x(cct=>{"use strict";Object.defineProperty(cct,"__esModule",{value:!0})});var dct=x(_D=>{"use strict";var TRr=_D&&_D.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ARr=_D&&_D.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&TRr(e,t,r)};Object.defineProperty(_D,"__esModule",{value:!0});ARr(mPe(),_D)});var fct=x(vD=>{"use strict";var IRr=vD&&vD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MRr=vD&&vD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&IRr(e,t,r)};Object.defineProperty(vD,"__esModule",{value:!0});MRr(dct(),vD)});var hPe=x(pct=>{"use strict";Object.defineProperty(pct,"__esModule",{value:!0})});var mct=x(wD=>{"use strict";var RRr=wD&&wD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NRr=wD&&wD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&RRr(e,t,r)};Object.defineProperty(wD,"__esModule",{value:!0});NRr(hPe(),wD)});var hct=x(xD=>{"use strict";var jRr=xD&&xD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DRr=xD&&xD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jRr(e,t,r)};Object.defineProperty(xD,"__esModule",{value:!0});DRr(mct(),xD)});var yct=x(vi=>{"use strict";var gct=vi&&vi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LRr=vi&&vi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tU=vi&&vi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gct(e,t,r);return LRr(e,t),e},XE=vi&&vi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&gct(e,t,r)};Object.defineProperty(vi,"__esModule",{value:!0});vi.models=vi.connectors=vi.finetuning=vi.datasets=vi.embedJobs=vi.v2=void 0;vi.v2=tU(alt());XE(aPe(),vi);vi.embedJobs=tU(dlt());XE(uPe(),vi);vi.datasets=tU(Olt());XE(cPe(),vi);vi.finetuning=tU(lct());vi.connectors=tU(fct());vi.models=tU(hct());XE(sPe(),vi);XE(lPe(),vi);XE(dPe(),vi);XE(mPe(),vi);XE(hPe(),vi);XE(pPe(),vi)});var bct=x(Pre=>{"use strict";Object.defineProperty(Pre,"__esModule",{value:!0});Pre.ChatStreamRequestPromptTruncation=void 0;Pre.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var _ct=x(Tre=>{"use strict";Object.defineProperty(Tre,"__esModule",{value:!0});Tre.ChatStreamRequestCitationQuality=void 0;Tre.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var wct=x(vct=>{"use strict";Object.defineProperty(vct,"__esModule",{value:!0})});var xct=x(Are=>{"use strict";Object.defineProperty(Are,"__esModule",{value:!0});Are.ChatStreamRequestSafetyMode=void 0;Are.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var Cct=x(Sct=>{"use strict";Object.defineProperty(Sct,"__esModule",{value:!0})});var Ect=x(Oct=>{"use strict";Object.defineProperty(Oct,"__esModule",{value:!0})});var Tct=x(Pct=>{"use strict";Object.defineProperty(Pct,"__esModule",{value:!0})});var Ict=x(Act=>{"use strict";Object.defineProperty(Act,"__esModule",{value:!0})});var Rct=x(Mct=>{"use strict";Object.defineProperty(Mct,"__esModule",{value:!0})});var Nct=x(Ire=>{"use strict";Object.defineProperty(Ire,"__esModule",{value:!0});Ire.ChatRequestPromptTruncation=void 0;Ire.ChatRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var jct=x(Mre=>{"use strict";Object.defineProperty(Mre,"__esModule",{value:!0});Mre.ChatRequestCitationQuality=void 0;Mre.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var Lct=x(Dct=>{"use strict";Object.defineProperty(Dct,"__esModule",{value:!0})});var Fct=x(Rre=>{"use strict";Object.defineProperty(Rre,"__esModule",{value:!0});Rre.ChatRequestSafetyMode=void 0;Rre.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var kct=x(Nre=>{"use strict";Object.defineProperty(Nre,"__esModule",{value:!0});Nre.GenerateStreamRequestTruncate=void 0;Nre.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var $ct=x(jre=>{"use strict";Object.defineProperty(jre,"__esModule",{value:!0});jre.GenerateStreamRequestReturnLikelihoods=void 0;jre.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var Bct=x(Dre=>{"use strict";Object.defineProperty(Dre,"__esModule",{value:!0});Dre.GenerateRequestTruncate=void 0;Dre.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var zct=x(Lre=>{"use strict";Object.defineProperty(Lre,"__esModule",{value:!0});Lre.GenerateRequestReturnLikelihoods=void 0;Lre.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var Uct=x(Fre=>{"use strict";Object.defineProperty(Fre,"__esModule",{value:!0});Fre.EmbedRequestTruncate=void 0;Fre.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var Hct=x(qct=>{"use strict";Object.defineProperty(qct,"__esModule",{value:!0})});var Wct=x(Vct=>{"use strict";Object.defineProperty(Vct,"__esModule",{value:!0})});var Gct=x(Kct=>{"use strict";Object.defineProperty(Kct,"__esModule",{value:!0})});var Zct=x(Jct=>{"use strict";Object.defineProperty(Jct,"__esModule",{value:!0})});var Xct=x(Yct=>{"use strict";Object.defineProperty(Yct,"__esModule",{value:!0})});var Qct=x(kre=>{"use strict";Object.defineProperty(kre,"__esModule",{value:!0});kre.ClassifyRequestTruncate=void 0;kre.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var tdt=x(edt=>{"use strict";Object.defineProperty(edt,"__esModule",{value:!0})});var rdt=x($re=>{"use strict";Object.defineProperty($re,"__esModule",{value:!0});$re.ClassifyResponseClassificationsItemClassificationType=void 0;$re.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var odt=x(ndt=>{"use strict";Object.defineProperty(ndt,"__esModule",{value:!0})});var adt=x(idt=>{"use strict";Object.defineProperty(idt,"__esModule",{value:!0})});var sdt=x(Bre=>{"use strict";Object.defineProperty(Bre,"__esModule",{value:!0});Bre.SummarizeRequestLength=void 0;Bre.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var udt=x(zre=>{"use strict";Object.defineProperty(zre,"__esModule",{value:!0});zre.SummarizeRequestFormat=void 0;zre.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var ldt=x(Ure=>{"use strict";Object.defineProperty(Ure,"__esModule",{value:!0});Ure.SummarizeRequestExtractiveness=void 0;Ure.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});var ddt=x(cdt=>{"use strict";Object.defineProperty(cdt,"__esModule",{value:!0})});var pdt=x(fdt=>{"use strict";Object.defineProperty(fdt,"__esModule",{value:!0})});var hdt=x(mdt=>{"use strict";Object.defineProperty(mdt,"__esModule",{value:!0})});var ydt=x(gdt=>{"use strict";Object.defineProperty(gdt,"__esModule",{value:!0})});var _dt=x(bdt=>{"use strict";Object.defineProperty(bdt,"__esModule",{value:!0})});var wdt=x(vdt=>{"use strict";Object.defineProperty(vdt,"__esModule",{value:!0})});var Sdt=x(xdt=>{"use strict";Object.defineProperty(xdt,"__esModule",{value:!0})});var Odt=x(Cdt=>{"use strict";Object.defineProperty(Cdt,"__esModule",{value:!0})});var Pdt=x(Edt=>{"use strict";Object.defineProperty(Edt,"__esModule",{value:!0})});var Adt=x(Tdt=>{"use strict";Object.defineProperty(Tdt,"__esModule",{value:!0})});var Mdt=x(Idt=>{"use strict";Object.defineProperty(Idt,"__esModule",{value:!0})});var Ndt=x(Rdt=>{"use strict";Object.defineProperty(Rdt,"__esModule",{value:!0})});var Ddt=x(jdt=>{"use strict";Object.defineProperty(jdt,"__esModule",{value:!0})});var Fdt=x(Ldt=>{"use strict";Object.defineProperty(Ldt,"__esModule",{value:!0})});var $dt=x(kdt=>{"use strict";Object.defineProperty(kdt,"__esModule",{value:!0})});var zdt=x(Bdt=>{"use strict";Object.defineProperty(Bdt,"__esModule",{value:!0})});var qdt=x(Udt=>{"use strict";Object.defineProperty(Udt,"__esModule",{value:!0})});var Vdt=x(Hdt=>{"use strict";Object.defineProperty(Hdt,"__esModule",{value:!0})});var Kdt=x(Wdt=>{"use strict";Object.defineProperty(Wdt,"__esModule",{value:!0})});var Jdt=x(Gdt=>{"use strict";Object.defineProperty(Gdt,"__esModule",{value:!0})});var Zdt=x(qre=>{"use strict";Object.defineProperty(qre,"__esModule",{value:!0});qre.FinishReason=void 0;qre.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});var Xdt=x(Ydt=>{"use strict";Object.defineProperty(Ydt,"__esModule",{value:!0})});var eft=x(Qdt=>{"use strict";Object.defineProperty(Qdt,"__esModule",{value:!0})});var rft=x(tft=>{"use strict";Object.defineProperty(tft,"__esModule",{value:!0})});var oft=x(nft=>{"use strict";Object.defineProperty(nft,"__esModule",{value:!0})});var aft=x(ift=>{"use strict";Object.defineProperty(ift,"__esModule",{value:!0})});var uft=x(sft=>{"use strict";Object.defineProperty(sft,"__esModule",{value:!0})});var cft=x(lft=>{"use strict";Object.defineProperty(lft,"__esModule",{value:!0})});var fft=x(dft=>{"use strict";Object.defineProperty(dft,"__esModule",{value:!0})});var mft=x(pft=>{"use strict";Object.defineProperty(pft,"__esModule",{value:!0})});var gft=x(hft=>{"use strict";Object.defineProperty(hft,"__esModule",{value:!0})});var bft=x(yft=>{"use strict";Object.defineProperty(yft,"__esModule",{value:!0})});var vft=x(_ft=>{"use strict";Object.defineProperty(_ft,"__esModule",{value:!0})});var wft=x(Hre=>{"use strict";Object.defineProperty(Hre,"__esModule",{value:!0});Hre.ChatStreamEndEventFinishReason=void 0;Hre.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});var Sft=x(xft=>{"use strict";Object.defineProperty(xft,"__esModule",{value:!0})});var Oft=x(Cft=>{"use strict";Object.defineProperty(Cft,"__esModule",{value:!0})});var Pft=x(Eft=>{"use strict";Object.defineProperty(Eft,"__esModule",{value:!0})});var Aft=x(Tft=>{"use strict";Object.defineProperty(Tft,"__esModule",{value:!0})});var Mft=x(Ift=>{"use strict";Object.defineProperty(Ift,"__esModule",{value:!0})});var Nft=x(Rft=>{"use strict";Object.defineProperty(Rft,"__esModule",{value:!0})});var Dft=x(jft=>{"use strict";Object.defineProperty(jft,"__esModule",{value:!0})});var Fft=x(Lft=>{"use strict";Object.defineProperty(Lft,"__esModule",{value:!0})});var $ft=x(kft=>{"use strict";Object.defineProperty(kft,"__esModule",{value:!0})});var zft=x(Bft=>{"use strict";Object.defineProperty(Bft,"__esModule",{value:!0})});var qft=x(Uft=>{"use strict";Object.defineProperty(Uft,"__esModule",{value:!0})});var Vft=x(Hft=>{"use strict";Object.defineProperty(Hft,"__esModule",{value:!0})});var Kft=x(Wft=>{"use strict";Object.defineProperty(Wft,"__esModule",{value:!0})});var Jft=x(Gft=>{"use strict";Object.defineProperty(Gft,"__esModule",{value:!0})});var Yft=x(Zft=>{"use strict";Object.defineProperty(Zft,"__esModule",{value:!0})});var Qft=x(Xft=>{"use strict";Object.defineProperty(Xft,"__esModule",{value:!0})});var tpt=x(ept=>{"use strict";Object.defineProperty(ept,"__esModule",{value:!0})});var npt=x(rpt=>{"use strict";Object.defineProperty(rpt,"__esModule",{value:!0})});var ipt=x(opt=>{"use strict";Object.defineProperty(opt,"__esModule",{value:!0})});var spt=x(apt=>{"use strict";Object.defineProperty(apt,"__esModule",{value:!0})});var upt=x(Vre=>{"use strict";Object.defineProperty(Vre,"__esModule",{value:!0});Vre.EmbedInputType=void 0;Vre.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering"}});var lpt=x(Wre=>{"use strict";Object.defineProperty(Wre,"__esModule",{value:!0});Wre.EmbeddingType=void 0;Wre.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"}});var dpt=x(cpt=>{"use strict";Object.defineProperty(cpt,"__esModule",{value:!0})});var ppt=x(fpt=>{"use strict";Object.defineProperty(fpt,"__esModule",{value:!0})});var hpt=x(mpt=>{"use strict";Object.defineProperty(mpt,"__esModule",{value:!0})});var gpt=x(Kre=>{"use strict";Object.defineProperty(Kre,"__esModule",{value:!0});Kre.EmbedJobStatus=void 0;Kre.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var ypt=x(Gre=>{"use strict";Object.defineProperty(Gre,"__esModule",{value:!0});Gre.EmbedJobTruncate=void 0;Gre.EmbedJobTruncate={Start:"START",End:"END"}});var _pt=x(bpt=>{"use strict";Object.defineProperty(bpt,"__esModule",{value:!0})});var wpt=x(vpt=>{"use strict";Object.defineProperty(vpt,"__esModule",{value:!0})});var Spt=x(xpt=>{"use strict";Object.defineProperty(xpt,"__esModule",{value:!0})});var Opt=x(Cpt=>{"use strict";Object.defineProperty(Cpt,"__esModule",{value:!0})});var Ppt=x(Ept=>{"use strict";Object.defineProperty(Ept,"__esModule",{value:!0})});var Tpt=x(Jre=>{"use strict";Object.defineProperty(Jre,"__esModule",{value:!0});Jre.DatasetValidationStatus=void 0;Jre.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var Apt=x(Zre=>{"use strict";Object.defineProperty(Zre,"__esModule",{value:!0});Zre.DatasetType=void 0;Zre.DatasetType={EmbedInput:"embed-input",EmbedResult:"embed-result",ClusterResult:"cluster-result",ClusterOutliers:"cluster-outliers",RerankerFinetuneInput:"reranker-finetune-input",SingleLabelClassificationFinetuneInput:"single-label-classification-finetune-input",ChatFinetuneInput:"chat-finetune-input",MultiLabelClassificationFinetuneInput:"multi-label-classification-finetune-input"}});var Mpt=x(Ipt=>{"use strict";Object.defineProperty(Ipt,"__esModule",{value:!0})});var Npt=x(Rpt=>{"use strict";Object.defineProperty(Rpt,"__esModule",{value:!0})});var Dpt=x(jpt=>{"use strict";Object.defineProperty(jpt,"__esModule",{value:!0})});var Fpt=x(Lpt=>{"use strict";Object.defineProperty(Lpt,"__esModule",{value:!0})});var $pt=x(kpt=>{"use strict";Object.defineProperty(kpt,"__esModule",{value:!0})});var zpt=x(Bpt=>{"use strict";Object.defineProperty(Bpt,"__esModule",{value:!0})});var qpt=x(Upt=>{"use strict";Object.defineProperty(Upt,"__esModule",{value:!0})});var Vpt=x(Hpt=>{"use strict";Object.defineProperty(Hpt,"__esModule",{value:!0})});var Kpt=x(Wpt=>{"use strict";Object.defineProperty(Wpt,"__esModule",{value:!0})});var Jpt=x(Gpt=>{"use strict";Object.defineProperty(Gpt,"__esModule",{value:!0})});var Ypt=x(Zpt=>{"use strict";Object.defineProperty(Zpt,"__esModule",{value:!0})});var Qpt=x(Xpt=>{"use strict";Object.defineProperty(Xpt,"__esModule",{value:!0})});var emt=x(Yre=>{"use strict";Object.defineProperty(Yre,"__esModule",{value:!0});Yre.ConnectorAuthStatus=void 0;Yre.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});var rmt=x(tmt=>{"use strict";Object.defineProperty(tmt,"__esModule",{value:!0})});var omt=x(nmt=>{"use strict";Object.defineProperty(nmt,"__esModule",{value:!0})});var amt=x(imt=>{"use strict";Object.defineProperty(imt,"__esModule",{value:!0})});var smt=x(Xre=>{"use strict";Object.defineProperty(Xre,"__esModule",{value:!0});Xre.AuthTokenType=void 0;Xre.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});var lmt=x(umt=>{"use strict";Object.defineProperty(umt,"__esModule",{value:!0})});var dmt=x(cmt=>{"use strict";Object.defineProperty(cmt,"__esModule",{value:!0})});var pmt=x(fmt=>{"use strict";Object.defineProperty(fmt,"__esModule",{value:!0})});var hmt=x(mmt=>{"use strict";Object.defineProperty(mmt,"__esModule",{value:!0})});var ymt=x(gmt=>{"use strict";Object.defineProperty(gmt,"__esModule",{value:!0})});var _mt=x(bmt=>{"use strict";Object.defineProperty(bmt,"__esModule",{value:!0})});var vmt=x(Qre=>{"use strict";Object.defineProperty(Qre,"__esModule",{value:!0});Qre.CompatibleEndpoint=void 0;Qre.CompatibleEndpoint={Chat:"chat",Embed:"embed",Classify:"classify",Summarize:"summarize",Rerank:"rerank",Rate:"rate",Generate:"generate"}});var xmt=x(wmt=>{"use strict";Object.defineProperty(wmt,"__esModule",{value:!0})});var Cmt=x(Smt=>{"use strict";Object.defineProperty(Smt,"__esModule",{value:!0})});var Omt=x(ve=>{"use strict";var FRr=ve&&ve.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ee=ve&&ve.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&FRr(e,t,r)};Object.defineProperty(ve,"__esModule",{value:!0});Ee(bct(),ve);Ee(_ct(),ve);Ee(wct(),ve);Ee(xct(),ve);Ee(Cct(),ve);Ee(Ect(),ve);Ee(Tct(),ve);Ee(Ict(),ve);Ee(Rct(),ve);Ee(Nct(),ve);Ee(jct(),ve);Ee(Lct(),ve);Ee(Fct(),ve);Ee(kct(),ve);Ee($ct(),ve);Ee(Bct(),ve);Ee(zct(),ve);Ee(Uct(),ve);Ee(Hct(),ve);Ee(Wct(),ve);Ee(Gct(),ve);Ee(Zct(),ve);Ee(Xct(),ve);Ee(Qct(),ve);Ee(tdt(),ve);Ee(rdt(),ve);Ee(odt(),ve);Ee(adt(),ve);Ee(sdt(),ve);Ee(udt(),ve);Ee(ldt(),ve);Ee(ddt(),ve);Ee(pdt(),ve);Ee(hdt(),ve);Ee(ydt(),ve);Ee(_dt(),ve);Ee(wdt(),ve);Ee(Sdt(),ve);Ee(Odt(),ve);Ee(Pdt(),ve);Ee(Adt(),ve);Ee(Mdt(),ve);Ee(Ndt(),ve);Ee(Ddt(),ve);Ee(Fdt(),ve);Ee($dt(),ve);Ee(zdt(),ve);Ee(qdt(),ve);Ee(Vdt(),ve);Ee(Kdt(),ve);Ee(Jdt(),ve);Ee(Zdt(),ve);Ee(Xdt(),ve);Ee(eft(),ve);Ee(rft(),ve);Ee(oft(),ve);Ee(aft(),ve);Ee(uft(),ve);Ee(cft(),ve);Ee(fft(),ve);Ee(mft(),ve);Ee(gft(),ve);Ee(bft(),ve);Ee(vft(),ve);Ee(wft(),ve);Ee(Sft(),ve);Ee(Oft(),ve);Ee(Pft(),ve);Ee(Aft(),ve);Ee(Mft(),ve);Ee(Nft(),ve);Ee(Dft(),ve);Ee(Fft(),ve);Ee($ft(),ve);Ee(zft(),ve);Ee(qft(),ve);Ee(Vft(),ve);Ee(Kft(),ve);Ee(Jft(),ve);Ee(Yft(),ve);Ee(Qft(),ve);Ee(tpt(),ve);Ee(npt(),ve);Ee(ipt(),ve);Ee(spt(),ve);Ee(upt(),ve);Ee(lpt(),ve);Ee(dpt(),ve);Ee(ppt(),ve);Ee(hpt(),ve);Ee(gpt(),ve);Ee(ypt(),ve);Ee(_pt(),ve);Ee(wpt(),ve);Ee(Spt(),ve);Ee(Opt(),ve);Ee(Ppt(),ve);Ee(Tpt(),ve);Ee(Apt(),ve);Ee(Mpt(),ve);Ee(Npt(),ve);Ee(Dpt(),ve);Ee(Fpt(),ve);Ee($pt(),ve);Ee(zpt(),ve);Ee(qpt(),ve);Ee(Vpt(),ve);Ee(Kpt(),ve);Ee(Jpt(),ve);Ee(Ypt(),ve);Ee(Qpt(),ve);Ee(emt(),ve);Ee(rmt(),ve);Ee(omt(),ve);Ee(amt(),ve);Ee(smt(),ve);Ee(lmt(),ve);Ee(dmt(),ve);Ee(pmt(),ve);Ee(hmt(),ve);Ee(ymt(),ve);Ee(_mt(),ve);Ee(vmt(),ve);Ee(xmt(),ve);Ee(Cmt(),ve)});var Emt=x(ene=>{"use strict";Object.defineProperty(ene,"__esModule",{value:!0});ene.CohereError=void 0;var gPe=class t extends Error{constructor({message:e,statusCode:r,body:n}){super(kRr({message:e,statusCode:r,body:n})),Object.setPrototypeOf(this,t.prototype),r!=null&&(this.statusCode=r),n!==void 0&&(this.body=n)}};ene.CohereError=gPe;function kRr({message:t,statusCode:e,body:r}){let n=[];return t!=null&&n.push(t),e!=null&&n.push(`Status code: ${e.toString()}`),r!=null&&n.push(`Body: ${JSON.stringify(r,void 0,2)}`),n.join(`
`)}});var Pmt=x(tne=>{"use strict";Object.defineProperty(tne,"__esModule",{value:!0});tne.CohereTimeoutError=void 0;var yPe=class t extends Error{constructor(){super("Timeout"),Object.setPrototypeOf(this,t.prototype)}};tne.CohereTimeoutError=yPe});var au=x(rU=>{"use strict";Object.defineProperty(rU,"__esModule",{value:!0});rU.CohereTimeoutError=rU.CohereError=void 0;var $Rr=Emt();Object.defineProperty(rU,"CohereError",{enumerable:!0,get:function(){return $Rr.CohereError}});var BRr=Pmt();Object.defineProperty(rU,"CohereTimeoutError",{enumerable:!0,get:function(){return BRr.CohereTimeoutError}})});var Tmt=x(Yv=>{"use strict";var zRr=Yv&&Yv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),URr=Yv&&Yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qRr=Yv&&Yv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zRr(e,t,r);return URr(e,t),e};Object.defineProperty(Yv,"__esModule",{value:!0});Yv.BadRequestError=void 0;var HRr=qRr(au()),bPe=class t extends HRr.CohereError{constructor(e){super({message:"BadRequestError",statusCode:400,body:e}),Object.setPrototypeOf(this,t.prototype)}};Yv.BadRequestError=bPe});var Amt=x(Xv=>{"use strict";var VRr=Xv&&Xv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WRr=Xv&&Xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KRr=Xv&&Xv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VRr(e,t,r);return WRr(e,t),e};Object.defineProperty(Xv,"__esModule",{value:!0});Xv.UnauthorizedError=void 0;var GRr=KRr(au()),_Pe=class t extends GRr.CohereError{constructor(e){super({message:"UnauthorizedError",statusCode:401,body:e}),Object.setPrototypeOf(this,t.prototype)}};Xv.UnauthorizedError=_Pe});var Imt=x(Qv=>{"use strict";var JRr=Qv&&Qv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZRr=Qv&&Qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YRr=Qv&&Qv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JRr(e,t,r);return ZRr(e,t),e};Object.defineProperty(Qv,"__esModule",{value:!0});Qv.ForbiddenError=void 0;var XRr=YRr(au()),vPe=class t extends XRr.CohereError{constructor(e){super({message:"ForbiddenError",statusCode:403,body:e}),Object.setPrototypeOf(this,t.prototype)}};Qv.ForbiddenError=vPe});var Mmt=x(ew=>{"use strict";var QRr=ew&&ew.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e1r=ew&&ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t1r=ew&&ew.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QRr(e,t,r);return e1r(e,t),e};Object.defineProperty(ew,"__esModule",{value:!0});ew.NotFoundError=void 0;var r1r=t1r(au()),wPe=class t extends r1r.CohereError{constructor(e){super({message:"NotFoundError",statusCode:404,body:e}),Object.setPrototypeOf(this,t.prototype)}};ew.NotFoundError=wPe});var Rmt=x(tw=>{"use strict";var n1r=tw&&tw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o1r=tw&&tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i1r=tw&&tw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&n1r(e,t,r);return o1r(e,t),e};Object.defineProperty(tw,"__esModule",{value:!0});tw.UnprocessableEntityError=void 0;var a1r=i1r(au()),xPe=class t extends a1r.CohereError{constructor(e){super({message:"UnprocessableEntityError",statusCode:422,body:e}),Object.setPrototypeOf(this,t.prototype)}};tw.UnprocessableEntityError=xPe});var Nmt=x(rw=>{"use strict";var s1r=rw&&rw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u1r=rw&&rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l1r=rw&&rw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&s1r(e,t,r);return u1r(e,t),e};Object.defineProperty(rw,"__esModule",{value:!0});rw.TooManyRequestsError=void 0;var c1r=l1r(au()),SPe=class t extends c1r.CohereError{constructor(e){super({message:"TooManyRequestsError",statusCode:429,body:e}),Object.setPrototypeOf(this,t.prototype)}};rw.TooManyRequestsError=SPe});var jmt=x(nw=>{"use strict";var d1r=nw&&nw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f1r=nw&&nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p1r=nw&&nw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&d1r(e,t,r);return f1r(e,t),e};Object.defineProperty(nw,"__esModule",{value:!0});nw.ClientClosedRequestError=void 0;var m1r=p1r(au()),CPe=class t extends m1r.CohereError{constructor(e){super({message:"ClientClosedRequestError",statusCode:499,body:e}),Object.setPrototypeOf(this,t.prototype)}};nw.ClientClosedRequestError=CPe});var Dmt=x(ow=>{"use strict";var h1r=ow&&ow.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),g1r=ow&&ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y1r=ow&&ow.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&h1r(e,t,r);return g1r(e,t),e};Object.defineProperty(ow,"__esModule",{value:!0});ow.InternalServerError=void 0;var b1r=y1r(au()),OPe=class t extends b1r.CohereError{constructor(e){super({message:"InternalServerError",statusCode:500,body:e}),Object.setPrototypeOf(this,t.prototype)}};ow.InternalServerError=OPe});var Lmt=x(iw=>{"use strict";var _1r=iw&&iw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),v1r=iw&&iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w1r=iw&&iw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_1r(e,t,r);return v1r(e,t),e};Object.defineProperty(iw,"__esModule",{value:!0});iw.NotImplementedError=void 0;var x1r=w1r(au()),EPe=class t extends x1r.CohereError{constructor(e){super({message:"NotImplementedError",statusCode:501,body:e}),Object.setPrototypeOf(this,t.prototype)}};iw.NotImplementedError=EPe});var Fmt=x(aw=>{"use strict";var S1r=aw&&aw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C1r=aw&&aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O1r=aw&&aw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&S1r(e,t,r);return C1r(e,t),e};Object.defineProperty(aw,"__esModule",{value:!0});aw.ServiceUnavailableError=void 0;var E1r=O1r(au()),PPe=class t extends E1r.CohereError{constructor(e){super({message:"ServiceUnavailableError",statusCode:503,body:e}),Object.setPrototypeOf(this,t.prototype)}};aw.ServiceUnavailableError=PPe});var kmt=x(sw=>{"use strict";var P1r=sw&&sw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T1r=sw&&sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A1r=sw&&sw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P1r(e,t,r);return T1r(e,t),e};Object.defineProperty(sw,"__esModule",{value:!0});sw.GatewayTimeoutError=void 0;var I1r=A1r(au()),TPe=class t extends I1r.CohereError{constructor(e){super({message:"GatewayTimeoutError",statusCode:504,body:e}),Object.setPrototypeOf(this,t.prototype)}};sw.GatewayTimeoutError=TPe});var $mt=x(Id=>{"use strict";var M1r=Id&&Id.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qb=Id&&Id.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&M1r(e,t,r)};Object.defineProperty(Id,"__esModule",{value:!0});Qb(Tmt(),Id);Qb(Amt(),Id);Qb(Imt(),Id);Qb(Mmt(),Id);Qb(Rmt(),Id);Qb(Nmt(),Id);Qb(jmt(),Id);Qb(Dmt(),Id);Qb(Lmt(),Id);Qb(Fmt(),Id);Qb(kmt(),Id)});var zmt=x(Bmt=>{"use strict";Object.defineProperty(Bmt,"__esModule",{value:!0})});var Umt=x(SD=>{"use strict";var R1r=SD&&SD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),N1r=SD&&SD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&R1r(e,t,r)};Object.defineProperty(SD,"__esModule",{value:!0});N1r(zmt(),SD)});var QE=x(uw=>{"use strict";var j1r=uw&&uw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rne=uw&&uw.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&j1r(e,t,r)};Object.defineProperty(uw,"__esModule",{value:!0});rne(yct(),uw);rne(Omt(),uw);rne($mt(),uw);rne(Umt(),uw)});var MPe={};as(MPe,{__addDisposableResource:()=>lht,__assign:()=>nne,__asyncDelegator:()=>tht,__asyncGenerator:()=>eht,__asyncValues:()=>rht,__await:()=>nU,__awaiter:()=>Gmt,__classPrivateFieldGet:()=>aht,__classPrivateFieldIn:()=>uht,__classPrivateFieldSet:()=>sht,__createBinding:()=>ine,__decorate:()=>Vmt,__disposeResources:()=>cht,__esDecorate:()=>D1r,__exportStar:()=>Zmt,__extends:()=>qmt,__generator:()=>Jmt,__importDefault:()=>iht,__importStar:()=>oht,__makeTemplateObject:()=>nht,__metadata:()=>Kmt,__param:()=>Wmt,__propKey:()=>F1r,__read:()=>IPe,__rest:()=>Hmt,__runInitializers:()=>L1r,__setFunctionName:()=>k1r,__spread:()=>Ymt,__spreadArray:()=>Qmt,__spreadArrays:()=>Xmt,__values:()=>one,default:()=>z1r});function qmt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");APe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Hmt(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function Vmt(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function Wmt(t,e){return function(r,n){e(r,n,t)}}function D1r(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var y=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(d=a(y.get))&&(c.get=d),(d=a(y.set))&&(c.set=d),(d=a(y.init))&&o.unshift(d)}else(d=a(y))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function L1r(t,e,r){for(var n=arguments.length>2,o=0;o<e.length;o++)r=n?e[o].call(t,r):e[o].call(t);return n?r:void 0}function F1r(t){return typeof t=="symbol"?t:"".concat(t)}function k1r(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function Kmt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Gmt(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}function Jmt(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Zmt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ine(e,t,r)}function one(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function IPe(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function Ymt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(IPe(arguments[e]));return t}function Xmt(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function Qmt(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function nU(t){return this instanceof nU?(this.v=t,this):new nU(t)}function eht(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(y,g){i.push([p,h,y,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof nU?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function tht(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:nU(t[o](a)),done:!1}:i?i(a):a}:i}}function rht(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof one=="function"?one(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}}function nht(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function oht(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ine(e,t,r);return $1r(e,t),e}function iht(t){return t&&t.__esModule?t:{default:t}}function aht(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function sht(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function uht(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function lht(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function cht(t){function e(i){t.error=t.hasError?new B1r(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(o,function(a){return e(a),o()})}else n|=1}catch(a){e(a)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}var APe,nne,ine,$1r,B1r,z1r,RPe=b(()=>{APe=function(t,e){return APe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},APe(t,e)};nne=function(){return nne=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},nne.apply(this,arguments)};ine=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};$1r=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};B1r=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};z1r={__extends:qmt,__assign:nne,__rest:Hmt,__decorate:Vmt,__param:Wmt,__metadata:Kmt,__awaiter:Gmt,__generator:Jmt,__createBinding:ine,__exportStar:Zmt,__values:one,__read:IPe,__spread:Ymt,__spreadArrays:Xmt,__spreadArray:Qmt,__await:nU,__asyncGenerator:eht,__asyncDelegator:tht,__asyncValues:rht,__makeTemplateObject:nht,__importStar:oht,__importDefault:iht,__classPrivateFieldGet:aht,__classPrivateFieldSet:sht,__classPrivateFieldIn:uht,__addDisposableResource:lht,__disposeResources:cht}});var NPe=x(py=>{"use strict";Object.defineProperty(py,"__esModule",{value:!0});py.MAX_HASHABLE_LENGTH=py.INIT=py.KEY=py.DIGEST_LENGTH=py.BLOCK_SIZE=void 0;py.BLOCK_SIZE=64;py.DIGEST_LENGTH=32;py.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);py.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];py.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var dht=x(ane=>{"use strict";Object.defineProperty(ane,"__esModule",{value:!0});ane.RawSha256=void 0;var my=NPe(),U1r=function(){function t(){this.state=Int32Array.from(my.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return t.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var r=0,n=e.byteLength;if(this.bytesHashed+=n,this.bytesHashed*8>my.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[r++],n--,this.bufferLength===my.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},t.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,r=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(r.setUint8(this.bufferLength++,128),n%my.BLOCK_SIZE>=my.BLOCK_SIZE-8){for(var o=this.bufferLength;o<my.BLOCK_SIZE;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<my.BLOCK_SIZE-8;o++)r.setUint8(o,0);r.setUint32(my.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),r.setUint32(my.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var i=new Uint8Array(my.DIGEST_LENGTH),o=0;o<8;o++)i[o*4]=this.state[o]>>>24&255,i[o*4+1]=this.state[o]>>>16&255,i[o*4+2]=this.state[o]>>>8&255,i[o*4+3]=this.state[o]>>>0&255;return i},t.prototype.hashBuffer=function(){for(var e=this,r=e.buffer,n=e.state,o=n[0],i=n[1],a=n[2],s=n[3],u=n[4],l=n[5],c=n[6],d=n[7],f=0;f<my.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(r[f*4]&255)<<24|(r[f*4+1]&255)<<16|(r[f*4+2]&255)<<8|r[f*4+3]&255;else{var p=this.temp[f-2],m=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var h=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(m+this.temp[f-7]|0)+(h+this.temp[f-16]|0)}var y=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&c)|0)+(d+(my.KEY[f]+this.temp[f]|0)|0)|0,g=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&i^o&a^i&a)|0;d=c,c=l,l=u,u=s+y|0,s=a,a=i,i=o,o=y+g|0}n[0]+=o,n[1]+=i,n[2]+=a,n[3]+=s,n[4]+=u,n[5]+=l,n[6]+=c,n[7]+=d},t}();ane.RawSha256=U1r});var mht=x((Dyo,pht)=>{var sne=Object.defineProperty,q1r=Object.getOwnPropertyDescriptor,H1r=Object.getOwnPropertyNames,V1r=Object.prototype.hasOwnProperty,W1r=(t,e)=>sne(t,"name",{value:e,configurable:!0}),K1r=(t,e)=>{for(var r in e)sne(t,r,{get:e[r],enumerable:!0})},G1r=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of H1r(e))!V1r.call(t,o)&&o!==r&&sne(t,o,{get:()=>e[o],enumerable:!(n=q1r(e,o))||n.enumerable});return t},J1r=t=>G1r(sne({},"__esModule",{value:!0}),t),fht={};K1r(fht,{isArrayBuffer:()=>Z1r});pht.exports=J1r(fht);var Z1r=W1r(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var bht=x((Lyo,yht)=>{var une=Object.defineProperty,Y1r=Object.getOwnPropertyDescriptor,X1r=Object.getOwnPropertyNames,Q1r=Object.prototype.hasOwnProperty,hht=(t,e)=>une(t,"name",{value:e,configurable:!0}),eNr=(t,e)=>{for(var r in e)une(t,r,{get:e[r],enumerable:!0})},tNr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of X1r(e))!Q1r.call(t,o)&&o!==r&&une(t,o,{get:()=>e[o],enumerable:!(n=Y1r(e,o))||n.enumerable});return t},rNr=t=>tNr(une({},"__esModule",{value:!0}),t),ght={};eNr(ght,{fromArrayBuffer:()=>oNr,fromString:()=>iNr});yht.exports=rNr(ght);var nNr=mht(),jPe=ty(),oNr=hht((t,e=0,r=t.byteLength-e)=>{if(!(0,nNr.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return jPe.Buffer.from(t,e,r)},"fromArrayBuffer"),iNr=hht((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?jPe.Buffer.from(t,e):jPe.Buffer.from(t)},"fromString")});var Sht=x((Fyo,xht)=>{var lne=Object.defineProperty,aNr=Object.getOwnPropertyDescriptor,sNr=Object.getOwnPropertyNames,uNr=Object.prototype.hasOwnProperty,DPe=(t,e)=>lne(t,"name",{value:e,configurable:!0}),lNr=(t,e)=>{for(var r in e)lne(t,r,{get:e[r],enumerable:!0})},cNr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of sNr(e))!uNr.call(t,o)&&o!==r&&lne(t,o,{get:()=>e[o],enumerable:!(n=aNr(e,o))||n.enumerable});return t},dNr=t=>cNr(lne({},"__esModule",{value:!0}),t),_ht={};lNr(_ht,{fromUtf8:()=>wht,toUint8Array:()=>fNr,toUtf8:()=>pNr});xht.exports=dNr(_ht);var vht=bht(),wht=DPe(t=>{let e=(0,vht.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),fNr=DPe(t=>typeof t=="string"?wht(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),pNr=DPe(t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return(0,vht.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var Cht=x(cne=>{"use strict";Object.defineProperty(cne,"__esModule",{value:!0});cne.convertToBuffer=void 0;var mNr=Sht(),hNr=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:mNr.fromUtf8;function gNr(t){return t instanceof Uint8Array?t:typeof t=="string"?hNr(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}cne.convertToBuffer=gNr});var Oht=x(dne=>{"use strict";Object.defineProperty(dne,"__esModule",{value:!0});dne.isEmptyData=void 0;function yNr(t){return typeof t=="string"?t.length===0:t.byteLength===0}dne.isEmptyData=yNr});var Eht=x(fne=>{"use strict";Object.defineProperty(fne,"__esModule",{value:!0});fne.numToUint8=void 0;function bNr(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}fne.numToUint8=bNr});var Pht=x(pne=>{"use strict";Object.defineProperty(pne,"__esModule",{value:!0});pne.uint32ArrayFrom=void 0;function _Nr(t){if(!Uint32Array.from){for(var e=new Uint32Array(t.length),r=0;r<t.length;)e[r]=t[r],r+=1;return e}return Uint32Array.from(t)}pne.uint32ArrayFrom=_Nr});var mne=x(lw=>{"use strict";Object.defineProperty(lw,"__esModule",{value:!0});lw.uint32ArrayFrom=lw.numToUint8=lw.isEmptyData=lw.convertToBuffer=void 0;var vNr=Cht();Object.defineProperty(lw,"convertToBuffer",{enumerable:!0,get:function(){return vNr.convertToBuffer}});var wNr=Oht();Object.defineProperty(lw,"isEmptyData",{enumerable:!0,get:function(){return wNr.isEmptyData}});var xNr=Eht();Object.defineProperty(lw,"numToUint8",{enumerable:!0,get:function(){return xNr.numToUint8}});var SNr=Pht();Object.defineProperty(lw,"uint32ArrayFrom",{enumerable:!0,get:function(){return SNr.uint32ArrayFrom}})});var Aht=x(yne=>{"use strict";Object.defineProperty(yne,"__esModule",{value:!0});yne.Sha256=void 0;var Tht=(RPe(),jc(MPe)),gne=NPe(),hne=dht(),LPe=mne(),CNr=function(){function t(e){this.secret=e,this.hash=new hne.RawSha256,this.reset()}return t.prototype.update=function(e){if(!((0,LPe.isEmptyData)(e)||this.error))try{this.hash.update((0,LPe.convertToBuffer)(e))}catch(r){this.error=r}},t.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},t.prototype.digest=function(){return Tht.__awaiter(this,void 0,void 0,function(){return Tht.__generator(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new hne.RawSha256,this.secret){this.outer=new hne.RawSha256;var e=ONr(this.secret),r=new Uint8Array(gne.BLOCK_SIZE);r.set(e);for(var n=0;n<gne.BLOCK_SIZE;n++)e[n]^=54,r[n]^=92;this.hash.update(e),this.outer.update(r);for(var n=0;n<e.byteLength;n++)e[n]=0}},t}();yne.Sha256=CNr;function ONr(t){var e=(0,LPe.convertToBuffer)(t);if(e.byteLength>gne.BLOCK_SIZE){var r=new hne.RawSha256;r.update(e),e=r.digest()}var n=new Uint8Array(gne.BLOCK_SIZE);return n.set(e),n}});var kPe=x(FPe=>{"use strict";Object.defineProperty(FPe,"__esModule",{value:!0});var ENr=(RPe(),jc(MPe));ENr.__exportStar(Aht(),FPe)});var Iht=b(()=>{});var Mht=b(()=>{});var Rht=b(()=>{});var CD,X5=b(()=>{CD=class t extends Error{constructor(e,r=!0){let n,o=!0;typeof r=="boolean"?(n=void 0,o=r):r!=null&&typeof r=="object"&&(n=r.logger,o=r.tryNextLink??!0),super(e),this.name="ProviderError",this.tryNextLink=o,Object.setPrototypeOf(this,t.prototype),n?.debug?.(`@smithy/property-provider ${o?"->":"(!)"} ${e}`)}static from(e,r=!0){return Object.assign(new this(e.message,r),e)}}});var pc,Nht=b(()=>{X5();pc=class t extends CD{constructor(e,r=!0){super(e,r),this.name="CredentialsProviderError",Object.setPrototypeOf(this,t.prototype)}}});var jht=b(()=>{X5()});var Dht=b(()=>{X5()});var Lht=b(()=>{});var Fht,kht=b(()=>{Fht=(t,e,r)=>{let n,o,i,a=!1,s=async()=>{o||(o=t());try{n=await o,i=!0,a=!1}finally{o=void 0}return n};return e===void 0?async u=>((!i||u?.forceRefresh)&&(n=await s()),n):async u=>((!i||u?.forceRefresh)&&(n=await s()),a?n:r&&!r(n)?(a=!0,n):(e(n)&&await s(),n))}});var eP=b(()=>{Nht();X5();jht();Dht();Lht();kht()});function bne(t){return Promise.all(Object.keys(t).reduce((e,r)=>{let n=t[r];return typeof n=="string"?e.push([r,n]):e.push(n().then(o=>[r,o])),e},[])).then(e=>e.reduce((r,[n,o])=>(r[n]=o,r),{}))}var $Pe=b(()=>{});var $ht=b(()=>{});var Bht=b(()=>{$ht()});var zht=b(()=>{});var Uht,qht=b(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(Uht||(Uht={}))});var BPe,Hht=b(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(BPe||(BPe={}))});var Vht=b(()=>{});var Wht=b(()=>{});var Kht=b(()=>{});var Ght=b(()=>{});var Jht=b(()=>{qht();Hht();Vht();Wht();Kht();Ght()});var Zht=b(()=>{});var Yht=b(()=>{});var Xht=b(()=>{});var Qht=b(()=>{});var egt=b(()=>{});var tgt=b(()=>{});var rgt=b(()=>{});var ngt=b(()=>{egt();tgt();rgt()});var ogt=b(()=>{});var igt=b(()=>{});var oU,agt=b(()=>{(function(t){t.HTTP="http",t.HTTPS="https"})(oU||(oU={}))});var sgt=b(()=>{});var ugt=b(()=>{});var lgt=b(()=>{});var cgt=b(()=>{});var dgt=b(()=>{});var fgt=b(()=>{sgt();ugt();lgt();cgt();dgt()});var pgt=b(()=>{});var iU,zPe=b(()=>{(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(iU||(iU={}))});var mgt=b(()=>{zPe()});var hgt=b(()=>{});var ggt=b(()=>{mgt();hgt();zPe()});var Gh,ygt=b(()=>{(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(Gh||(Gh={}))});var bgt=b(()=>{});var _gt=b(()=>{});var vgt=b(()=>{});var wgt=b(()=>{});var xgt=b(()=>{});var Sgt=b(()=>{_gt();vgt();wgt();xgt()});var Cgt=b(()=>{});var aU,Ogt=b(()=>{aU="__smithy_context"});var Egt=b(()=>{});var Pgt,Tgt=b(()=>{(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(Pgt||(Pgt={}))});var Agt=b(()=>{});var Igt=b(()=>{});var Mgt=b(()=>{});var Rgt=b(()=>{});var Ngt=b(()=>{});var jgt=b(()=>{});var Dgt=b(()=>{});var Lgt=b(()=>{});var Fgt=b(()=>{});var kgt,$gt=b(()=>{(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(kgt||(kgt={}))});var Bgt=b(()=>{});var zgt=b(()=>{});var Ugt=b(()=>{});var qgt=b(()=>{});var Hgt=b(()=>{});var Vgt=b(()=>{});var Ou=b(()=>{zht();Jht();Zht();Yht();Xht();Qht();ngt();ogt();igt();agt();fgt();pgt();ggt();ygt();bgt();Sgt();Cgt();Ogt();Egt();Tgt();Agt();Igt();Mgt();Rgt();Ngt();jgt();Dgt();Lgt();Fgt();$gt();Bgt();zgt();Ugt();qgt();Hgt();Vgt()});var Wgt=b(()=>{Ou()});var Kgt=b(()=>{});var Ggt=b(()=>{});function PNr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var _ne,Jgt=b(()=>{_ne=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=PNr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var Zgt=b(()=>{});var Ygt=b(()=>{});var Xgt=b(()=>{});var Qgt=b(()=>{Bht();Wgt();Kgt();Ggt();Jgt();Zgt();Ygt();Xgt()});var TNr,ANr,vne,UPe=b(()=>{Qgt();TNr=t=>e=>async r=>{if(!_ne.isInstance(r.request))return e(r);let{request:n}=r,{handlerProtocol:o=""}=t.requestHandler.metadata||{};if(o.indexOf("h2")>=0&&!n.headers[":authority"])delete n.headers.host,n.headers[":authority"]=n.hostname+(n.port?":"+n.port:"");else if(!n.headers.host){let i=n.hostname;n.port!=null&&(i+=`:${n.port}`),n.headers.host=i}return e(r)},ANr={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},vne=t=>({applyToStack:e=>{e.add(TNr(t),ANr)}})});var INr,MNr,wne,eyt=b(()=>{INr=()=>(t,e)=>async r=>{try{let n=await t(r),{clientName:o,commandName:i,logger:a,dynamoDbDocumentClientOptions:s={}}=e,{overrideInputFilterSensitiveLog:u,overrideOutputFilterSensitiveLog:l}=s,c=u??e.inputFilterSensitiveLog,d=l??e.outputFilterSensitiveLog,{$metadata:f,...p}=n.output;return a?.info?.({clientName:o,commandName:i,input:c(r.input),output:d(p),metadata:f}),n}catch(n){let{clientName:o,commandName:i,logger:a,dynamoDbDocumentClientOptions:s={}}=e,{overrideInputFilterSensitiveLog:u}=s,l=u??e.inputFilterSensitiveLog;throw a?.error?.({clientName:o,commandName:i,input:l(r.input),error:n,metadata:n.$metadata}),n}},MNr={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},wne=t=>({applyToStack:e=>{e.add(INr(),MNr)}})});var qPe=b(()=>{eyt()});var tyt=b(()=>{});var ryt=b(()=>{tyt()});var nyt=b(()=>{Ou()});var oyt=b(()=>{});var iyt=b(()=>{});function RNr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var xne,ayt=b(()=>{xne=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=RNr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var syt=b(()=>{});var uyt=b(()=>{});var lyt=b(()=>{});var cyt=b(()=>{ryt();nyt();oyt();iyt();ayt();syt();uyt();lyt()});var dyt,NNr,jNr,DNr,LNr,Sne,HPe=b(()=>{cyt();dyt="X-Amzn-Trace-Id",NNr="AWS_LAMBDA_FUNCTION_NAME",jNr="_X_AMZN_TRACE_ID",DNr=t=>e=>async r=>{let{request:n}=r;if(!xne.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(dyt))return e(r);let o=process.env[NNr],i=process.env[jNr],a=s=>typeof s=="string"&&s.length>0;return a(o)&&a(i)&&(n.headers[dyt]=i),e({...r,request:n})},LNr={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},Sne=t=>({applyToStack:e=>{e.add(DNr(t),LNr)}})});function Cne(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}var fyt=b(()=>{});var FNr,Q5,VPe=b(()=>{FNr=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),Q5=t=>FNr.test(t)||t.startsWith("[")&&t.endsWith("]")});var kNr,eW,WPe=b(()=>{kNr=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),eW=(t,e=!1)=>{if(!e)return kNr.test(t);let r=t.split(".");for(let n of r)if(!eW(n))return!1;return!0}});var tP,One=b(()=>{tP={}});var rP,pyt=b(()=>{rP="endpoints"});function hy(t){return typeof t!="object"||t==null?t:"ref"in t?`$${hy(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(hy).join(", ")})`:JSON.stringify(t,null,2)}var myt=b(()=>{});var tW=b(()=>{pyt();myt()});var fa,hyt=b(()=>{fa=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var gyt=b(()=>{});var yyt=b(()=>{});var byt=b(()=>{});var _yt=b(()=>{});var vyt=b(()=>{});var wyt=b(()=>{});var gy=b(()=>{hyt();gyt();yyt();byt();_yt();vyt();wyt()});var xyt,Syt=b(()=>{xyt=(t,e)=>t===e});var Cyt,Oyt=b(()=>{gy();Cyt=t=>{let e=t.split("."),r=[];for(let n of e){let o=n.indexOf("[");if(o!==-1){if(n.indexOf("]")!==n.length-1)throw new fa(`Path: '${t}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new fa(`Invalid array index: '${i}' in path: '${t}'`);o!==0&&r.push(n.slice(0,o)),r.push(i)}else r.push(n)}return r}});var Ene,Eyt=b(()=>{gy();Oyt();Ene=(t,e)=>Cyt(e).reduce((r,n)=>{if(typeof r!="object")throw new fa(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t)});var Pyt,Tyt=b(()=>{Pyt=t=>t!=null});var Ayt,Iyt=b(()=>{Ayt=t=>!t});var KPe,Myt,Ryt=b(()=>{Ou();VPe();KPe={[oU.HTTP]:80,[oU.HTTPS]:443},Myt=t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:f,port:p,protocol:m="",path:h="",query:y={}}=t,g=new URL(`${m}//${f}${p?`:${p}`:""}${h}`);return g.search=Object.entries(y).map(([_,w])=>`${_}=${w}`).join("&"),g}return new URL(t)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`),null;let r=e.href,{host:n,hostname:o,pathname:i,protocol:a,search:s}=e;if(s)return null;let u=a.slice(0,-1);if(!Object.values(oU).includes(u))return null;let l=Q5(o),c=r.includes(`${n}:${KPe[u]}`)||typeof t=="string"&&t.includes(`${n}:${KPe[u]}`),d=`${n}${c?`:${KPe[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var Nyt,jyt=b(()=>{Nyt=(t,e)=>t===e});var Dyt,Lyt=b(()=>{Dyt=(t,e,r,n)=>e>=r||t.length<r?null:n?t.substring(t.length-r,t.length-e):t.substring(e,r)});var Fyt,kyt=b(()=>{Fyt=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var GPe=b(()=>{Syt();Eyt();Tyt();WPe();Iyt();Ryt();jyt();Lyt();kyt()});var $yt,Byt=b(()=>{GPe();$yt={booleanEquals:xyt,getAttr:Ene,isSet:Pyt,isValidHostLabel:eW,not:Ayt,parseURL:Myt,stringEquals:Nyt,substring:Dyt,uriEncode:Fyt}});var Pne,JPe=b(()=>{GPe();Pne=(t,e)=>{let r=[],n={...e.endpointParams,...e.referenceRecord},o=0;for(;o<t.length;){let i=t.indexOf("{",o);if(i===-1){r.push(t.slice(o));break}r.push(t.slice(o,i));let a=t.indexOf("}",i);if(a===-1){r.push(t.slice(i));break}t[i+1]==="{"&&t[a+1]==="}"&&(r.push(t.slice(i+1,a)),o=a+2);let s=t.substring(i+1,a);if(s.includes("#")){let[u,l]=s.split("#");r.push(Ene(n[u],l))}else r.push(n[s]);o=a+1}return r.join("")}});var zyt,Uyt=b(()=>{zyt=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t]});var HI,rW=b(()=>{gy();ZPe();JPe();Uyt();HI=(t,e,r)=>{if(typeof t=="string")return Pne(t,r);if(t.fn)return Tne(t,r);if(t.ref)return zyt(t,r);throw new fa(`'${e}': ${String(t)} is not a string, function or reference.`)}});var Tne,ZPe=b(()=>{One();Byt();rW();Tne=({fn:t,argv:e},r)=>{let n=e.map(i=>["boolean","number"].includes(typeof i)?i:HI(i,"arg",r)),o=t.split(".");return o[0]in tP&&o[1]!=null?tP[o[0]][o[1]](...n):$yt[t](...n)}});var qyt,Hyt=b(()=>{tW();gy();ZPe();qyt=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new fa(`'${t}' is already defined in Reference Record.`);let n=Tne(e,r);return r.logger?.debug?.(`${rP} evaluateCondition: ${hy(e)} = ${hy(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}}});var sU,Ane=b(()=>{tW();Hyt();sU=(t=[],e)=>{let r={};for(let n of t){let{result:o,toAssign:i}=qyt(n,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,e.logger?.debug?.(`${rP} assign: ${i.name} := ${hy(i.value)}`))}return{result:!0,referenceRecord:r}}});var Vyt,Wyt=b(()=>{gy();rW();Vyt=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=HI(i,"Header value entry",e);if(typeof a!="string")throw new fa(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var YPe,Kyt=b(()=>{gy();JPe();XPe();YPe=(t,e)=>{if(Array.isArray(t))return t.map(r=>YPe(r,e));switch(typeof t){case"string":return Pne(t,e);case"object":if(t===null)throw new fa(`Unexpected endpoint property: ${t}`);return Ine(t,e);case"boolean":return t;default:throw new fa(`Unexpected endpoint property type: ${typeof t}`)}}});var Ine,XPe=b(()=>{Kyt();Ine=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:YPe(o,e)}),{})});var Gyt,Jyt=b(()=>{gy();rW();Gyt=(t,e)=>{let r=HI(t,"Endpoint URL",e);if(typeof r=="string")try{return new URL(r)}catch(n){throw console.error(`Failed to construct URL with ${r}`,n),n}throw new fa(`Endpoint URL must be a string, got ${typeof r}`)}});var Zyt,Yyt=b(()=>{tW();Ane();Wyt();XPe();Jyt();Zyt=(t,e)=>{let{conditions:r,endpoint:n}=t,{result:o,referenceRecord:i}=sU(r,e);if(!o)return;let a={...e,referenceRecord:{...e.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return e.logger?.debug?.(`${rP} Resolving endpoint from template: ${hy(n)}`),{...l!=null&&{headers:Vyt(l,a)},...u!=null&&{properties:Ine(u,a)},url:Gyt(s,a)}}});var Xyt,Qyt=b(()=>{gy();Ane();rW();Xyt=(t,e)=>{let{conditions:r,error:n}=t,{result:o,referenceRecord:i}=sU(r,e);if(o)throw new fa(HI(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))}});var ebt,tbt=b(()=>{Ane();QPe();ebt=(t,e)=>{let{conditions:r,rules:n}=t,{result:o,referenceRecord:i}=sU(r,e);if(o)return Mne(n,{...e,referenceRecord:{...e.referenceRecord,...i}})}});var Mne,QPe=b(()=>{gy();Yyt();Qyt();tbt();Mne=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=Zyt(r,e);if(n)return n}else if(r.type==="error")Xyt(r,e);else if(r.type==="tree"){let n=ebt(r,e);if(n)return n}else throw new fa(`Unknown endpoint rule: ${r}`);throw new fa("Rules evaluation failed")}});var rbt=b(()=>{One();QPe()});var nW,nbt=b(()=>{tW();gy();rbt();nW=(t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:o,rules:i}=t;e.logger?.debug?.(`${rP} Initial EndpointParams: ${hy(r)}`);let a=Object.entries(o).filter(([,l])=>l.default!=null).map(([l,c])=>[l,c.default]);if(a.length>0)for(let[l,c]of a)r[l]=r[l]??c;let s=Object.entries(o).filter(([,l])=>l.required).map(([l])=>l);for(let l of s)if(r[l]==null)throw new fa(`Missing required parameter: '${l}'`);let u=Mne(i,{endpointParams:r,logger:n,referenceRecord:{}});if(e.endpointParams?.Endpoint)try{let l=new URL(e.endpointParams.Endpoint),{protocol:c,port:d}=l;u.url.protocol=c,u.url.port=d}catch{}return e.logger?.debug?.(`${rP} Resolved endpoint: ${hy(u)}`),u}});var VI=b(()=>{VPe();WPe();One();nbt();gy()});var eTe=b(()=>{VI()});var tTe,obt=b(()=>{VI();eTe();tTe=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!tTe(r))return!1;return!0}return!(!eW(t)||t.length<3||t.length>63||t!==t.toLowerCase()||Q5(t))}});var ibt,$Nr,abt,sbt=b(()=>{ibt=":",$Nr="/",abt=t=>{let e=t.split(ibt);if(e.length<6)return null;let[r,n,o,i,a,...s]=e;if(r!=="arn"||n===""||o===""||s.join(ibt)==="")return null;let u=s.map(l=>l.split($Nr)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var lbt,ubt=b(()=>{lbt={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"aws-global":{description:"AWS Standard global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"AWS China global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"AWS GovCloud (US) global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"c2s.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"AWS ISO (US) global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"sc2s.sgov.gov",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"AWS ISOB (US) global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"cloud.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"csp.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{}}],version:"1.1"}});var zNr,UNr,cbt,dbt,rTe=b(()=>{ubt();zNr=lbt,UNr="",cbt=t=>{let{partitions:e}=zNr;for(let n of e){let{regions:o,outputs:i}=n;for(let[a,s]of Object.entries(o))if(a===t)return{...i,...s}}for(let n of e){let{regionRegex:o,outputs:i}=n;if(new RegExp(o).test(t))return{...i}}let r=e.find(n=>n.id==="aws");if(!r)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...r.outputs}},dbt=()=>UNr});var oW,fbt=b(()=>{VI();obt();sbt();rTe();oW={isVirtualHostableS3Bucket:tTe,parseArn:abt,partition:cbt};tP.aws=oW});var pbt=b(()=>{VI()});var mbt=b(()=>{VI()});var hbt=b(()=>{});var gbt=b(()=>{});var ybt=b(()=>{});var bbt=b(()=>{});var _bt=b(()=>{});var vbt=b(()=>{mbt();hbt();gbt();ybt();bbt();_bt()});var Rne=b(()=>{fbt();rTe();eTe();pbt();vbt()});var wbt=b(()=>{});var xbt=b(()=>{wbt()});var Sbt=b(()=>{Ou()});var Cbt=b(()=>{});var Obt=b(()=>{});function qNr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Nne,Ebt=b(()=>{Nne=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=qNr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var Pbt=b(()=>{});var Tbt=b(()=>{});var Abt=b(()=>{});var Ibt=b(()=>{xbt();Sbt();Cbt();Obt();Ebt();Pbt();Tbt();Abt()});var nTe,jne,oTe,Dne,Mbt,Rbt,iTe,Nbt=b(()=>{nTe="user-agent",jne="x-amz-user-agent",oTe=" ",Dne="/",Mbt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,Rbt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,iTe="-"});var HNr,aTe,VNr,Lne,jbt=b(()=>{Rne();Ibt();Nbt();HNr=t=>(e,r)=>async n=>{let{request:o}=n;if(!Nne.isInstance(o))return e(n);let{headers:i}=o,a=r?.userAgent?.map(aTe)||[],s=(await t.defaultUserAgentProvider()).map(aTe),u=t?.customUserAgent?.map(aTe)||[],l=dbt(),c=(l?[l]:[]).concat([...s,...a,...u]).join(oTe),d=[...s.filter(f=>f.startsWith("aws-sdk-")),...u].join(oTe);return t.runtime!=="browser"?(d&&(i[jne]=i[jne]?`${i[nTe]} ${d}`:d),i[nTe]=c):i[jne]=c,e({...n,request:o})},aTe=t=>{let e=t[0].split(Dne).map(a=>a.replace(Mbt,iTe)).join(Dne),r=t[1]?.replace(Rbt,iTe),n=e.indexOf(Dne),o=e.substring(0,n),i=e.substring(n+1);return o==="api"&&(i=i.toLowerCase()),[o,i,r].filter(a=>a&&a.length>0).reduce((a,s,u)=>{switch(u){case 0:return s;case 1:return`${a}/${s}`;default:return`${a}#${s}`}},"")},VNr={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Lne=t=>({applyToStack:e=>{e.add(HNr(t),VNr)}})});var sTe=b(()=>{fyt();jbt()});var Dbt=b(()=>{});var Lbt=b(()=>{});var Fne,Fbt=b(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(Fne||(Fne={}))});var uTe=b(()=>{Dbt();Lbt();Fbt()});var kne,kbt=b(()=>{uTe();kne=!1});var $ne,$bt=b(()=>{uTe();$ne=!1});var cw,Bbt=b(()=>{Ou();cw=t=>t[aU]||(t[aU]={})});var qf,zbt=b(()=>{qf=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var e_=b(()=>{Bbt();zbt()});var Ubt=b(()=>{e_()});var qbt=b(()=>{});var Hbt=b(()=>{e_();qbt()});var Vbt=b(()=>{kbt();$bt();Ubt();Hbt()});var Wbt=b(()=>{});var Bne,lTe=b(()=>{Bne=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var cTe,Kbt=b(()=>{lTe();cTe=t=>Bne(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var zne,Gbt=b(()=>{Kbt();lTe();zne=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return cTe(e);let n=await e();return cTe(n)},useFipsEndpoint:async()=>{let n=typeof e=="string"?e:await e();return Bne(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}}});var Jbt=b(()=>{Wbt();Gbt()});var Zbt=b(()=>{});var Ybt=b(()=>{});var Xbt=b(()=>{});var Qbt=b(()=>{});var e_t=b(()=>{});var t_t=b(()=>{});var r_t=b(()=>{Xbt();Qbt();e_t();t_t()});var n_t=b(()=>{Zbt();Ybt();r_t()});var iW=b(()=>{Vbt();Jbt();n_t()});function KNr(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var dTe,Une=b(()=>{Ou();e_();dTe=(t,e)=>(r,n)=>async o=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,o.input)),a=KNr(t.httpAuthSchemes),s=cw(n),u=[];for(let l of i){let c=a.get(l.schemeId);if(!c){u.push(`HttpAuthScheme \`${l.schemeId}\` was not enabled for this service.`);continue}let d=c.identityProvider(await e.identityProviderConfigProvider(t));if(!d){u.push(`HttpAuthScheme \`${l.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:f={},signingProperties:p={}}=l.propertiesExtractor?.(t,n)||{};l.identityProperties=Object.assign(l.identityProperties||{},f),l.signingProperties=Object.assign(l.signingProperties||{},p),s.selectedHttpAuthScheme={httpAuthOption:l,identity:await d(l.identityProperties),signer:c.signer};break}if(!s.selectedHttpAuthScheme)throw new Error(u.join(`
`));return r(o)}});var o_t,GNr,JNr,ZNr,YNr,XNr,i_t=b(()=>{o_t=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),XNr(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!YNr(e)||e.indexOf(".")!==-1&&!String(t.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(t.ForcePathStyle=!0);return t.DisableMultiRegionAccessPoints&&(t.disableMultiRegionAccessPoints=!0,t.DisableMRAP=!0),t},GNr=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,JNr=/(\d+\.){3}\d+/,ZNr=/\.\./,YNr=t=>GNr.test(t)&&!JNr.test(t)&&!ZNr.test(t),XNr=t=>{let[e,r,n,,,o]=t.split(":"),i=e==="arn"&&t.split(":").length>=6,a=!!(i&&r&&n&&o);if(i&&!a)throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);return a}});var a_t=b(()=>{i_t()});var s_t,u_t=b(()=>{s_t=(t,e,r)=>{let n=async()=>{let o=r[t]??r[e];return typeof o=="function"?o():o};return t==="credentialScope"||e==="CredentialScope"?async()=>{let o=typeof r.credentials=="function"?await r.credentials():r.credentials;return o?.credentialScope??o?.CredentialScope}:t==="accountId"||e==="AccountId"?async()=>{let o=typeof r.credentials=="function"?await r.credentials():r.credentials;return o?.accountId??o?.AccountId}:t==="endpoint"||e==="endpoint"?async()=>{let o=await n();if(o&&typeof o=="object"){if("url"in o)return o.url.href;if("hostname"in o){let{protocol:i,hostname:a,port:s,path:u}=o;return`${i}//${a}${s?":"+s:""}${u}`}}return o}:n}});var l_t,c_t=b(()=>{l_t=async t=>{}});function d_t(t){let e={};if(t=t.replace(/^\?/,""),t)for(let r of t.split("&")){let[n,o=null]=r.split("=");n=decodeURIComponent(n),o&&(o=decodeURIComponent(o)),n in e?Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o]:e[n]=o}return e}var f_t=b(()=>{});var WI,qne=b(()=>{f_t();WI=t=>{if(typeof t=="string")return WI(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:i}=t,a;return i&&(a=d_t(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var Hne,Vne=b(()=>{qne();Hne=t=>typeof t=="object"?"url"in t?WI(t.url):t:WI(t)});var p_t,QNr,fTe=b(()=>{a_t();u_t();c_t();Vne();p_t=async(t,e,r,n)=>{if(!r.endpoint){let a=await l_t(r.serviceId||"");a&&(r.endpoint=()=>Promise.resolve(Hne(a)))}let o=await QNr(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},QNr=async(t,e,r)=>{let n={},o=e?.getEndpointParameterInstructions?.()||{};for(let[i,a]of Object.entries(o))switch(a.type){case"staticContextParams":n[i]=a.value;break;case"contextParams":n[i]=t[a.name];break;case"clientContextParams":case"builtInParams":n[i]=await s_t(a.name,i,r)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(a))}return Object.keys(o).length===0&&Object.assign(n,r),String(r.serviceId).toLowerCase()==="s3"&&await o_t(n),n}});var m_t=b(()=>{fTe();Vne()});var h_t,pTe=b(()=>{e_();fTe();h_t=({config:t,instructions:e})=>(r,n)=>async o=>{let i=await p_t(o.input,{getEndpointParameterInstructions(){return e}},{...t},n);n.endpointV2=i,n.authSchemes=i.properties?.authSchemes;let a=n.authSchemes?.[0];if(a){n.signing_region=a.signingRegion,n.signing_service=a.signingName;let u=cw(n)?.selectedHttpAuthScheme?.httpAuthOption;u&&(u.signingProperties=Object.assign(u.signingProperties||{},{signing_region:a.signingRegion,signingRegion:a.signingRegion,signing_service:a.signingName,signingName:a.signingName,signingRegionSet:a.signingRegionSet},a.properties))}return r({...o})}});var g_t,mTe=b(()=>{g_t=(t,e)=>r=>async n=>{let{response:o}=await r(n);try{let i=await e(o,t);return{response:o,output:i}}catch(i){if(Object.defineProperty(i,"$response",{value:o}),!("$metadata"in i)){let a="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";i.message+=`
`+a,typeof i.$responseBodyText<"u"&&i.$response&&(i.$response.body=i.$responseBodyText)}throw i}}});var y_t,hTe=b(()=>{y_t=(t,e)=>(r,n)=>async o=>{let i=n.endpointV2?.url&&t.urlParser?async()=>t.urlParser(n.endpointV2.url):t.endpoint;if(!i)throw new Error("No valid endpoint provider available.");let a=await e(o.input,{...t,endpoint:i});return r({...o,request:a})}});function Bt(t,e,r){return{applyToStack:n=>{n.add(g_t(t,r),ejr),n.add(y_t(t,e),aW)}}}var ejr,aW,b_t=b(()=>{mTe();hTe();ejr={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},aW={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var Oo=b(()=>{mTe();b_t();hTe()});var gTe,zt,__t=b(()=>{Oo();pTe();gTe={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:aW.name},zt=(t,e)=>({applyToStack:r=>{r.addRelativeTo(h_t({config:t,instructions:e}),gTe)}})});var Wne,v_t=b(()=>{e_();Vne();Wne=t=>{let e=t.tls??!0,{endpoint:r}=t,n=r!=null?async()=>Hne(await qf(r)()):void 0;return{...t,endpoint:n,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:qf(t.useDualstackEndpoint??!1),useFipsEndpoint:qf(t.useFipsEndpoint??!1)}}});var w_t=b(()=>{});var po=b(()=>{m_t();pTe();__t();v_t();w_t()});var tjr,Kne,x_t=b(()=>{po();Une();tjr={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:gTe.name},Kne=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(dTe(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),tjr)}})});var _Co,S_t=b(()=>{Oo();Une();_Co={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:aW.name}});var C_t=b(()=>{Une();x_t();S_t()});var O_t=b(()=>{});var E_t=b(()=>{O_t()});var P_t=b(()=>{Ou()});var T_t=b(()=>{});var A_t=b(()=>{});function rjr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var OD,I_t=b(()=>{OD=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=rjr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var M_t=b(()=>{});var R_t=b(()=>{});var N_t=b(()=>{});var sW=b(()=>{E_t();P_t();T_t();A_t();I_t();M_t();R_t();N_t()});var njr,ojr,j_t,yTe=b(()=>{sW();Ou();e_();njr=t=>e=>{throw e},ojr=(t,e)=>{},j_t=t=>(e,r)=>async n=>{if(!OD.isInstance(n.request))return e(n);let i=cw(r).selectedHttpAuthScheme;if(!i)throw new Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:a={}},identity:s,signer:u}=i,l=await e({...n,request:await u.sign(n.request,s,a)}).catch((u.errorHandler||njr)(a));return(u.successHandler||ojr)(l.response,a),l}});var t_,dw,uW,Gne=b(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(t_||(t_={}));dw=3,uW=t_.STANDARD});var D_t,L_t,F_t,k_t,$_t=b(()=>{D_t=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],L_t=["TimeoutError","RequestTimeout","RequestTimeoutException"],F_t=[500,502,503,504],k_t=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"]});var ijr,uU,Jne,B_t,lW=b(()=>{$_t();ijr=t=>t.$metadata?.clockSkewCorrected,uU=t=>t.$metadata?.httpStatusCode===429||D_t.includes(t.name)||t.$retryable?.throttling==!0,Jne=t=>ijr(t)||L_t.includes(t.name)||k_t.includes(t?.code||"")||F_t.includes(t.$metadata?.httpStatusCode||0),B_t=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!Jne(t)}return!1}});var cW,bTe=b(()=>{lW();cW=class{constructor(e){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8;let r=this.getCurrentTimeInSeconds();this.lastThrottleTime=r,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){let r=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise(n=>setTimeout(n,r))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){let e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}let r=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+r),this.lastTimestamp=e}updateClientSendingRate(e){let r;if(this.updateMeasuredRate(),uU(e)){let o=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=o,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(o),this.enableTokenBucket()}else this.calculateTimeWindow(),r=this.cubicSuccess(this.getCurrentTimeInSeconds());let n=Math.min(r,2*this.measuredTxRate);this.updateTokenBucketRate(n)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){let e=this.getCurrentTimeInSeconds(),r=Math.floor(e*2)/2;if(this.requestCount++,r>this.lastTxRateBucket){let n=this.requestCount/(r-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(n*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=r}}getPrecise(e){return parseFloat(e.toFixed(8))}}});var Zne,Yne,lU=b(()=>{Zne="amz-sdk-invocation-id",Yne="amz-sdk-request"});var z_t,U_t=b(()=>{lU();z_t=()=>{let t=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}}});var _Te,q_t=b(()=>{lU();_Te=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r})});var ED,Qne=b(()=>{Gne();lU();U_t();q_t();ED=class{constructor(e){this.maxAttempts=e,this.mode=t_.STANDARD,this.capacity=500,this.retryBackoffStrategy=z_t(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return _Te({retryDelay:100,retryCount:0})}async refreshRetryTokenForRetry(e,r){let n=await this.getMaxAttempts();if(this.shouldRetry(e,r,n)){let o=r.errorType;this.retryBackoffStrategy.setDelayBase(o==="THROTTLING"?500:100);let i=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),a=r.retryAfterHint?Math.max(r.retryAfterHint.getTime()-Date.now()||0,i):i,s=this.getCapacityCost(o);return this.capacity-=s,_Te({retryDelay:a,retryCount:e.getRetryCount()+1,retryCost:s})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${dw}`),dw}}shouldRetry(e,r,n){return e.getRetryCount()+1<n&&this.capacity>=this.getCapacityCost(r.errorType)&&this.isRetryableError(r.errorType)}getCapacityCost(e){return e==="TRANSIENT"?10:5}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}});var eoe,G_t=b(()=>{Gne();bTe();Qne();eoe=class{constructor(e,r){this.maxAttemptsProvider=e,this.mode=t_.ADAPTIVE;let{rateLimiter:n}=r??{};this.rateLimiter=n??new cW,this.standardRetryStrategy=new ED(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,r){return this.rateLimiter.updateClientSendingRate(r),this.standardRetryStrategy.refreshRetryTokenForRetry(e,r)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}});var J_t=b(()=>{lU();Qne()});var Z_t=b(()=>{});var fw=b(()=>{G_t();J_t();bTe();Qne();Gne();lU();Z_t()});var Y_t=b(()=>{});var X_t=b(()=>{Y_t()});var Q_t=b(()=>{Ou()});var evt=b(()=>{});var tvt=b(()=>{});function ajr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var dU,rvt=b(()=>{dU=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=ajr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var dW,nvt=b(()=>{dW=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var ovt=b(()=>{});var ivt=b(()=>{});var toe=b(()=>{X_t();Q_t();evt();tvt();rvt();nvt();ovt();ivt()});var avt=b(()=>{fw()});var wTe=b(()=>{fw()});var xTe=b(()=>{lW()});var STe,CTe=b(()=>{STe=t=>t instanceof Error?t:t instanceof Object?Object.assign(new Error,t):typeof t=="string"?new Error(t):new Error(`AWS SDK error wrapper for ${t}`)});var OTe=b(()=>{toe();lW();fw();avt();wTe();xTe();CTe()});var svt=b(()=>{fw();OTe()});var roe,uvt=b(()=>{e_();fw();roe=t=>{let{retryStrategy:e}=t,r=qf(t.maxAttempts??dw);return{...t,maxAttempts:r,retryStrategy:async()=>e||(await qf(t.retryMode)()===t_.ADAPTIVE?new eoe(r):new ED(r))}}});var lvt=b(()=>{toe();fw()});var KI,cvt=b(()=>{KI=class{trace(){}debug(){}info(){}warn(){}error(){}}});var PD,GI,fU,dvt,fvt,pvt=b(()=>{PD=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},GI=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,fU=()=>{let t=[],e=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>dvt[p.step]-dvt[f.step]||fvt[p.priority||"normal"]-fvt[f.priority||"normal"]),i=d=>{let f=!1,p=m=>{let h=PD(m.name,m.aliases);if(h.includes(d)){f=!0;for(let y of h)n.delete(y);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},a=d=>{let f=!1,p=m=>{if(m.middleware===d){f=!0;for(let h of PD(m.name,m.aliases))n.delete(h);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},s=d=>(t.forEach(f=>{d.add(f.middleware,{...f})}),e.forEach(f=>{d.addRelativeTo(f.middleware,{...f})}),d.identifyOnResolve?.(c.identifyOnResolve()),d),u=d=>{let f=[];return d.before.forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f.push(d),d.after.reverse().forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f},l=(d=!1)=>{let f=[],p=[],m={};return t.forEach(y=>{let g={...y,before:[],after:[]};for(let _ of PD(g.name,g.aliases))m[_]=g;f.push(g)}),e.forEach(y=>{let g={...y,before:[],after:[]};for(let _ of PD(g.name,g.aliases))m[_]=g;p.push(g)}),p.forEach(y=>{if(y.toMiddleware){let g=m[y.toMiddleware];if(g===void 0){if(d)return;throw new Error(`${y.toMiddleware} is not found when adding ${GI(y.name,y.aliases)} middleware ${y.relation} ${y.toMiddleware}`)}y.relation==="after"&&g.after.push(y),y.relation==="before"&&g.before.push(y)}}),o(f).map(u).reduce((y,g)=>(y.push(...g),y),[])},c={add:(d,f={})=>{let{name:p,override:m,aliases:h}=f,y={step:"initialize",priority:"normal",middleware:d,...f},g=PD(p,h);if(g.length>0){if(g.some(_=>n.has(_))){if(!m)throw new Error(`Duplicate middleware name '${GI(p,h)}'`);for(let _ of g){let w=t.findIndex(C=>C.name===_||C.aliases?.some(E=>E===_));if(w===-1)continue;let S=t[w];if(S.step!==y.step||y.priority!==S.priority)throw new Error(`"${GI(S.name,S.aliases)}" middleware with ${S.priority} priority in ${S.step} step cannot be overridden by "${GI(p,h)}" middleware with ${y.priority} priority in ${y.step} step.`);t.splice(w,1)}}for(let _ of g)n.add(_)}t.push(y)},addRelativeTo:(d,f)=>{let{name:p,override:m,aliases:h}=f,y={middleware:d,...f},g=PD(p,h);if(g.length>0){if(g.some(_=>n.has(_))){if(!m)throw new Error(`Duplicate middleware name '${GI(p,h)}'`);for(let _ of g){let w=e.findIndex(C=>C.name===_||C.aliases?.some(E=>E===_));if(w===-1)continue;let S=e[w];if(S.toMiddleware!==y.toMiddleware||S.relation!==y.relation)throw new Error(`"${GI(S.name,S.aliases)}" middleware ${S.relation} "${S.toMiddleware}" middleware cannot be overridden by "${GI(p,h)}" middleware ${y.relation} "${y.toMiddleware}" middleware.`);e.splice(w,1)}}for(let _ of g)n.add(_)}e.push(y)},clone:()=>s(fU()),use:d=>{d.applyToStack(c)},remove:d=>typeof d=="string"?i(d):a(d),removeByTag:d=>{let f=!1,p=m=>{let{tags:h,name:y,aliases:g}=m;if(h&&h.includes(d)){let _=PD(y,g);for(let w of _)n.delete(w);return f=!0,!1}return!0};return t=t.filter(p),e=e.filter(p),f},concat:d=>{let f=s(fU());return f.use(d),f.identifyOnResolve(r||f.identifyOnResolve()||(d.identifyOnResolve?.()??!1)),f},applyToStack:s,identify:()=>l(!0).map(d=>{let f=d.step??d.relation+" "+d.toMiddleware;return GI(d.name,d.aliases)+" - "+f}),identifyOnResolve(d){return typeof d=="boolean"&&(r=d),r},resolve:(d,f)=>{for(let p of l().map(m=>m.middleware).reverse())d=p(d,f);return r&&console.log(c.identify()),d}};return c},dvt={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},fvt={high:3,normal:2,low:1}});var ETe=b(()=>{pvt()});var TD,mvt=b(()=>{ETe();TD=class{constructor(e){this.middlewareStack=fU(),this.config=e}send(e,r,n){let o=typeof r!="function"?r:void 0,i=typeof r=="function"?r:n,a=e.resolveMiddleware(this.middlewareStack,this.config,o);if(i)a(e).then(s=>i(null,s.output),s=>i(s)).catch(()=>{});else return a(e).then(s=>s.output)}destroy(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()}}});var nP,AD,JI,ID,hvt,PTe=b(()=>{nP={},AD=new Array(64);for(let t=0,e=65,r=90;t+e<=r;t++){let n=String.fromCharCode(t+e);nP[n]=t,AD[t]=n}for(let t=0,e=97,r=122;t+e<=r;t++){let n=String.fromCharCode(t+e),o=t+26;nP[n]=o,AD[o]=n}for(let t=0;t<10;t++){nP[t.toString(10)]=t+52;let e=t.toString(10),r=t+52;nP[e]=r,AD[r]=e}nP["+"]=62;AD[62]="+";nP["/"]=63;AD[63]="/";JI=6,ID=8,hvt=63});var ZI,gvt=b(()=>{PTe();ZI=t=>{let e=t.length/4*3;t.slice(-2)==="=="?e-=2:t.slice(-1)==="="&&e--;let r=new ArrayBuffer(e),n=new DataView(r);for(let o=0;o<t.length;o+=4){let i=0,a=0;for(let l=o,c=o+3;l<=c;l++)if(t[l]!=="="){if(!(t[l]in nP))throw new TypeError(`Invalid character ${t[l]} in base64 string.`);i|=nP[t[l]]<<(c-l)*JI,a+=JI}else i>>=JI;let s=o/4*3;i>>=a%ID;let u=Math.floor(a/ID);for(let l=0;l<u;l++){let c=(u-l-1)*ID;n.setUint8(s+l,(i&255<<c)>>c)}}return new Uint8Array(r)}});var TTe,ATe=b(()=>{TTe=t=>new TextEncoder().encode(t)});var yvt=b(()=>{ATe()});var bvt=b(()=>{});var _vt=b(()=>{ATe();yvt();bvt()});function YI(t){let e;typeof t=="string"?e=TTe(t):e=t;let r=typeof e=="object"&&typeof e.length=="number",n=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!r&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let o="";for(let i=0;i<e.length;i+=3){let a=0,s=0;for(let l=i,c=Math.min(i+3,e.length);l<c;l++)a|=e[l]<<(c-l-1)*ID,s+=ID;let u=Math.ceil(s/JI);a<<=u*JI-s;for(let l=1;l<=u;l++){let c=(u-l)*JI;o+=AD[(a&hvt<<c)>>c]}o+="==".slice(0,4-u)}return o}var vvt=b(()=>{_vt();PTe()});var pU=b(()=>{gvt();vvt()});var ITe,MTe=b(()=>{ITe=t=>new TextEncoder().encode(t)});var wvt=b(()=>{MTe()});var noe,xvt=b(()=>{noe=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});var RTe=b(()=>{MTe();wvt();xvt()});function Svt(t,e="utf-8"){return e==="base64"?YI(t):noe(t)}function Cvt(t,e){return e==="base64"?oP.mutate(ZI(t)):oP.mutate(ITe(t))}var Ovt=b(()=>{pU();RTe();NTe()});var oP,NTe=b(()=>{Ovt();oP=class t extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return Cvt(e,r);default:throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(e){return Object.setPrototypeOf(e,t.prototype),e}transformToString(e="utf-8"){return Svt(this,e)}}});var Evt=b(()=>{});var Pvt=b(()=>{});var Tvt=b(()=>{Pvt()});var Avt=b(()=>{Ou()});var Ivt=b(()=>{});var Mvt=b(()=>{});var Rvt=b(()=>{});var fW,Nvt=b(()=>{fW=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var jvt=b(()=>{});var Dvt=b(()=>{});var Lvt=b(()=>{Tvt();Avt();Ivt();Mvt();Rvt();Nvt();jvt();Dvt()});var yy,sjr,jTe=b(()=>{yy=t=>encodeURIComponent(t).replace(/[!'()*]/g,sjr),sjr=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var Fvt=b(()=>{jTe()});var ooe=b(()=>{jTe();Fvt()});function kvt(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=yy(r),Array.isArray(n))for(let o=0,i=n.length;o<i;o++)e.push(`${r}=${yy(n[o])}`);else{let o=r;(n||typeof n=="string")&&(o+=`=${yy(n)}`),e.push(o)}}return e.join("&")}var $vt=b(()=>{ooe()});function Bvt(t=0){return new Promise((e,r)=>{t&&setTimeout(()=>{let n=new Error(`Request did not complete within ${t} ms`);n.name="TimeoutError",r(n)},t)})}var zvt=b(()=>{});var DTe,XI,Uvt=b(()=>{Lvt();$vt();zvt();DTe={supported:void 0},XI=class t{static create(e){return typeof e?.handle=="function"?e:new t(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(r=>r||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),DTe.supported===void 0&&(DTe.supported=typeof Request<"u"&&"keepalive"in new Request("https://[::1]"))}destroy(){}async handle(e,{abortSignal:r}={}){this.config||(this.config=await this.configProvider);let n=this.config.requestTimeout,o=this.config.keepAlive===!0,i=this.config.credentials;if(r?.aborted){let g=new Error("Request aborted");return g.name="AbortError",Promise.reject(g)}let a=e.path,s=kvt(e.query||{});s&&(a+=`?${s}`),e.fragment&&(a+=`#${e.fragment}`);let u="";if(e.username!=null||e.password!=null){let g=e.username??"",_=e.password??"";u=`${g}:${_}@`}let{port:l,method:c}=e,d=`${e.protocol}//${u}${e.hostname}${l?`:${l}`:""}${a}`,f=c==="GET"||c==="HEAD"?void 0:e.body,p={body:f,headers:new Headers(e.headers),method:c,credentials:i};f&&(p.duplex="half"),typeof AbortController<"u"&&(p.signal=r),DTe.supported&&(p.keepalive=o);let m=()=>{},h=new Request(d,p),y=[fetch(h).then(g=>{let _=g.headers,w={};for(let C of _.entries())w[C[0]]=C[1];return g.body!=null?{response:new fW({headers:w,reason:g.statusText,statusCode:g.status,body:g.body})}:g.blob().then(C=>({response:new fW({headers:w,reason:g.statusText,statusCode:g.status,body:C})}))}),Bvt(n)];return r&&y.push(new Promise((g,_)=>{let w=()=>{let S=new Error("Request aborted");S.name="AbortError",_(S)};if(typeof r.addEventListener=="function"){let S=r;S.addEventListener("abort",w,{once:!0}),m=()=>S.removeEventListener("abort",w)}else r.onabort=w})),Promise.race(y).finally(m)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}});async function ujr(t){let e=await cjr(t),r=ZI(e);return new Uint8Array(r)}async function ljr(t){let e=[],r=t.getReader(),n=!1,o=0;for(;!n;){let{done:s,value:u}=await r.read();u&&(e.push(u),o+=u.length),n=s}let i=new Uint8Array(o),a=0;for(let s of e)i.set(s,a),a+=s.length;return i}function cjr(t){return new Promise((e,r)=>{let n=new FileReader;n.onloadend=()=>{if(n.readyState!==2)return r(new Error("Reader aborted too early"));let o=n.result??"",i=o.indexOf(","),a=i>-1?i+1:o.length;e(o.substring(a))},n.onabort=()=>r(new Error("Read aborted")),n.onerror=()=>r(n.error),n.readAsDataURL(t)})}var mU,qvt=b(()=>{pU();mU=t=>typeof Blob=="function"&&t instanceof Blob?ujr(t):ljr(t)});var pW=b(()=>{Uvt();qvt()});function Vvt(t){let e="";for(let r=0;r<t.byteLength;r++)e+=Hvt[t[r]];return e}var Hvt,djr,Wvt=b(()=>{Hvt={},djr={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Hvt[t]=e,djr[e]=t}});var LTe,FTe=b(()=>{LTe=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var Kvt,Jvt,Gvt,Zvt=b(()=>{pW();pU();Wvt();RTe();FTe();Kvt="The stream has already been transformed.",Jvt=t=>{if(!Gvt(t)&&!LTe(t)){let o=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${o}`)}let e=!1,r=async()=>{if(e)throw new Error(Kvt);return e=!0,await mU(t)},n=o=>{if(typeof o.stream!="function")throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`);return o.stream()};return Object.assign(t,{transformToByteArray:r,transformToString:async o=>{let i=await r();if(o==="base64")return YI(i);if(o==="hex")return Vvt(i);if(o===void 0||o==="utf8"||o==="utf-8")return noe(i);if(typeof TextDecoder=="function")return new TextDecoder(o).decode(i);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(e)throw new Error(Kvt);if(e=!0,Gvt(t))return n(t);if(LTe(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},Gvt=t=>typeof Blob=="function"&&t instanceof Blob});var Yvt=b(()=>{});var Xvt=b(()=>{});var kTe=b(()=>{NTe();Evt();Zvt();Yvt();Xvt();FTe()});var QI,Qvt=b(()=>{kTe();QI=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return oP.mutate(t);if(!t)return oP.mutate(new Uint8Array);let r=e.streamCollector(t);return oP.mutate(await r)}});var At,$Te,ewt=b(()=>{ETe();Ou();At=class{constructor(){this.middlewareStack=fU()}static classBuilder(){return new $Te}resolveMiddlewareWithContext(e,r,n,{middlewareFn:o,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,smithyContext:l,additionalContext:c,CommandCtor:d}){for(let y of o.bind(this)(d,e,r,n))this.middlewareStack.use(y);let f=e.concat(this.middlewareStack),{logger:p}=r,m={logger:p,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,[aU]:{commandInstance:this,...l},...c},{requestHandler:h}=r;return f.resolve(y=>h.handle(y.request,n||{}),m)}},$Te=class{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=e=>e,this._outputFilterSensitiveLog=e=>e,this._serializer=null,this._deserializer=null}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,r,n={}){return this._smithyContext={service:e,operation:r,...n},this}c(e={}){return this._additionalContext=e,this}n(e,r){return this._clientName=e,this._commandName=r,this}f(e=n=>n,r=n=>n){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=r,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){let e=this,r;return r=class extends At{static getEndpointParameterInstructions(){return e._ep}constructor(...[n]){super(),this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=n??{},e._init(this)}resolveMiddleware(n,o,i){return this.resolveMiddlewareWithContext(n,o,i,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}});var ioe,twt=b(()=>{ioe="***SensitiveInformation***"});var aoe,rwt=b(()=>{aoe=(t,e)=>{for(let r of Object.keys(t)){let n=t[r],o=async function(a,s,u){let l=new n(a);if(typeof s=="function")this.send(l,s);else if(typeof u=="function"){if(typeof s!="object")throw new Error(`Expected http options but got ${typeof s}`);this.send(l,s||{},u)}else return this.send(l,s)},i=(r[0].toLowerCase()+r.slice(1)).replace(/Command$/,"");e.prototype[i]=o}}});var MD,fjr,nwt,pjr,owt,iwt,awt,BTe,mjr,hU,An,swt,uwt,hjr,mW,hW,zTe,lwt,cwt,dwt,UTe=b(()=>{MD=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&dwt.warn(cwt(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},fjr=Math.ceil(34028234663852886e22),nwt=t=>{let e=MD(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>fjr)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},pjr=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},owt=t=>BTe(t,32),iwt=t=>BTe(t,16),awt=t=>BTe(t,8),BTe=(t,e)=>{let r=pjr(t);if(r!==void 0&&mjr(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},mjr=(t,e)=>{switch(e){case 32:return Int32Array.of(t)[0];case 16:return Int16Array.of(t)[0];case 8:return Int8Array.of(t)[0]}},hU=(t,e)=>{if(t==null)throw e?new TypeError(`Expected a non-null value for ${e}`):new TypeError("Expected a non-null value");return t},An=t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return dwt.warn(cwt(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},swt=t=>MD(typeof t=="string"?mW(t):t),uwt=t=>nwt(typeof t=="string"?mW(t):t),hjr=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,mW=t=>{let e=t.match(hjr);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},hW=t=>owt(typeof t=="string"?mW(t):t),zTe=t=>iwt(typeof t=="string"?mW(t):t),lwt=t=>awt(typeof t=="string"?mW(t):t),cwt=t=>String(new TypeError(t).stack||t).split(`
`).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
`),dwt={warn:console.warn}});var gjr,yjr,fwt,bjr,pwt,pTo,mTo,hTo,soe,mwt,gTo,_jr,vjr,wjr,RD,xjr,Sjr,qTe,hwt=b(()=>{UTe();gjr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yjr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),fwt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=yjr.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=e,c=zTe(qTe(n)),d=RD(o,"month",1,12),f=RD(i,"day",1,31);return mwt(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},bjr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),pwt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=bjr.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l,c]=e,d=zTe(qTe(n)),f=RD(o,"month",1,12),p=RD(i,"day",1,31),m=mwt(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&m.setTime(m.getTime()-Sjr(c)),m},pTo=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),mTo=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),hTo=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),soe=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=swt(t);else if(typeof t=="object"&&t.tag===1)e=t.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(e)||e===1/0||e===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(e*1e3))},mwt=(t,e,r,n)=>{let o=e-1;return vjr(t,o,r),new Date(Date.UTC(t,o,r,RD(n.hours,"hour",0,23),RD(n.minutes,"minute",0,59),RD(n.seconds,"seconds",0,60),xjr(n.fractionalMilliseconds)))},gTo=50*365*24*60*60*1e3,_jr=[31,28,31,30,31,30,31,31,30,31,30,31],vjr=(t,e,r)=>{let n=_jr[e];if(e===1&&wjr(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${gjr[e]} in ${t}: ${r}`)},wjr=t=>t%4===0&&(t%100!==0||t%400===0),RD=(t,e,r,n)=>{let o=lwt(qTe(t));if(o<r||o>n)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return o},xjr=t=>t==null?0:uwt("0."+t)*1e3,Sjr=t=>{let e=t[0],r=1;if(e=="+")r=1;else if(e=="-")r=-1;else throw new TypeError(`Offset direction, ${e}, must be "+" or "-"`);let n=Number(t.substring(1,3)),o=Number(t.substring(4,6));return r*(n*60+o)*60*1e3},qTe=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var gU,ps,HTe=b(()=>{gU=class t extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,t.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}},ps=(t,e={})=>{Object.entries(e).filter(([,n])=>n!==void 0).forEach(([n,o])=>{(t[n]==null||t[n]==="")&&(t[n]=o)});let r=t.message||t.Message||"UnknownError";return t.message=r,delete t.Message,t}});var Cjr,uoe,Ojr,gwt=b(()=>{HTe();Cjr=({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{let o=Ojr(t),i=o.httpStatusCode?o.httpStatusCode+"":void 0,a=new r({name:e?.code||e?.Code||n||i||"UnknownError",$fault:"client",$metadata:o});throw ps(a,e)},uoe=t=>({output:e,parsedBody:r,errorCode:n})=>{Cjr({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},Ojr=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]})});var loe,ywt=b(()=>{loe=t=>{switch(t){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}}});var bwt=b(()=>{});var _wt,vwt,wwt=b(()=>{Ou();_wt=t=>{let e=[];for(let r in iU){let n=iU[r];t[n]!==void 0&&e.push({algorithmId:()=>n,checksumConstructor:()=>t[n]})}return{_checksumAlgorithms:e,addChecksumAlgorithm(r){this._checksumAlgorithms.push(r)},checksumAlgorithms(){return this._checksumAlgorithms}}},vwt=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e}});var xwt,Swt,Cwt=b(()=>{xwt=t=>{let e=t.retryStrategy;return{setRetryStrategy(r){e=r},retryStrategy(){return e}}},Swt=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var coe,doe,Owt=b(()=>{wwt();Cwt();coe=t=>({..._wt(t),...xwt(t)}),doe=t=>({...vwt(t),...Swt(t)})});var Ewt=b(()=>{Owt()});function foe(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var VTe=b(()=>{});var Pwt=b(()=>{});var WTe,Twt=b(()=>{WTe=t=>{let e="#text";for(let r in t)t.hasOwnProperty(r)&&t[r][e]!==void 0?t[r]=t[r][e]:typeof t[r]=="object"&&t[r]!==null&&(t[r]=WTe(t[r]));return t}});var KTe,Awt=b(()=>{KTe=function(){let t=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),r=new e;return Object.setPrototypeOf(r,t.prototype),r};KTe.prototype=Object.create(String.prototype,{constructor:{value:KTe,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(KTe,String)});var gW,Ejr,Pjr,Tjr,Iwt=b(()=>{gW=(t,e)=>{let r={};for(let n in e)Ejr(r,t,e,n);return r},Ejr=(t,e,r,n)=>{if(e!==null){let a=r[n];typeof a=="function"&&(a=[,a]);let[s=Pjr,u=Tjr,l=n]=a;(typeof s=="function"&&s(e[l])||typeof s!="function"&&s)&&(t[n]=u(e[l]));return}let[o,i]=r[n];if(typeof i=="function"){let a,s=o===void 0&&(a=i())!=null,u=typeof o=="function"&&!!o(void 0)||typeof o!="function"&&!!o;s?t[n]=a:u&&(t[n]=i())}else{let a=o===void 0&&i!=null,s=typeof o=="function"&&!!o(i)||typeof o!="function"&&!!o;(a||s)&&(t[n]=i)}},Pjr=t=>t!=null,Tjr=t=>t});var Mwt=b(()=>{VTe()});var Rwt=b(()=>{});var fr,Nwt=b(()=>{fr=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(fr);if(typeof t=="object"){let e={};for(let r of Object.keys(t))t[r]!=null&&(e[r]=fr(t[r]));return e}return t}});var jwt=b(()=>{});var mr=b(()=>{cvt();mvt();Qvt();ewt();twt();rwt();hwt();gwt();ywt();bwt();Ewt();HTe();VTe();Pwt();Twt();Awt();Iwt();UTe();Mwt();Rwt();Nwt();jwt()});var Dwt,Lwt=b(()=>{Dwt=t=>t?.body instanceof ReadableStream});var Ajr,Ijr,Mjr,Rjr,GTe,poe,Njr,Fwt=b(()=>{toe();lW();mr();fw();ZN();Lwt();CTe();Ajr=t=>(e,r)=>async n=>{let o=await t.retryStrategy(),i=await t.maxAttempts();if(Ijr(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=dU.isInstance(c);for(d&&(c.headers[Zne]=mm());;)try{d&&(c.headers[Yne]=`attempt=${u+1}; max=${i}`);let{response:f,output:p}=await e(n);return o.recordSuccess(a),p.$metadata.attempts=u+1,p.$metadata.totalRetryDelay=l,{response:f,output:p}}catch(f){let p=Mjr(f);if(s=STe(f),d&&Dwt(c))throw(r.logger instanceof KI?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),s;try{a=await o.refreshRetryTokenForRetry(a,p)}catch{throw s.$metadata||(s.$metadata={}),s.$metadata.attempts=u+1,s.$metadata.totalRetryDelay=l,s}u=a.getRetryCount();let m=a.getRetryDelay();l+=m,await new Promise(h=>setTimeout(h,m))}}else return o=o,o?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",o.mode]]),o.retry(e,n)},Ijr=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",Mjr=t=>{let e={error:t,errorType:Rjr(t)},r=Njr(t.$response);return r&&(e.retryAfterHint=r),e},Rjr=t=>uU(t)?"THROTTLING":Jne(t)?"TRANSIENT":B_t(t)?"SERVER_ERROR":"CLIENT_ERROR",GTe={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},poe=t=>({applyToStack:e=>{e.add(Ajr(t),GTe)}}),Njr=t=>{if(!dW.isInstance(t))return;let e=Object.keys(t.headers).find(i=>i.toLowerCase()==="retry-after");if(!e)return;let r=t.headers[e],n=Number(r);return Number.isNaN(n)?new Date(r):new Date(n*1e3)}});var moe=b(()=>{svt();OTe();uvt();wTe();lvt();xTe();Fwt()});var jjr,hoe,kwt=b(()=>{moe();yTe();jjr={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:GTe.name},hoe=t=>({applyToStack:e=>{e.addRelativeTo(j_t(t),jjr)}})});var $wt=b(()=>{yTe();kwt()});var yU,Bwt=b(()=>{yU=class{constructor(e){this.authSchemes=new Map;for(let[r,n]of Object.entries(e))n!==void 0&&this.authSchemes.set(r,n)}getIdentityProvider(e){return this.authSchemes.get(e)}}});var zwt=b(()=>{sW();Ou()});var Uwt=b(()=>{sW()});var bU,qwt=b(()=>{bU=class{async sign(e,r,n){return e}}});var Hwt=b(()=>{zwt();Uwt();qwt()});var Djr,Vwt,JTe,Wwt,Kwt=b(()=>{Djr=t=>e=>JTe(e)&&e.expiration.getTime()-Date.now()<t,Vwt=Djr(3e5),JTe=t=>t.expiration!==void 0,Wwt=(t,e,r)=>{if(t===void 0)return;let n=typeof t!="function"?async()=>Promise.resolve(t):t,o,i,a,s=!1,u=async l=>{i||(i=n(l));try{o=await i,a=!0,s=!1}finally{i=void 0}return o};return e===void 0?async l=>((!a||l?.forceRefresh)&&(o=await u(l)),o):async l=>((!a||l?.forceRefresh)&&(o=await u(l)),s?o:r(o)?(e(o)&&await u(l),o):(s=!0,o))}});var Gwt=b(()=>{Bwt();Hwt();Kwt()});var Jwt=b(()=>{Ou()});var _U,Zwt=b(()=>{_U=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var Ywt=b(()=>{sW();mr()});function ZTe(t,e,r,n,o){return async function*(a,s,...u){let l=a.startingToken||void 0,c=!0,d;for(;c;){if(s[r]=l,o&&(s[o]=s[o]??a.pageSize),a.client instanceof t)d=await Ljr(e,a.client,s,...u);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield d;let f=l;l=Fjr(d,n),c=!!(l&&(!a.stopOnSameToken||l!==f))}return void 0}}var Ljr,Fjr,Xwt=b(()=>{Ljr=async(t,e,r,...n)=>await e.send(new t(r),...n);Fjr=(t,e)=>{let r=t,n=e.split(".");for(let o of n){if(!r||typeof r!="object")return;r=r[o]}return r}});var eM=b(()=>{C_t();$wt();Gwt();Jwt();Zwt();Ywt();Xwt()});var Qwt=b(()=>{});var e0t=b(()=>{Qwt()});var t0t=b(()=>{Ou()});var r0t=b(()=>{});var n0t=b(()=>{});function kjr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var goe,o0t=b(()=>{goe=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=kjr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var i0t=b(()=>{});var a0t=b(()=>{});var s0t=b(()=>{});var u0t=b(()=>{e0t();t0t();r0t();n0t();o0t();i0t();a0t();s0t()});function $jr(t){return e=>async r=>{let n=r.request;if(goe.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(l0t)===-1)try{let a=t(o);n.headers={...n.headers,[l0t]:String(a)}}catch{}}return e({...r,request:n})}}var l0t,Bjr,yoe,YTe=b(()=>{u0t();l0t="content-length";Bjr={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},yoe=t=>({applyToStack:e=>{e.add($jr(t.bodyLengthChecker),Bjr)}})});var c0t=b(()=>{});var d0t=b(()=>{c0t()});var f0t=b(()=>{});var p0t=b(()=>{f0t()});var m0t=b(()=>{Ou()});var h0t=b(()=>{});var g0t=b(()=>{});function zjr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var tM,y0t=b(()=>{tM=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=zjr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var boe,b0t=b(()=>{boe=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var _0t=b(()=>{});var v0t=b(()=>{});var yW=b(()=>{p0t();m0t();h0t();g0t();y0t();b0t();_0t();v0t()});var XTe,w0t=b(()=>{yW();XTe=t=>boe.isInstance(t)?t.headers?.date??t.headers?.Date:void 0});var _oe,QTe=b(()=>{_oe=t=>new Date(Date.now()+t)});var x0t,S0t=b(()=>{QTe();x0t=(t,e)=>Math.abs(_oe(e).getTime()-t)>=3e5});var eAe,C0t=b(()=>{S0t();eAe=(t,e)=>{let r=Date.parse(t);return x0t(r,e)?r-Date.now():e}});var O0t=b(()=>{w0t();QTe();C0t()});var bW,E0t,ND,P0t=b(()=>{yW();O0t();bW=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},E0t=async t=>{let e=bW("context",t.context),r=bW("config",t.config),n=e.endpointV2?.properties?.authSchemes?.[0],i=await bW("signer",r.signer)(n),a=t?.signingRegion,s=t?.signingRegionSet,u=t?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},ND=class{async sign(e,r,n){if(!tM.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await E0t(n),{config:i,signer:a}=o,{signingRegion:s,signingName:u}=o,l=n.context;if(l?.authSchemes?.length??!1){let[d,f]=l.authSchemes;d?.name==="sigv4a"&&f?.name==="sigv4"&&(s=f?.signingRegion??s,u=f?.signingName??u)}return await a.sign(e,{signingDate:_oe(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(e){return r=>{let n=r.ServerTime??XTe(r.$response);if(n){let o=bW("config",e.config),i=o.systemClockOffset;o.systemClockOffset=eAe(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){let n=XTe(e);if(n){let o=bW("config",r.config);o.systemClockOffset=eAe(n,o.systemClockOffset)}}}});var T0t=b(()=>{eM();eP()});function I0t(t){if(t.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2){let n=t.slice(r,r+2).toLowerCase();if(n in tAe)e[r/2]=tAe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function r_(t){let e="";for(let r=0;r<t.byteLength;r++)e+=A0t[t[r]];return e}var A0t,tAe,_W=b(()=>{A0t={},tAe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),A0t[t]=e,tAe[e]=t}});var vW,rAe=b(()=>{vW=t=>new TextEncoder().encode(t)});var rM,M0t=b(()=>{rAe();rM=t=>typeof t=="string"?vW(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});var R0t=b(()=>{});var wW=b(()=>{rAe();M0t();R0t()});var N0t,j0t,nAe,D0t,L0t,oAe,iAe,aAe,sAe,Ujr,F0t,k0t,xW,$0t,B0t,z0t,U0t,voe,q0t,H0t,V0t,uAe,W0t,jD=b(()=>{N0t="X-Amz-Algorithm",j0t="X-Amz-Credential",nAe="X-Amz-Date",D0t="X-Amz-SignedHeaders",L0t="X-Amz-Expires",oAe="X-Amz-Signature",iAe="X-Amz-Security-Token",aAe="authorization",sAe=nAe.toLowerCase(),Ujr="date",F0t=[aAe,sAe,Ujr],k0t=oAe.toLowerCase(),xW="x-amz-content-sha256",$0t=iAe.toLowerCase(),B0t={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},z0t=/^proxy-/,U0t=/^sec-/,voe="AWS4-HMAC-SHA256",q0t="AWS4-HMAC-SHA256-PAYLOAD",H0t="UNSIGNED-PAYLOAD",V0t=50,uAe="aws4_request",W0t=60*60*24*7});var woe,lAe,xoe,G0t,K0t,cAe=b(()=>{_W();wW();jD();woe={},lAe=[],xoe=(t,e,r)=>`${t}/${e}/${r}/${uAe}`,G0t=async(t,e,r,n,o)=>{let i=await K0t(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${r_(i)}:${e.sessionToken}`;if(a in woe)return woe[a];for(lAe.push(a);lAe.length>V0t;)delete woe[lAe.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,uAe])s=await K0t(t,s,u);return woe[a]=s},K0t=(t,e,r)=>{let n=new t(e);return n.update(rM(r)),n.digest()}});var Soe,dAe=b(()=>{jD();Soe=({headers:t},e,r)=>{let n={};for(let o of Object.keys(t).sort()){if(t[o]==null)continue;let i=o.toLowerCase();(i in B0t||e?.has(i)||z0t.test(i)||U0t.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n}});var fAe,pAe=b(()=>{ooe();jD();fAe=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===k0t)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${yy(n)}=${yy(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).reduce((i,a)=>i.concat([`${yy(n)}=${yy(a)}`]),[]).sort().join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")}});var J0t,Z0t=b(()=>{J0t=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var SW,mAe=b(()=>{Z0t();_W();wW();jD();SW=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===xW)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||J0t(e)){let n=new r;return n.update(rM(e)),r_(await n.digest())}return H0t}});function X0t(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var Coe,Y0t,qjr,hAe,Q0t=b(()=>{_W();wW();Coe=class{format(e){let r=[];for(let i of Object.keys(e)){let a=vW(i);r.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(e[i]))}let n=new Uint8Array(r.reduce((i,a)=>i+a.byteLength,0)),o=0;for(let i of r)n.set(i,o),o+=i.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":let o=new Uint8Array(9);return o[0]=5,o.set(e.value.bytes,1),o;case"binary":let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case"string":let s=vW(e.value),u=new DataView(new ArrayBuffer(3+s.byteLength));u.setUint8(0,7),u.setUint16(1,s.byteLength,!1);let l=new Uint8Array(u.buffer);return l.set(s,3),l;case"timestamp":let c=new Uint8Array(9);return c[0]=8,c.set(hAe.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!qjr.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(I0t(e.value.replace(/\-/g,"")),1),d}}};(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(Y0t||(Y0t={}));qjr=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,hAe=class t{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let n=7,o=Math.abs(Math.round(e));n>-1&&o>0;n--,o/=256)r[n]=o;return e<0&&X0t(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&X0t(e),parseInt(r_(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var ext,txt=b(()=>{ext=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1}});var gAe,yAe=b(()=>{yW();gAe=(t,e={})=>{let{headers:r,query:n={}}=tM.clone(t);for(let o of Object.keys(r)){let i=o.toLowerCase();i.slice(0,6)==="x-amz-"&&!e.unhoistableHeaders?.has(i)&&(n[o]=r[o],delete r[o])}return{...t,headers:r,query:n}}});var Ooe,bAe=b(()=>{yW();jD();Ooe=t=>{t=tM.clone(t);for(let e of Object.keys(t.headers))F0t.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t}});var rxt,Hjr,nxt=b(()=>{rxt=t=>Hjr(t).toISOString().replace(/\.\d{3}Z$/,"Z"),Hjr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t});var CW,Eoe,oxt,ixt=b(()=>{_W();e_();ooe();wW();jD();cAe();dAe();pAe();mAe();Q0t();txt();yAe();bAe();nxt();CW=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new Coe,this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=qf(n),this.credentialProvider=qf(r)}async presign(e,r={}){let{signingDate:n=new Date,expiresIn:o=3600,unsignableHeaders:i,unhoistableHeaders:a,signableHeaders:s,signingRegion:u,signingService:l}=r,c=await this.credentialProvider();this.validateResolvedCredentials(c);let d=u??await this.regionProvider(),{longDate:f,shortDate:p}=Eoe(n);if(o>W0t)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let m=xoe(p,d,l??this.service),h=gAe(Ooe(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[iAe]=c.sessionToken),h.query[N0t]=voe,h.query[j0t]=`${c.accessKeyId}/${m}`,h.query[nAe]=f,h.query[L0t]=o.toString(10);let y=Soe(h,i,s);return h.query[D0t]=oxt(y),h.query[oAe]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,y,await SW(e,this.sha256))),h}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=Eoe(n),c=xoe(u,s,a??this.service),d=await SW({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=r_(await f.digest()),m=[q0t,l,c,o,p,d].join(`
`);return this.signString(m,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=Eoe(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update(rM(e)),r_(await u.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:n,unsignableHeaders:o,signingRegion:i,signingService:a}={}){let s=await this.credentialProvider();this.validateResolvedCredentials(s);let u=i??await this.regionProvider(),l=Ooe(e),{longDate:c,shortDate:d}=Eoe(r),f=xoe(d,u,a??this.service);l.headers[sAe]=c,s.sessionToken&&(l.headers[$0t]=s.sessionToken);let p=await SW(l,this.sha256);!ext(xW,l.headers)&&this.applyChecksum&&(l.headers[xW]=p);let m=Soe(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[aAe]=`${voe} Credential=${s.accessKeyId}/${f}, SignedHeaders=${oxt(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${fAe(e)}
${o.map(i=>`${i}:${r[i]}`).join(`
`)}
${o.join(";")}
${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update(rM(n));let i=await o.digest();return`${voe}
${e}
${r}
${r_(i)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let r=[];for(let i of e.split("/"))i?.length!==0&&i!=="."&&(i===".."?r.pop():r.push(i));let n=`${e?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&e?.endsWith("/")?"/":""}`;return yy(n).replace(/%2F/g,"/")}return e}async getSignature(e,r,n,o){let i=await this.createStringToSign(e,r,o),a=new this.sha256(await n);return a.update(rM(i)),r_(await a.digest())}getSigningKey(e,r,n,o){return G0t(this.sha256,e,n,r,o||this.service)}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}},Eoe=t=>{let e=rxt(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},oxt=t=>Object.keys(t).sort().join(";")});var axt=b(()=>{ixt();dAe();pAe();mAe();yAe();bAe();cAe()});var Poe,sxt=b(()=>{eM();axt();Poe=t=>{let e;t.credentials&&(e=Wwt(t.credentials,Vwt,JTe)),e||(t.credentialDefaultProvider?e=_U(t.credentialDefaultProvider(Object.assign({},t,{parentClientConfig:t}))):e=async()=>{throw new Error("`credentials` is missing")});let{signingEscapePath:r=!0,systemClockOffset:n=t.systemClockOffset||0,sha256:o}=t,i;return t.signer?i=_U(t.signer):t.regionInfoProvider?i=()=>_U(t.region)().then(async a=>[await t.regionInfoProvider(a,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},a]).then(([a,s])=>{let{signingRegion:u,signingService:l}=a;t.signingRegion=t.signingRegion||u||s,t.signingName=t.signingName||l||t.serviceId;let c={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:o,uriEscapePath:r},d=t.signerConstructor||CW;return new d(c)}):i=async a=>{a=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await _U(t.region)(),properties:{}},a);let s=a.signingRegion,u=a.signingName;t.signingRegion=t.signingRegion||s,t.signingName=t.signingName||u||t.serviceId;let l={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:o,uriEscapePath:r},c=t.signerConstructor||CW;return new c(l)},{...t,systemClockOffset:n,signingEscapePath:r,credentials:e,signer:i}}});var uxt=b(()=>{P0t();T0t();sxt()});var lxt=b(()=>{uxt()});var cxt=b(()=>{});var dxt=b(()=>{mr()});var Toe,_Ae=b(()=>{mr();Toe=(t,e)=>QI(t,e).then(r=>e.utf8Encoder(r))});var su,fxt,pxt,mxt=b(()=>{_Ae();su=(t,e)=>Toe(t,e).then(r=>{if(r.length)try{return JSON.parse(r)}catch(n){throw n?.name==="SyntaxError"&&Object.defineProperty(n,"$responseBodyText",{value:r}),n}return{}}),fxt=async(t,e)=>{let r=await su(t,e);return r.message=r.message??r.Message,r},pxt=(t,e)=>{let r=(i,a)=>Object.keys(i).find(s=>s.toLowerCase()===a.toLowerCase()),n=i=>{let a=i;return typeof a=="number"&&(a=a.toString()),a.indexOf(",")>=0&&(a=a.split(",")[0]),a.indexOf(":")>=0&&(a=a.split(":")[0]),a.indexOf("#")>=0&&(a=a.split("#")[1]),a},o=r(t.headers,"x-amzn-errortype");if(o!==void 0)return n(t.headers[o]);if(e.code!==void 0)return n(e.code);if(e.__type!==void 0)return n(e.__type)}});var Aoe=x(iP=>{"use strict";var hxt=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",Vjr=hxt+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",gxt="["+hxt+"]["+Vjr+"]*",Wjr=new RegExp("^"+gxt+"$"),Kjr=function(t,e){let r=[],n=e.exec(t);for(;n;){let o=[];o.startIndex=e.lastIndex-n[0].length;let i=n.length;for(let a=0;a<i;a++)o.push(n[a]);r.push(o),n=e.exec(t)}return r},Gjr=function(t){let e=Wjr.exec(t);return!(e===null||typeof e>"u")};iP.isExist=function(t){return typeof t<"u"};iP.isEmptyObject=function(t){return Object.keys(t).length===0};iP.merge=function(t,e,r){if(e){let n=Object.keys(e),o=n.length;for(let i=0;i<o;i++)r==="strict"?t[n[i]]=[e[n[i]]]:t[n[i]]=e[n[i]]}};iP.getValue=function(t){return iP.isExist(t)?t:""};iP.isName=Gjr;iP.getAllMatches=Kjr;iP.nameRegexp=gxt});var wAe=x(wxt=>{"use strict";var vAe=Aoe(),Jjr={allowBooleanAttributes:!1,unpairedTags:[]};wxt.validate=function(t,e){e=Object.assign({},Jjr,e);let r=[],n=!1,o=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let i=0;i<t.length;i++)if(t[i]==="<"&&t[i+1]==="?"){if(i+=2,i=bxt(t,i),i.err)return i}else if(t[i]==="<"){let a=i;if(i++,t[i]==="!"){i=_xt(t,i);continue}else{let s=!1;t[i]==="/"&&(s=!0,i++);let u="";for(;i<t.length&&t[i]!==">"&&t[i]!==" "&&t[i]!==" "&&t[i]!==`
`&&t[i]!=="\r";i++)u+=t[i];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),i--),!nDr(u)){let d;return u.trim().length===0?d="Invalid space after '<'.":d="Tag '"+u+"' is an invalid name.",uu("InvalidTag",d,Bp(t,i))}let l=Xjr(t,i);if(l===!1)return uu("InvalidAttr","Attributes for '"+u+"' have open quote.",Bp(t,i));let c=l.value;if(i=l.index,c[c.length-1]==="/"){let d=i-c.length;c=c.substring(0,c.length-1);let f=vxt(c,e);if(f===!0)n=!0;else return uu(f.err.code,f.err.msg,Bp(t,d+f.err.line))}else if(s)if(l.tagClosed){if(c.trim().length>0)return uu("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",Bp(t,a));if(r.length===0)return uu("InvalidTag","Closing tag '"+u+"' has not been opened.",Bp(t,a));{let d=r.pop();if(u!==d.tagName){let f=Bp(t,d.tagStartPos);return uu("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+u+"'.",Bp(t,a))}r.length==0&&(o=!0)}}else return uu("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",Bp(t,i));else{let d=vxt(c,e);if(d!==!0)return uu(d.err.code,d.err.msg,Bp(t,i-c.length+d.err.line));if(o===!0)return uu("InvalidXml","Multiple possible root nodes found.",Bp(t,i));e.unpairedTags.indexOf(u)!==-1||r.push({tagName:u,tagStartPos:a}),n=!0}for(i++;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="!"){i++,i=_xt(t,i);continue}else if(t[i+1]==="?"){if(i=bxt(t,++i),i.err)return i}else break;else if(t[i]==="&"){let d=tDr(t,i);if(d==-1)return uu("InvalidChar","char '&' is not expected.",Bp(t,i));i=d}else if(o===!0&&!yxt(t[i]))return uu("InvalidXml","Extra text at the end",Bp(t,i));t[i]==="<"&&i--}}else{if(yxt(t[i]))continue;return uu("InvalidChar","char '"+t[i]+"' is not expected.",Bp(t,i))}if(n){if(r.length==1)return uu("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Bp(t,r[0].tagStartPos));if(r.length>0)return uu("InvalidXml","Invalid '"+JSON.stringify(r.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return uu("InvalidXml","Start tag expected.",1);return!0};function yxt(t){return t===" "||t===" "||t===`
`||t==="\r"}function bxt(t,e){let r=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let n=t.substr(r,e-r);if(e>5&&n==="xml")return uu("InvalidXml","XML declaration allowed only at the start of the document.",Bp(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function _xt(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let r=1;for(e+=8;e<t.length;e++)if(t[e]==="<")r++;else if(t[e]===">"&&(r--,r===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var Zjr='"',Yjr="'";function Xjr(t,e){let r="",n="",o=!1;for(;e<t.length;e++){if(t[e]===Zjr||t[e]===Yjr)n===""?n=t[e]:n!==t[e]||(n="");else if(t[e]===">"&&n===""){o=!0;break}r+=t[e]}return n!==""?!1:{value:r,index:e,tagClosed:o}}var Qjr=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function vxt(t,e){let r=vAe.getAllMatches(t,Qjr),n={};for(let o=0;o<r.length;o++){if(r[o][1].length===0)return uu("InvalidAttr","Attribute '"+r[o][2]+"' has no space in starting.",OW(r[o]));if(r[o][3]!==void 0&&r[o][4]===void 0)return uu("InvalidAttr","Attribute '"+r[o][2]+"' is without value.",OW(r[o]));if(r[o][3]===void 0&&!e.allowBooleanAttributes)return uu("InvalidAttr","boolean attribute '"+r[o][2]+"' is not allowed.",OW(r[o]));let i=r[o][2];if(!rDr(i))return uu("InvalidAttr","Attribute '"+i+"' is an invalid name.",OW(r[o]));if(!n.hasOwnProperty(i))n[i]=1;else return uu("InvalidAttr","Attribute '"+i+"' is repeated.",OW(r[o]))}return!0}function eDr(t,e){let r=/\d/;for(t[e]==="x"&&(e++,r=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(r))break}return-1}function tDr(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,eDr(t,e);let r=0;for(;e<t.length;e++,r++)if(!(t[e].match(/\w/)&&r<20)){if(t[e]===";")break;return-1}return e}function uu(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function rDr(t){return vAe.isName(t)}function nDr(t){return vAe.isName(t)}function Bp(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function OW(t){return t.startIndex+t[1].length}});var Sxt=x(xAe=>{var xxt={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t}},oDr=function(t){return Object.assign({},xxt,t)};xAe.buildOptions=oDr;xAe.defaultOptions=xxt});var Oxt=x((BRo,Cxt)=>{"use strict";var SAe=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,r){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:r})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};Cxt.exports=SAe});var Pxt=x((zRo,Ext)=>{var iDr=Aoe();function aDr(t,e){let r={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let n=1,o=!1,i=!1,a="";for(;e<t.length;e++)if(t[e]==="<"&&!i){if(o&&lDr(t,e))e+=7,[entityName,val,e]=sDr(t,e+1),val.indexOf("&")===-1&&(r[pDr(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(o&&cDr(t,e))e+=8;else if(o&&dDr(t,e))e+=8;else if(o&&fDr(t,e))e+=9;else if(uDr)i=!0;else throw new Error("Invalid DOCTYPE");n++,a=""}else if(t[e]===">"){if(i?t[e-1]==="-"&&t[e-2]==="-"&&(i=!1,n--):n--,n===0)break}else t[e]==="["?o=!0:a+=t[e];if(n!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:e}}function sDr(t,e){let r="";for(;e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)r+=t[e];if(r=r.trim(),r.indexOf(" ")!==-1)throw new Error("External entites are not supported");let n=t[e++],o="";for(;e<t.length&&t[e]!==n;e++)o+=t[e];return[r,o,e]}function uDr(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function lDr(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function cDr(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function dDr(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function fDr(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function pDr(t){if(iDr.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}Ext.exports=aDr});var Axt=x((URo,Txt)=>{var mDr=/^[-+]?0x[a-fA-F0-9]+$/,hDr=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var gDr={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function yDr(t,e={}){if(e=Object.assign({},gDr,e),!t||typeof t!="string")return t;let r=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(r))return t;if(e.hex&&mDr.test(r))return Number.parseInt(r,16);{let n=hDr.exec(r);if(n){let o=n[1],i=n[2],a=bDr(n[3]),s=n[4]||n[6];if(!e.leadingZeros&&i.length>0&&o&&r[2]!==".")return t;if(!e.leadingZeros&&i.length>0&&!o&&r[1]!==".")return t;{let u=Number(r),l=""+u;return l.search(/[eE]/)!==-1||s?e.eNotation?u:t:r.indexOf(".")!==-1?l==="0"&&a===""||l===a||o&&l==="-"+a?u:t:i?a===l||o+a===l?u:t:r===l||r===o+l?u:t}}else return t}}function bDr(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}Txt.exports=yDr});var Rxt=x((qRo,Mxt)=>{"use strict";var Ixt=Aoe(),EW=Oxt(),_Dr=Pxt(),vDr=Axt(),CAe=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,16))}},this.addExternalEntities=wDr,this.parseXml=EDr,this.parseTextData=xDr,this.resolveNameSpace=SDr,this.buildAttributesMap=ODr,this.isItStopNode=IDr,this.replaceEntitiesValue=TDr,this.readStopNodeData=RDr,this.saveTextToParentTag=ADr,this.addChild=PDr}};function wDr(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];this.lastEntities[n]={regex:new RegExp("&"+n+";","g"),val:t[n]}}}function xDr(t,e,r,n,o,i,a){if(t!==void 0&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t));let s=this.options.tagValueProcessor(e,t,r,o,i);return s==null?t:typeof s!=typeof t||s!==t?s:this.options.trimValues?EAe(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?EAe(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function SDr(t){if(this.options.removeNSPrefix){let e=t.split(":"),r=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=r+e[1])}return t}var CDr=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function ODr(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){let n=Ixt.getAllMatches(t,CDr),o=n.length,i={};for(let a=0;a<o;a++){let s=this.resolveNameSpace(n[a][1]),u=n[a][4],l=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),u!==void 0){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u);let c=this.options.attributeValueProcessor(s,u,e);c==null?i[l]=u:typeof c!=typeof u||c!==u?i[l]=c:i[l]=EAe(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[l]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){let a={};return a[this.options.attributesGroupName]=i,a}return i}}var EDr=function(t){t=t.replace(/\r\n?/g,`
`);let e=new EW("!xml"),r=e,n="",o="";for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){let s=DD(t,">",i,"Closing Tag is not closed."),u=t.substring(i+2,s).trim();if(this.options.removeNSPrefix){let d=u.indexOf(":");d!==-1&&(u=u.substr(d+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&(n=this.saveTextToParentTag(n,r,o));let l=o.substring(o.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let c=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(c=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=o.lastIndexOf("."),o=o.substring(0,c),r=this.tagsNodeStack.pop(),n="",i=s}else if(t[i+1]==="?"){let s=OAe(t,i,!1,"?>");if(!s)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,r,o),!(this.options.ignoreDeclaration&&s.tagName==="?xml"||this.options.ignorePiTags)){let u=new EW(s.tagName);u.add(this.options.textNodeName,""),s.tagName!==s.tagExp&&s.attrExpPresent&&(u[":@"]=this.buildAttributesMap(s.tagExp,o,s.tagName)),this.addChild(r,u,o)}i=s.closeIndex+1}else if(t.substr(i+1,3)==="!--"){let s=DD(t,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let u=t.substring(i+4,s-2);n=this.saveTextToParentTag(n,r,o),r.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}i=s}else if(t.substr(i+1,2)==="!D"){let s=_Dr(t,i);this.docTypeEntities=s.entities,i=s.i}else if(t.substr(i+1,2)==="!["){let s=DD(t,"]]>",i,"CDATA is not closed.")-2,u=t.substring(i+9,s);n=this.saveTextToParentTag(n,r,o);let l=this.parseTextData(u,r.tagname,o,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):r.add(this.options.textNodeName,l),i=s+2}else{let s=OAe(t,i,this.options.removeNSPrefix),u=s.tagName,l=s.rawTagName,c=s.tagExp,d=s.attrExpPresent,f=s.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,o,!1));let p=r;if(p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(r=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),u!==e.tagname&&(o+=o?"."+u:u),this.isItStopNode(this.options.stopNodes,o,u)){let m="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),i=s.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=s.closeIndex;else{let y=this.readStopNodeData(t,l,f+1);if(!y)throw new Error(`Unexpected end of ${l}`);i=y.i,m=y.tagContent}let h=new EW(u);u!==c&&d&&(h[":@"]=this.buildAttributesMap(c,o,u)),m&&(m=this.parseTextData(m,u,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),h.add(this.options.textNodeName,m),this.addChild(r,h,o)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));let m=new EW(u);u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,m,o),o=o.substr(0,o.lastIndexOf("."))}else{let m=new EW(u);this.tagsNodeStack.push(r),u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,m,o),r=m}n="",i=f}}else n+=t[i];return e.child};function PDr(t,e,r){let n=this.options.updateTag(e.tagname,r,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),t.addChild(e))}var TDr=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){let r=this.docTypeEntities[e];t=t.replace(r.regx,r.val)}for(let e in this.lastEntities){let r=this.lastEntities[e];t=t.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){let r=this.htmlEntities[e];t=t.replace(r.regex,r.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function ADr(t,e,r,n){return t&&(n===void 0&&(n=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,r,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function IDr(t,e,r){let n="*."+r;for(let o in t){let i=t[o];if(n===i||e===i)return!0}return!1}function MDr(t,e,r=">"){let n,o="";for(let i=e;i<t.length;i++){let a=t[i];if(n)a===n&&(n="");else if(a==='"'||a==="'")n=a;else if(a===r[0])if(r[1]){if(t[i+1]===r[1])return{data:o,index:i}}else return{data:o,index:i};else a===" "&&(a=" ");o+=a}}function DD(t,e,r,n){let o=t.indexOf(e,r);if(o===-1)throw new Error(n);return o+e.length-1}function OAe(t,e,r,n=">"){let o=MDr(t,e+1,n);if(!o)return;let i=o.data,a=o.index,s=i.search(/\s/),u=i,l=!0;s!==-1&&(u=i.substring(0,s),i=i.substring(s+1).trimStart());let c=u;if(r){let d=u.indexOf(":");d!==-1&&(u=u.substr(d+1),l=u!==o.data.substr(d+1))}return{tagName:u,tagExp:i,closeIndex:a,attrExpPresent:l,rawTagName:c}}function RDr(t,e,r){let n=r,o=1;for(;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){let i=DD(t,">",r,`${e} is not closed`);if(t.substring(r+2,i).trim()===e&&(o--,o===0))return{tagContent:t.substring(n,r),i};r=i}else if(t[r+1]==="?")r=DD(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=DD(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=DD(t,"]]>",r,"StopNode is not closed.")-2;else{let i=OAe(t,r,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,r=i.closeIndex)}}function EAe(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:vDr(t,r)}else return Ixt.isExist(t)?t:""}Mxt.exports=CAe});var Dxt=x(jxt=>{"use strict";function NDr(t,e){return Nxt(t,e)}function Nxt(t,e,r){let n,o={};for(let i=0;i<t.length;i++){let a=t[i],s=jDr(a),u="";if(r===void 0?u=s:u=r+"."+s,s===e.textNodeName)n===void 0?n=a[s]:n+=""+a[s];else{if(s===void 0)continue;if(a[s]){let l=Nxt(a[s],e,u),c=LDr(l,e);a[":@"]?DDr(l,a[":@"],u,e):Object.keys(l).length===1&&l[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?l=l[e.textNodeName]:Object.keys(l).length===0&&(e.alwaysCreateTextNode?l[e.textNodeName]="":l=""),o[s]!==void 0&&o.hasOwnProperty(s)?(Array.isArray(o[s])||(o[s]=[o[s]]),o[s].push(l)):e.isArray(s,u,c)?o[s]=[l]:o[s]=l}}}return typeof n=="string"?n.length>0&&(o[e.textNodeName]=n):n!==void 0&&(o[e.textNodeName]=n),o}function jDr(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function DDr(t,e,r,n){if(e){let o=Object.keys(e),i=o.length;for(let a=0;a<i;a++){let s=o[a];n.isArray(s,r+"."+s,!0,!0)?t[s]=[e[s]]:t[s]=e[s]}}}function LDr(t,e){let{textNodeName:r}=e,n=Object.keys(t).length;return!!(n===0||n===1&&(t[r]||typeof t[r]=="boolean"||t[r]===0))}jxt.prettify=NDr});var Fxt=x((VRo,Lxt)=>{var{buildOptions:FDr}=Sxt(),kDr=Rxt(),{prettify:$Dr}=Dxt(),BDr=wAe(),PAe=class{constructor(e){this.externalEntities={},this.options=FDr(e)}parse(e,r){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let i=BDr.validate(e,r);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new kDr(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(e);return this.options.preserveOrder||o===void 0?o:$Dr(o,this.options)}addEntity(e,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};Lxt.exports=PAe});var Uxt=x((WRo,zxt)=>{var zDr=`
`;function UDr(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=zDr),$xt(t,e,"",r)}function $xt(t,e,r,n){let o="",i=!1;for(let a=0;a<t.length;a++){let s=t[a],u=qDr(s);if(u===void 0)continue;let l="";if(r.length===0?l=u:l=`${r}.${u}`,u===e.textNodeName){let m=s[u];HDr(l,e)||(m=e.tagValueProcessor(u,m),m=Bxt(m,e)),i&&(o+=n),o+=m,i=!1;continue}else if(u===e.cdataPropName){i&&(o+=n),o+=`<![CDATA[${s[u][0][e.textNodeName]}]]>`,i=!1;continue}else if(u===e.commentPropName){o+=n+`<!--${s[u][0][e.textNodeName]}-->`,i=!0;continue}else if(u[0]==="?"){let m=kxt(s[":@"],e),h=u==="?xml"?"":n,y=s[u][0][e.textNodeName];y=y.length!==0?" "+y:"",o+=h+`<${u}${y}${m}?>`,i=!0;continue}let c=n;c!==""&&(c+=e.indentBy);let d=kxt(s[":@"],e),f=n+`<${u}${d}`,p=$xt(s[u],e,l,c);e.unpairedTags.indexOf(u)!==-1?e.suppressUnpairedNode?o+=f+">":o+=f+"/>":(!p||p.length===0)&&e.suppressEmptyNode?o+=f+"/>":p&&p.endsWith(">")?o+=f+`>${p}${n}</${u}>`:(o+=f+">",p&&n!==""&&(p.includes("/>")||p.includes("</"))?o+=n+e.indentBy+p+n:o+=p,o+=`</${u}>`),i=!0}return o}function qDr(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(t.hasOwnProperty(n)&&n!==":@")return n}}function kxt(t,e){let r="";if(t&&!e.ignoreAttributes)for(let n in t){if(!t.hasOwnProperty(n))continue;let o=e.attributeValueProcessor(n,t[n]);o=Bxt(o,e),o===!0&&e.suppressBooleanAttributes?r+=` ${n.substr(e.attributeNamePrefix.length)}`:r+=` ${n.substr(e.attributeNamePrefix.length)}="${o}"`}return r}function HDr(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let r=t.substr(t.lastIndexOf(".")+1);for(let n in e.stopNodes)if(e.stopNodes[n]===t||e.stopNodes[n]==="*."+r)return!0;return!1}function Bxt(t,e){if(t&&t.length>0&&e.processEntities)for(let r=0;r<e.entities.length;r++){let n=e.entities[r];t=t.replace(n.regex,n.val)}return t}zxt.exports=UDr});var Hxt=x((KRo,qxt)=>{"use strict";var VDr=Uxt(),WDr={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function nM(t){this.options=Object.assign({},WDr,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=JDr),this.processTextOrObjNode=KDr,this.options.format?(this.indentate=GDr,this.tagEndChar=`>
`,this.newLine=`
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}nM.prototype.build=function(t){return this.options.preserveOrder?VDr(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};nM.prototype.j2x=function(t,e){let r="",n="";for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o))if(typeof t[o]>"u")this.isAttribute(o)&&(n+="");else if(t[o]===null)this.isAttribute(o)?n+="":o[0]==="?"?n+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(t[o]instanceof Date)n+=this.buildTextValNode(t[o],o,"",e);else if(typeof t[o]!="object"){let i=this.isAttribute(o);if(i)r+=this.buildAttrPairStr(i,""+t[o]);else if(o===this.options.textNodeName){let a=this.options.tagValueProcessor(o,""+t[o]);n+=this.replaceEntitiesValue(a)}else n+=this.buildTextValNode(t[o],o,"",e)}else if(Array.isArray(t[o])){let i=t[o].length,a="",s="";for(let u=0;u<i;u++){let l=t[o][u];if(!(typeof l>"u"))if(l===null)o[0]==="?"?n+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(typeof l=="object")if(this.options.oneListGroup){let c=this.j2x(l,e+1);a+=c.val,this.options.attributesGroupName&&l.hasOwnProperty(this.options.attributesGroupName)&&(s+=c.attrStr)}else a+=this.processTextOrObjNode(l,o,e);else if(this.options.oneListGroup){let c=this.options.tagValueProcessor(o,l);c=this.replaceEntitiesValue(c),a+=c}else a+=this.buildTextValNode(l,o,"",e)}this.options.oneListGroup&&(a=this.buildObjectNode(a,o,s,e)),n+=a}else if(this.options.attributesGroupName&&o===this.options.attributesGroupName){let i=Object.keys(t[o]),a=i.length;for(let s=0;s<a;s++)r+=this.buildAttrPairStr(i[s],""+t[o][i[s]])}else n+=this.processTextOrObjNode(t[o],o,e);return{attrStr:r,val:n}};nM.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function KDr(t,e,r){let n=this.j2x(t,r+1);return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,r):this.buildObjectNode(n.val,e,n.attrStr,r)}nM.prototype.buildObjectNode=function(t,e,r,n){if(t==="")return e[0]==="?"?this.indentate(n)+"<"+e+r+"?"+this.tagEndChar:this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar;{let o="</"+e+this.tagEndChar,i="";return e[0]==="?"&&(i="?",o=""),(r||r==="")&&t.indexOf("<")===-1?this.indentate(n)+"<"+e+r+i+">"+t+o:this.options.commentPropName!==!1&&e===this.options.commentPropName&&i.length===0?this.indentate(n)+`<!--${t}-->`+this.newLine:this.indentate(n)+"<"+e+r+i+this.tagEndChar+t+this.indentate(n)+o}};nM.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};nM.prototype.buildTextValNode=function(t,e,r,n){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(n)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(e,t);return o=this.replaceEntitiesValue(o),o===""?this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+r+">"+o+"</"+e+this.tagEndChar}};nM.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){let r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t};function GDr(t){return this.options.indentBy.repeat(t)}function JDr(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}qxt.exports=nM});var Wxt=x((GRo,Vxt)=>{"use strict";var ZDr=wAe(),YDr=Fxt(),XDr=Hxt();Vxt.exports={XMLParser:YDr,XMLValidator:ZDr,XMLBuilder:XDr}});var Kxt,pw,Gxt,Jxt=b(()=>{mr();Kxt=j(Wxt());_Ae();pw=(t,e)=>Toe(t,e).then(r=>{if(r.length){let n=new Kxt.XMLParser({attributeNamePrefix:"",htmlEntities:!0,ignoreAttributes:!1,ignoreDeclaration:!0,parseTagValue:!1,trimValues:!1,tagValueProcessor:(u,l)=>l.trim()===""&&l.includes(`
`)?"":void 0});n.addEntity("#xD","\r"),n.addEntity("#10",`
`);let o;try{o=n.parse(r,!0)}catch(u){throw u&&typeof u=="object"&&Object.defineProperty(u,"$responseBodyText",{value:r}),u}let i="#text",a=Object.keys(o)[0],s=o[a];return s[i]&&(s[a]=s[i],delete s[i]),WTe(s)}return{}}),Gxt=async(t,e)=>{let r=await pw(t,e);return r.Error&&(r.Error.message=r.Error.message??r.Error.Message),r}});var Zxt=b(()=>{cxt();dxt();mxt();Jxt()});var LD=b(()=>{d0t();lxt();Zxt()});function QDr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function Ioe(t){return{schemeId:"smithy.api#noAuth"}}var Yxt,Xxt,Qxt,TAe=b(()=>{LD();e_();Yxt=async(t,e,r)=>({operation:cw(e).operation,region:await qf(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});Xxt=t=>{let e=[];switch(t.operation){case"GetCredentialsForIdentity":{e.push(Ioe(t));break}case"GetId":{e.push(Ioe(t));break}case"GetOpenIdToken":{e.push(Ioe(t));break}case"UnlinkIdentity":{e.push(Ioe(t));break}default:e.push(QDr(t))}return e},Qxt=t=>({...Poe(t)})});var eSt,Ur,Oa=b(()=>{eSt=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),Ur={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var rSt,tSt=b(()=>{rSt={name:"@aws-sdk/client-cognito-identity",description:"AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native",version:"3.645.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-cognito-identity","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo cognito-identity","test:e2e":"ts-mocha test/**/*.ispec.ts && karma start karma.conf.js"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.645.0","@aws-sdk/client-sts":"3.645.0","@aws-sdk/core":"3.635.0","@aws-sdk/credential-provider-node":"3.645.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.645.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.645.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.4.0","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.15","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.2.0","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.15","@smithy/util-defaults-mode-node":"^3.0.15","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2"},devDependencies:{"@aws-sdk/client-iam":"3.645.0","@tsconfig/node16":"16.1.3","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-cognito-identity"}}});var AAe,IAe,nSt,oSt=b(()=>{AAe={name:"SHA-256"},IAe={name:"HMAC",hash:AAe},nSt=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85])});function vU(){return typeof window<"u"?window:typeof self<"u"?self:tLr}var tLr,MAe=b(()=>{tLr={}});var wU,RAe,NAe=b(()=>{wU=j(mne());oSt();MAe();RAe=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!(0,wU.isEmptyData)(e)){var r=(0,wU.convertToBuffer)(e),n=new Uint8Array(this.toHash.byteLength+r.byteLength);n.set(this.toHash,0),n.set(r,this.toHash.byteLength),this.toHash=n}},t.prototype.digest=function(){var e=this;return this.key?this.key.then(function(r){return vU().crypto.subtle.sign(IAe,r,e.toHash).then(function(n){return new Uint8Array(n)})}):(0,wU.isEmptyData)(this.toHash)?Promise.resolve(nSt):Promise.resolve().then(function(){return vU().crypto.subtle.digest(AAe,e.toHash)}).then(function(r){return Promise.resolve(new Uint8Array(r))})},t.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(r,n){vU().crypto.subtle.importKey("raw",(0,wU.convertToBuffer)(e.secret),IAe,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}()});function iSt(t){if(nLr(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return oLr(e)}return!1}function nLr(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function oLr(t){return t&&rLr.every(function(e){return typeof t[e]=="function"})}var rLr,aSt=b(()=>{rLr=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var sSt=b(()=>{aSt()});var uSt,lSt,Moe,cSt=b(()=>{NAe();uSt=j(kPe());sSt();MAe();lSt=j(mne()),Moe=function(){function t(e){iSt(vU())?this.hash=new RAe(e):this.hash=new uSt.Sha256(e)}return t.prototype.update=function(e,r){this.hash.update((0,lSt.convertToBuffer)(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}()});var jAe=b(()=>{cSt();NAe()});var LAe=x((PW,DAe)=>{(function(t,e){typeof PW=="object"&&typeof DAe=="object"?DAe.exports=e():typeof define=="function"&&define.amd?define([],e):typeof PW=="object"?PW.bowser=e():t.bowser=e()})(PW,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(n,o,i){r.o(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:i})},r.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,o){if(1&o&&(n=r(n)),8&o||4&o&&typeof n=="object"&&n&&n.__esModule)return n;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&o&&typeof n!="string")for(var a in n)r.d(i,a,function(s){return n[s]}.bind(null,a));return i},r.n=function(n){var o=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(o,"a",o),o},r.o=function(n,o){return Object.prototype.hasOwnProperty.call(n,o)},r.p="",r(r.s=90)}({17:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n=r(18),o=function(){function i(){}return i.getFirstMatch=function(a,s){var u=s.match(a);return u&&u.length>0&&u[1]||""},i.getSecondMatch=function(a,s){var u=s.match(a);return u&&u.length>1&&u[2]||""},i.matchAndReturnConst=function(a,s,u){if(a.test(s))return u},i.getWindowsVersionName=function(a){switch(a){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},i.getMacOSVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),s[0]===10)switch(s[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},i.getAndroidVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),!(s[0]===1&&s[1]<5))return s[0]===1&&s[1]<6?"Cupcake":s[0]===1&&s[1]>=6?"Donut":s[0]===2&&s[1]<2?"Eclair":s[0]===2&&s[1]===2?"Froyo":s[0]===2&&s[1]>2?"Gingerbread":s[0]===3?"Honeycomb":s[0]===4&&s[1]<1?"Ice Cream Sandwich":s[0]===4&&s[1]<4?"Jelly Bean":s[0]===4&&s[1]>=4?"KitKat":s[0]===5?"Lollipop":s[0]===6?"Marshmallow":s[0]===7?"Nougat":s[0]===8?"Oreo":s[0]===9?"Pie":void 0},i.getVersionPrecision=function(a){return a.split(".").length},i.compareVersions=function(a,s,u){u===void 0&&(u=!1);var l=i.getVersionPrecision(a),c=i.getVersionPrecision(s),d=Math.max(l,c),f=0,p=i.map([a,s],function(m){var h=d-i.getVersionPrecision(m),y=m+new Array(h+1).join(".0");return i.map(y.split("."),function(g){return new Array(20-g.length).join("0")+g}).reverse()});for(u&&(f=d-Math.min(l,c)),d-=1;d>=f;){if(p[0][d]>p[1][d])return 1;if(p[0][d]===p[1][d]){if(d===f)return 0;d-=1}else if(p[0][d]<p[1][d])return-1}},i.map=function(a,s){var u,l=[];if(Array.prototype.map)return Array.prototype.map.call(a,s);for(u=0;u<a.length;u+=1)l.push(s(a[u]));return l},i.find=function(a,s){var u,l;if(Array.prototype.find)return Array.prototype.find.call(a,s);for(u=0,l=a.length;u<l;u+=1){var c=a[u];if(s(c,u))return c}},i.assign=function(a){for(var s,u,l=a,c=arguments.length,d=new Array(c>1?c-1:0),f=1;f<c;f++)d[f-1]=arguments[f];if(Object.assign)return Object.assign.apply(Object,[a].concat(d));var p=function(){var m=d[s];typeof m=="object"&&m!==null&&Object.keys(m).forEach(function(h){l[h]=m[h]})};for(s=0,u=d.length;s<u;s+=1)p();return a},i.getBrowserAlias=function(a){return n.BROWSER_ALIASES_MAP[a]},i.getBrowserTypeByAlias=function(a){return n.BROWSER_MAP[a]||""},i}();e.default=o,t.exports=e.default},18:function(t,e,r){"use strict";e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},e.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(91))&&n.__esModule?n:{default:n},i=r(18);function a(u,l){for(var c=0;c<l.length;c++){var d=l[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(u,d.key,d)}}var s=function(){function u(){}var l,c,d;return u.getParser=function(f,p){if(p===void 0&&(p=!1),typeof f!="string")throw new Error("UserAgent should be a string");return new o.default(f,p)},u.parse=function(f){return new o.default(f).getResult()},l=u,d=[{key:"BROWSER_MAP",get:function(){return i.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return i.ENGINE_MAP}},{key:"OS_MAP",get:function(){return i.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return i.PLATFORMS_MAP}}],(c=null)&&a(l.prototype,c),d&&a(l,d),u}();e.default=s,t.exports=e.default},91:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n=u(r(92)),o=u(r(93)),i=u(r(94)),a=u(r(95)),s=u(r(17));function u(c){return c&&c.__esModule?c:{default:c}}var l=function(){function c(f,p){if(p===void 0&&(p=!1),f==null||f==="")throw new Error("UserAgent parameter can't be empty");this._ua=f,this.parsedResult={},p!==!0&&this.parse()}var d=c.prototype;return d.getUA=function(){return this._ua},d.test=function(f){return f.test(this._ua)},d.parseBrowser=function(){var f=this;this.parsedResult.browser={};var p=s.default.find(n.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.browser=p.describe(this.getUA())),this.parsedResult.browser},d.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},d.getBrowserName=function(f){return f?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},d.getBrowserVersion=function(){return this.getBrowser().version},d.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},d.parseOS=function(){var f=this;this.parsedResult.os={};var p=s.default.find(o.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.os=p.describe(this.getUA())),this.parsedResult.os},d.getOSName=function(f){var p=this.getOS().name;return f?String(p).toLowerCase()||"":p||""},d.getOSVersion=function(){return this.getOS().version},d.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},d.getPlatformType=function(f){f===void 0&&(f=!1);var p=this.getPlatform().type;return f?String(p).toLowerCase()||"":p||""},d.parsePlatform=function(){var f=this;this.parsedResult.platform={};var p=s.default.find(i.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.platform=p.describe(this.getUA())),this.parsedResult.platform},d.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},d.getEngineName=function(f){return f?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},d.parseEngine=function(){var f=this;this.parsedResult.engine={};var p=s.default.find(a.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.engine=p.describe(this.getUA())),this.parsedResult.engine},d.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},d.getResult=function(){return s.default.assign({},this.parsedResult)},d.satisfies=function(f){var p=this,m={},h=0,y={},g=0;if(Object.keys(f).forEach(function(I){var N=f[I];typeof N=="string"?(y[I]=N,g+=1):typeof N=="object"&&(m[I]=N,h+=1)}),h>0){var _=Object.keys(m),w=s.default.find(_,function(I){return p.isOS(I)});if(w){var S=this.satisfies(m[w]);if(S!==void 0)return S}var C=s.default.find(_,function(I){return p.isPlatform(I)});if(C){var E=this.satisfies(m[C]);if(E!==void 0)return E}}if(g>0){var P=Object.keys(y),T=s.default.find(P,function(I){return p.isBrowser(I,!0)});if(T!==void 0)return this.compareVersion(y[T])}},d.isBrowser=function(f,p){p===void 0&&(p=!1);var m=this.getBrowserName().toLowerCase(),h=f.toLowerCase(),y=s.default.getBrowserTypeByAlias(h);return p&&y&&(h=y.toLowerCase()),h===m},d.compareVersion=function(f){var p=[0],m=f,h=!1,y=this.getBrowserVersion();if(typeof y=="string")return f[0]===">"||f[0]==="<"?(m=f.substr(1),f[1]==="="?(h=!0,m=f.substr(2)):p=[],f[0]===">"?p.push(1):p.push(-1)):f[0]==="="?m=f.substr(1):f[0]==="~"&&(h=!0,m=f.substr(1)),p.indexOf(s.default.compareVersions(y,m,h))>-1},d.isOS=function(f){return this.getOSName(!0)===String(f).toLowerCase()},d.isPlatform=function(f){return this.getPlatformType(!0)===String(f).toLowerCase()},d.isEngine=function(f){return this.getEngineName(!0)===String(f).toLowerCase()},d.is=function(f,p){return p===void 0&&(p=!1),this.isBrowser(f,p)||this.isOS(f)||this.isPlatform(f)},d.some=function(f){var p=this;return f===void 0&&(f=[]),f.some(function(m){return p.is(m)})},c}();e.default=l,t.exports=e.default},92:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(s){var u={name:"Googlebot"},l=o.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/opera/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opr\/|opios/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/SamsungBrowser/i],describe:function(s){var u={name:"Samsung Internet for Android"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Whale/i],describe:function(s){var u={name:"NAVER Whale Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MZBrowser/i],describe:function(s){var u={name:"MZ Browser"},l=o.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/focus/i],describe:function(s){var u={name:"Focus"},l=o.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/swing/i],describe:function(s){var u={name:"Swing"},l=o.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/coast/i],describe:function(s){var u={name:"Opera Coast"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(s){var u={name:"Opera Touch"},l=o.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/yabrowser/i],describe:function(s){var u={name:"Yandex Browser"},l=o.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/ucbrowser/i],describe:function(s){var u={name:"UC Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Maxthon|mxios/i],describe:function(s){var u={name:"Maxthon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/epiphany/i],describe:function(s){var u={name:"Epiphany"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/puffin/i],describe:function(s){var u={name:"Puffin"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sleipnir/i],describe:function(s){var u={name:"Sleipnir"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/k-meleon/i],describe:function(s){var u={name:"K-Meleon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/micromessenger/i],describe:function(s){var u={name:"WeChat"},l=o.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qqbrowser/i],describe:function(s){var u={name:/qqbrowserlite/i.test(s)?"QQ Browser Lite":"QQ Browser"},l=o.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/msie|trident/i],describe:function(s){var u={name:"Internet Explorer"},l=o.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/\sedg\//i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/edg([ea]|ios)/i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/vivaldi/i],describe:function(s){var u={name:"Vivaldi"},l=o.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/seamonkey/i],describe:function(s){var u={name:"SeaMonkey"},l=o.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sailfish/i],describe:function(s){var u={name:"Sailfish"},l=o.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,s);return l&&(u.version=l),u}},{test:[/silk/i],describe:function(s){var u={name:"Amazon Silk"},l=o.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/phantom/i],describe:function(s){var u={name:"PhantomJS"},l=o.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/slimerjs/i],describe:function(s){var u={name:"SlimerJS"},l=o.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u={name:"BlackBerry"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u={name:"WebOS Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/bada/i],describe:function(s){var u={name:"Bada"},l=o.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/tizen/i],describe:function(s){var u={name:"Tizen"},l=o.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qupzilla/i],describe:function(s){var u={name:"QupZilla"},l=o.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/firefox|iceweasel|fxios/i],describe:function(s){var u={name:"Firefox"},l=o.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/electron/i],describe:function(s){var u={name:"Electron"},l=o.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MiuiBrowser/i],describe:function(s){var u={name:"Miui"},l=o.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/chromium/i],describe:function(s){var u={name:"Chromium"},l=o.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/chrome|crios|crmo/i],describe:function(s){var u={name:"Chrome"},l=o.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/GSA/i],describe:function(s){var u={name:"Google Search"},l=o.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u={name:"Android Browser"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/playstation 4/i],describe:function(s){var u={name:"PlayStation 4"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/safari|applewebkit/i],describe:function(s){var u={name:"Safari"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/.*/i],describe:function(s){var u=s.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:o.default.getFirstMatch(u,s),version:o.default.getSecondMatch(u,s)}}}];e.default=a,t.exports=e.default},93:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/Roku\/DVP/],describe:function(s){var u=o.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,s);return{name:i.OS_MAP.Roku,version:u}}},{test:[/windows phone/i],describe:function(s){var u=o.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.WindowsPhone,version:u}}},{test:[/windows /i],describe:function(s){var u=o.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,s),l=o.default.getWindowsVersionName(u);return{name:i.OS_MAP.Windows,version:u,versionName:l}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(s){var u={name:i.OS_MAP.iOS},l=o.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,s);return l&&(u.version=l),u}},{test:[/macintosh/i],describe:function(s){var u=o.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,s).replace(/[_\s]/g,"."),l=o.default.getMacOSVersionName(u),c={name:i.OS_MAP.MacOS,version:u};return l&&(c.versionName=l),c}},{test:[/(ipod|iphone|ipad)/i],describe:function(s){var u=o.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,s).replace(/[_\s]/g,".");return{name:i.OS_MAP.iOS,version:u}}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u=o.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,s),l=o.default.getAndroidVersionName(u),c={name:i.OS_MAP.Android,version:u};return l&&(c.versionName=l),c}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u=o.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,s),l={name:i.OS_MAP.WebOS};return u&&u.length&&(l.version=u),l}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u=o.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,s)||o.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,s)||o.default.getFirstMatch(/\bbb(\d+)/i,s);return{name:i.OS_MAP.BlackBerry,version:u}}},{test:[/bada/i],describe:function(s){var u=o.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Bada,version:u}}},{test:[/tizen/i],describe:function(s){var u=o.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Tizen,version:u}}},{test:[/linux/i],describe:function(){return{name:i.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:i.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(s){var u=o.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.PlayStation4,version:u}}}];e.default=a,t.exports=e.default},94:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(s){var u=o.default.getFirstMatch(/(can-l01)/i,s)&&"Nova",l={type:i.PLATFORMS_MAP.mobile,vendor:"Huawei"};return u&&(l.model=u),l}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){var u=s.test(/ipod|iphone/i),l=s.test(/like (ipod|iphone)/i);return u&&!l},describe:function(s){var u=o.default.getFirstMatch(/(ipod|iphone)/i,s);return{type:i.PLATFORMS_MAP.mobile,vendor:"Apple",model:u}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName(!0)==="blackberry"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(s){return s.getBrowserName(!0)==="bada"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName()==="windows phone"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(s){var u=Number(String(s.getOSVersion()).split(".")[0]);return s.getOSName(!0)==="android"&&u>=3},describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){return s.getOSName(!0)==="android"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getOSName(!0)==="macos"},describe:function(){return{type:i.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(s){return s.getOSName(!0)==="windows"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="linux"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="playstation 4"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(s){return s.getOSName(!0)==="roku"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}}];e.default=a,t.exports=e.default},95:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:function(s){return s.getBrowserName(!0)==="microsoft edge"},describe:function(s){if(/\sedg\//i.test(s))return{name:i.ENGINE_MAP.Blink};var u=o.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:i.ENGINE_MAP.EdgeHTML,version:u}}},{test:[/trident/i],describe:function(s){var u={name:i.ENGINE_MAP.Trident},l=o.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){return s.test(/presto/i)},describe:function(s){var u={name:i.ENGINE_MAP.Presto},l=o.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=s.test(/gecko/i),l=s.test(/like gecko/i);return u&&!l},describe:function(s){var u={name:i.ENGINE_MAP.Gecko},l=o.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:i.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(s){var u={name:i.ENGINE_MAP.WebKit},l=o.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}}];e.default=a,t.exports=e.default}})})});var dSt,Roe,FAe=b(()=>{dSt=j(LAe()),Roe=({serviceId:t,clientVersion:e})=>async()=>{let r=typeof window<"u"&&window?.navigator?.userAgent?dSt.default.parse(window.navigator.userAgent):void 0,n=[["aws-sdk-js",e],["ua","2.0"],[`os/${r?.os?.name||"other"}`,r?.os?.version],["lang/js"],["md/browser",`${r?.browser?.name??"unknown"}_${r?.browser?.version??"unknown"}`]];return t&&n.push([`api/${t}`,e]),n}});var fSt=b(()=>{});var Noe,pSt=b(()=>{Noe=t=>()=>Promise.reject(t)});var kAe=b(()=>{fSt();pSt()});var mSt,joe,hSt=b(()=>{mSt=typeof TextEncoder=="function"?new TextEncoder:null,joe=t=>{if(typeof t=="string"){if(mSt)return mSt.encode(t).byteLength;let e=t.length;for(let r=e-1;r>=0;r--){let n=t.charCodeAt(r);n>127&&n<=2047?e++:n>2047&&n<=65535&&(e+=2),n>=56320&&n<=57343&&r--}return e}else{if(typeof t.byteLength=="number")return t.byteLength;if(typeof t.size=="number")return t.size}throw new Error(`Body Length computation failed for ${t}`)}});var $Ae=b(()=>{hSt()});var BAe,zAe=b(()=>{BAe=t=>new TextEncoder().encode(t)});var gSt=b(()=>{zAe()});var ySt,bSt=b(()=>{ySt=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});var _St=b(()=>{zAe();gSt();bSt()});var ASt,hw,gw,SU,vSt,AW,xU,TW,aP,UAe,wSt,xSt,SSt,ISt,MSt,mw,CSt,OSt,ESt,PSt,TSt,iLr,RSt,NSt=b(()=>{ASt="required",hw="fn",gw="argv",SU="ref",vSt="isSet",AW="booleanEquals",xU="error",TW="endpoint",aP="tree",UAe="PartitionResult",wSt={[ASt]:!1,type:"String"},xSt={[ASt]:!0,default:!1,type:"Boolean"},SSt={[SU]:"Endpoint"},ISt={[hw]:AW,[gw]:[{[SU]:"UseFIPS"},!0]},MSt={[hw]:AW,[gw]:[{[SU]:"UseDualStack"},!0]},mw={},CSt={[hw]:"getAttr",[gw]:[{[SU]:UAe},"supportsFIPS"]},OSt={[hw]:AW,[gw]:[!0,{[hw]:"getAttr",[gw]:[{[SU]:UAe},"supportsDualStack"]}]},ESt=[ISt],PSt=[MSt],TSt=[{[SU]:"Region"}],iLr={version:"1.0",parameters:{Region:wSt,UseDualStack:xSt,UseFIPS:xSt,Endpoint:wSt},rules:[{conditions:[{[hw]:vSt,[gw]:[SSt]}],rules:[{conditions:ESt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:xU},{conditions:PSt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:xU},{endpoint:{url:SSt,properties:mw,headers:mw},type:TW}],type:aP},{conditions:[{[hw]:vSt,[gw]:TSt}],rules:[{conditions:[{[hw]:"aws.partition",[gw]:TSt,assign:UAe}],rules:[{conditions:[ISt,MSt],rules:[{conditions:[{[hw]:AW,[gw]:[!0,CSt]},OSt],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:mw,headers:mw},type:TW}],type:aP},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:xU}],type:aP},{conditions:ESt,rules:[{conditions:[{[hw]:AW,[gw]:[CSt,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:mw,headers:mw},type:TW}],type:aP},{error:"FIPS is enabled but this partition does not support FIPS",type:xU}],type:aP},{conditions:PSt,rules:[{conditions:[OSt],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:mw,headers:mw},type:TW}],type:aP},{error:"DualStack is enabled but this partition does not support DualStack",type:xU}],type:aP},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:mw,headers:mw},type:TW}],type:aP}],type:aP},{error:"Invalid Configuration: Missing Region",type:xU}]},RSt=iLr});var jSt,DSt=b(()=>{Rne();VI();NSt();jSt=(t,e={})=>nW(RSt,{endpointParams:t,logger:e.logger});tP.aws=oW});var LSt,FSt=b(()=>{LD();eM();mr();qne();pU();_St();TAe();DSt();LSt=t=>({apiVersion:"2014-06-30",base64Decoder:t?.base64Decoder??ZI,base64Encoder:t?.base64Encoder??YI,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??jSt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??Xxt,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new ND},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new bU}],logger:t?.logger??new KI,serviceId:t?.serviceId??"Cognito Identity",urlParser:t?.urlParser??WI,utf8Decoder:t?.utf8Decoder??BAe,utf8Encoder:t?.utf8Encoder??ySt})});var kSt,$St=b(()=>{kSt=["in-region","cross-region","mobile","standard","legacy"]});var BSt,Doe,aLr,zSt=b(()=>{eP();BSt=j(LAe());$St();Doe=({defaultsMode:t}={})=>Fht(async()=>{let e=typeof t=="function"?await t():t;switch(e?.toLowerCase()){case"auto":return Promise.resolve(aLr()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(e?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${kSt.join(", ")}, got ${e}`)}}),aLr=()=>{let e=(typeof window<"u"&&window?.navigator?.userAgent?BSt.default.parse(window.navigator.userAgent):void 0)?.platform?.type;return e==="tablet"||e==="mobile"}});var qAe=b(()=>{zSt()});var USt,qSt=b(()=>{tSt();jAe();FAe();iW();pW();kAe();$Ae();fw();FSt();mr();qAe();USt=t=>{let e=Doe(t),r=()=>e().then(loe),n=LSt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??joe,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??Roe({serviceId:n.serviceId,clientVersion:rSt.version}),maxAttempts:t?.maxAttempts??dw,region:t?.region??Noe("Region is missing"),requestHandler:XI.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||uW),sha256:t?.sha256??Moe,streamCollector:t?.streamCollector??mU,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(kne)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve($ne))}}});var Loe,Foe,HSt=b(()=>{Loe=t=>{let e=async()=>{if(t.region===void 0)throw new Error("Region is missing from runtimeConfig");let r=t.region;return typeof r=="string"?r:r()};return{setRegion(r){e=r},region(){return e}}},Foe=t=>({region:t.region()})});var VSt=b(()=>{});var HAe=b(()=>{});var WSt=b(()=>{HAe()});var KSt=b(()=>{WSt();HAe()});var GSt=b(()=>{VSt();KSt()});var VAe=b(()=>{HSt();GSt()});var JSt,ZSt,YSt=b(()=>{JSt=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},ZSt=t=>({httpHandler:t.httpHandler()})});var XSt=b(()=>{YSt()});var QSt=b(()=>{Ou()});var eCt=b(()=>{});var tCt=b(()=>{});function uLr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var koe,rCt=b(()=>{koe=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=uLr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var nCt=b(()=>{});var oCt=b(()=>{});var iCt=b(()=>{});var WAe=b(()=>{XSt();QSt();eCt();tCt();rCt();nCt();oCt();iCt()});var aCt,sCt,uCt=b(()=>{aCt=t=>{let e=t.httpAuthSchemes,r=t.httpAuthSchemeProvider,n=t.credentials;return{setHttpAuthScheme(o){let i=e.findIndex(a=>a.schemeId===o.schemeId);i===-1?e.push(o):e.splice(i,1,o)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(o){r=o},httpAuthSchemeProvider(){return r},setCredentials(o){n=o},credentials(){return n}}},sCt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var $oe,lCt,cCt=b(()=>{VAe();WAe();mr();uCt();$oe=t=>t,lCt=(t,e)=>{let r={...$oe(Loe(t)),...$oe(coe(t)),...$oe(JSt(t)),...$oe(aCt(t))};return e.forEach(n=>n.configure(r)),{...t,...Foe(r),...doe(r),...ZSt(r),...sCt(r)}}});var oM,Boe=b(()=>{UPe();qPe();HPe();sTe();iW();eM();YTe();po();moe();mr();TAe();Oa();qSt();cCt();oM=class extends TD{constructor(...[e]){let r=USt(e||{}),n=eSt(r),o=Cne(n),i=roe(o),a=zne(i),s=a,u=Wne(s),l=Qxt(u),c=lCt(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(Lne(this.config)),this.middlewareStack.use(poe(this.config)),this.middlewareStack.use(yoe(this.config)),this.middlewareStack.use(vne(this.config)),this.middlewareStack.use(wne(this.config)),this.middlewareStack.use(Sne(this.config)),this.middlewareStack.use(Kne(this.config,{httpAuthSchemeParametersProvider:Yxt,identityProviderConfigProvider:async d=>new yU({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(hoe(this.config))}destroy(){super.destroy()}}});var Hf,KAe=b(()=>{mr();Hf=class t extends gU{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var zoe,Uoe,qoe,Hoe,Voe,Woe,Koe,Goe,Joe,Zoe,Yoe,GAe=b(()=>{KAe();zoe=class t extends Hf{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,t.prototype)}},Uoe=class t extends Hf{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},qoe=class t extends Hf{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Hoe=class t extends Hf{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Voe=class t extends Hf{constructor(e){super({name:"ResourceConflictException",$fault:"client",...e}),this.name="ResourceConflictException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Woe=class t extends Hf{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Koe=class t extends Hf{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Goe=class t extends Hf{constructor(e){super({name:"ExternalServiceException",$fault:"client",...e}),this.name="ExternalServiceException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Joe=class t extends Hf{constructor(e){super({name:"InvalidIdentityPoolConfigurationException",$fault:"client",...e}),this.name="InvalidIdentityPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Zoe=class t extends Hf{constructor(e){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...e}),this.name="DeveloperUserAlreadyRegisteredException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Yoe=class t extends Hf{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}}});function gs(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${t}`}}var dCt,fCt,pCt,mCt,hCt,gCt,yCt,bCt,_Ct,vCt,wCt,xCt,SCt,CCt,OCt,ECt,PCt,TCt,ACt,ICt,MCt,RCt,NCt,jCt,DCt,LCt,FCt,kCt,$Ct,BCt,zCt,UCt,qCt,HCt,VCt,WCt,KCt,GCt,JCt,ZCt,YCt,XCt,QCt,eOt,tOt,rOt,ms,cLr,dLr,fLr,pLr,mLr,hLr,gLr,yLr,bLr,_Lr,vLr,wLr,xLr,SLr,nOt,CLr,Eo,OLr,hs,Ha=b(()=>{LD();WAe();mr();KAe();GAe();dCt=async(t,e)=>{let r=gs("CreateIdentityPool"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},fCt=async(t,e)=>{let r=gs("DeleteIdentities"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},pCt=async(t,e)=>{let r=gs("DeleteIdentityPool"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},mCt=async(t,e)=>{let r=gs("DescribeIdentity"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},hCt=async(t,e)=>{let r=gs("DescribeIdentityPool"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},gCt=async(t,e)=>{let r=gs("GetCredentialsForIdentity"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},yCt=async(t,e)=>{let r=gs("GetId"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},bCt=async(t,e)=>{let r=gs("GetIdentityPoolRoles"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},_Ct=async(t,e)=>{let r=gs("GetOpenIdToken"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},vCt=async(t,e)=>{let r=gs("GetOpenIdTokenForDeveloperIdentity"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},wCt=async(t,e)=>{let r=gs("GetPrincipalTagAttributeMap"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},xCt=async(t,e)=>{let r=gs("ListIdentities"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},SCt=async(t,e)=>{let r=gs("ListIdentityPools"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},CCt=async(t,e)=>{let r=gs("ListTagsForResource"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},OCt=async(t,e)=>{let r=gs("LookupDeveloperIdentity"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},ECt=async(t,e)=>{let r=gs("MergeDeveloperIdentities"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},PCt=async(t,e)=>{let r=gs("SetIdentityPoolRoles"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},TCt=async(t,e)=>{let r=gs("SetPrincipalTagAttributeMap"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},ACt=async(t,e)=>{let r=gs("TagResource"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},ICt=async(t,e)=>{let r=gs("UnlinkDeveloperIdentity"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},MCt=async(t,e)=>{let r=gs("UnlinkIdentity"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},RCt=async(t,e)=>{let r=gs("UntagResource"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},NCt=async(t,e)=>{let r=gs("UpdateIdentityPool"),n;return n=JSON.stringify(fr(t)),hs(e,r,"/",void 0,n)},jCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},DCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},LCt=async(t,e)=>t.statusCode>=300?ms(t,e):(await QI(t.body,e),{$metadata:Eo(t)}),FCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=nOt(r,e),{$metadata:Eo(t),...n}},kCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},$Ct=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=xLr(r,e),{$metadata:Eo(t),...n}},BCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},zCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},UCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},qCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},HCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},VCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=CLr(r,e),{$metadata:Eo(t),...n}},WCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},KCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},GCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},JCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},ZCt=async(t,e)=>t.statusCode>=300?ms(t,e):(await QI(t.body,e),{$metadata:Eo(t)}),YCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},XCt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},QCt=async(t,e)=>t.statusCode>=300?ms(t,e):(await QI(t.body,e),{$metadata:Eo(t)}),eOt=async(t,e)=>t.statusCode>=300?ms(t,e):(await QI(t.body,e),{$metadata:Eo(t)}),tOt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},rOt=async(t,e)=>{if(t.statusCode>=300)return ms(t,e);let r=await su(t.body,e),n={};return n=fr(r),{$metadata:Eo(t),...n}},ms=async(t,e)=>{let r={...t,body:await fxt(t.body,e)},n=pxt(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":throw await pLr(r,e);case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":throw await hLr(r,e);case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":throw await gLr(r,e);case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":throw await yLr(r,e);case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":throw await bLr(r,e);case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":throw await vLr(r,e);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":throw await _Lr(r,e);case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":throw await fLr(r,e);case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":throw await mLr(r,e);case"DeveloperUserAlreadyRegisteredException":case"com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException":throw await dLr(r,e);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentity#ConcurrentModificationException":throw await cLr(r,e);default:let o=r.body;return OLr({output:t,parsedBody:o,errorCode:n})}},cLr=async(t,e)=>{let r=t.body,n=fr(r),o=new Yoe({$metadata:Eo(t),...n});return ps(o,r)},dLr=async(t,e)=>{let r=t.body,n=fr(r),o=new Zoe({$metadata:Eo(t),...n});return ps(o,r)},fLr=async(t,e)=>{let r=t.body,n=fr(r),o=new Goe({$metadata:Eo(t),...n});return ps(o,r)},pLr=async(t,e)=>{let r=t.body,n=fr(r),o=new zoe({$metadata:Eo(t),...n});return ps(o,r)},mLr=async(t,e)=>{let r=t.body,n=fr(r),o=new Joe({$metadata:Eo(t),...n});return ps(o,r)},hLr=async(t,e)=>{let r=t.body,n=fr(r),o=new Uoe({$metadata:Eo(t),...n});return ps(o,r)},gLr=async(t,e)=>{let r=t.body,n=fr(r),o=new qoe({$metadata:Eo(t),...n});return ps(o,r)},yLr=async(t,e)=>{let r=t.body,n=fr(r),o=new Hoe({$metadata:Eo(t),...n});return ps(o,r)},bLr=async(t,e)=>{let r=t.body,n=fr(r),o=new Voe({$metadata:Eo(t),...n});return ps(o,r)},_Lr=async(t,e)=>{let r=t.body,n=fr(r),o=new Koe({$metadata:Eo(t),...n});return ps(o,r)},vLr=async(t,e)=>{let r=t.body,n=fr(r),o=new Woe({$metadata:Eo(t),...n});return ps(o,r)},wLr=(t,e)=>gW(t,{AccessKeyId:An,Expiration:r=>hU(soe(MD(r))),SecretKey:An,SessionToken:An}),xLr=(t,e)=>gW(t,{Credentials:r=>wLr(r,e),IdentityId:An}),SLr=(t,e)=>(t||[]).filter(n=>n!=null).map(n=>nOt(n,e)),nOt=(t,e)=>gW(t,{CreationDate:r=>hU(soe(MD(r))),IdentityId:An,LastModifiedDate:r=>hU(soe(MD(r))),Logins:fr}),CLr=(t,e)=>gW(t,{Identities:r=>SLr(r,e),IdentityPoolId:An,NextToken:An}),Eo=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),OLr=uoe(Hf),hs=async(t,e,r,n,o)=>{let{hostname:i,protocol:a="https",port:s,path:u}=await t.endpoint(),l={protocol:a,hostname:i,port:s,method:"POST",path:u.endsWith("/")?u.slice(0,-1)+r:u+r,headers:e};return n!==void 0&&(l.hostname=n),o!==void 0&&(l.body=o),new koe(l)}});var Xoe,JAe=b(()=>{po();Oo();mr();Oa();Ha();Xoe=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").f(void 0,void 0).ser(dCt).de(jCt).build(){}});var Qoe,ZAe=b(()=>{po();Oo();mr();Oa();Ha();Qoe=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").f(void 0,void 0).ser(fCt).de(DCt).build(){}});var eie,YAe=b(()=>{po();Oo();mr();Oa();Ha();eie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").f(void 0,void 0).ser(pCt).de(LCt).build(){}});var tie,XAe=b(()=>{po();Oo();mr();Oa();Ha();tie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").f(void 0,void 0).ser(mCt).de(FCt).build(){}});var rie,QAe=b(()=>{po();Oo();mr();Oa();Ha();rie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").f(void 0,void 0).ser(hCt).de(kCt).build(){}});var CU,eIe=b(()=>{po();Oo();mr();Oa();Ha();CU=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").f(void 0,void 0).ser(gCt).de($Ct).build(){}});var OU,tIe=b(()=>{po();Oo();mr();Oa();Ha();OU=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").f(void 0,void 0).ser(yCt).de(BCt).build(){}});var nie,rIe=b(()=>{po();Oo();mr();Oa();Ha();nie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").f(void 0,void 0).ser(bCt).de(zCt).build(){}});var oie,nIe=b(()=>{po();Oo();mr();Oa();Ha();oie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").f(void 0,void 0).ser(_Ct).de(UCt).build(){}});var iie,oIe=b(()=>{po();Oo();mr();Oa();Ha();iie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").f(void 0,void 0).ser(vCt).de(qCt).build(){}});var aie,iIe=b(()=>{po();Oo();mr();Oa();Ha();aie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(wCt).de(HCt).build(){}});var sie,aIe=b(()=>{po();Oo();mr();Oa();Ha();sie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").f(void 0,void 0).ser(xCt).de(VCt).build(){}});var EU,uie=b(()=>{po();Oo();mr();Oa();Ha();EU=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").f(void 0,void 0).ser(SCt).de(WCt).build(){}});var lie,sIe=b(()=>{po();Oo();mr();Oa();Ha();lie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").f(void 0,void 0).ser(CCt).de(KCt).build(){}});var cie,uIe=b(()=>{po();Oo();mr();Oa();Ha();cie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").f(void 0,void 0).ser(OCt).de(GCt).build(){}});var die,lIe=b(()=>{po();Oo();mr();Oa();Ha();die=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").f(void 0,void 0).ser(ECt).de(JCt).build(){}});var fie,cIe=b(()=>{po();Oo();mr();Oa();Ha();fie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").f(void 0,void 0).ser(PCt).de(ZCt).build(){}});var pie,dIe=b(()=>{po();Oo();mr();Oa();Ha();pie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(TCt).de(YCt).build(){}});var mie,fIe=b(()=>{po();Oo();mr();Oa();Ha();mie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").f(void 0,void 0).ser(ACt).de(XCt).build(){}});var hie,pIe=b(()=>{po();Oo();mr();Oa();Ha();hie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").f(void 0,void 0).ser(ICt).de(QCt).build(){}});var gie,mIe=b(()=>{po();Oo();mr();Oa();Ha();gie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").f(void 0,void 0).ser(MCt).de(eOt).build(){}});var yie,hIe=b(()=>{po();Oo();mr();Oa();Ha();yie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").f(void 0,void 0).ser(RCt).de(tOt).build(){}});var bie,gIe=b(()=>{po();Oo();mr();Oa();Ha();bie=class extends At.classBuilder().ep({...Ur}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").f(void 0,void 0).ser(NCt).de(rOt).build(){}});var ELr,yIe,oOt=b(()=>{mr();Boe();JAe();ZAe();YAe();XAe();QAe();eIe();tIe();rIe();nIe();oIe();iIe();aIe();uie();sIe();uIe();lIe();cIe();dIe();fIe();pIe();mIe();hIe();gIe();ELr={CreateIdentityPoolCommand:Xoe,DeleteIdentitiesCommand:Qoe,DeleteIdentityPoolCommand:eie,DescribeIdentityCommand:tie,DescribeIdentityPoolCommand:rie,GetCredentialsForIdentityCommand:CU,GetIdCommand:OU,GetIdentityPoolRolesCommand:nie,GetOpenIdTokenCommand:oie,GetOpenIdTokenForDeveloperIdentityCommand:iie,GetPrincipalTagAttributeMapCommand:aie,ListIdentitiesCommand:sie,ListIdentityPoolsCommand:EU,ListTagsForResourceCommand:lie,LookupDeveloperIdentityCommand:cie,MergeDeveloperIdentitiesCommand:die,SetIdentityPoolRolesCommand:fie,SetPrincipalTagAttributeMapCommand:pie,TagResourceCommand:mie,UnlinkDeveloperIdentityCommand:hie,UnlinkIdentityCommand:gie,UntagResourceCommand:yie,UpdateIdentityPoolCommand:bie},yIe=class extends oM{};aoe(ELr,yIe)});var iOt=b(()=>{JAe();ZAe();YAe();XAe();QAe();eIe();tIe();rIe();nIe();oIe();iIe();aIe();uie();sIe();uIe();lIe();cIe();dIe();fIe();pIe();mIe();hIe();gIe()});var aOt=b(()=>{});var sko,sOt=b(()=>{eM();Boe();uie();sko=ZTe(oM,EU,"NextToken","NextToken","MaxResults")});var uOt=b(()=>{aOt();sOt()});var lOt=b(()=>{GAe()});var cOt=b(()=>{Boe();oOt();iOt();uOt();lOt()});var bIe={};as(bIe,{CognitoIdentityClient:()=>oM,GetCredentialsForIdentityCommand:()=>CU,GetIdCommand:()=>OU});var _Ie=b(()=>{cOt()});function _ie(t){return async()=>{t.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:e,CognitoIdentityClient:r}=await Promise.resolve().then(()=>(_Ie(),bIe)),{Credentials:{AccessKeyId:n=PLr(t.logger),Expiration:o,SecretKey:i=ALr(t.logger),SessionToken:a}=TLr(t.logger)}=await(t.client??new r(Object.assign({},t.clientConfig??{},{region:t.clientConfig?.region??t.parentClientConfig?.region}))).send(new e({CustomRoleArn:t.customRoleArn,IdentityId:t.identityId,Logins:t.logins?await bne(t.logins):void 0}));return{identityId:t.identityId,accessKeyId:n,secretAccessKey:i,sessionToken:a,expiration:o}}}function PLr(t){throw new pc("Response from Amazon Cognito contained no access key ID",{logger:t})}function TLr(t){throw new pc("Response from Amazon Cognito contained no credentials",{logger:t})}function ALr(t){throw new pc("Response from Amazon Cognito contained no secret key",{logger:t})}var vIe=b(()=>{eP();$Pe()});var wIe,vie,dOt=b(()=>{wIe="IdentityIds",vie=class{constructor(e="aws:cognito-identity-ids"){this.dbName=e}getItem(e){return this.withObjectStore("readonly",r=>{let n=r.get(e);return new Promise(o=>{n.onerror=()=>o(null),n.onsuccess=()=>o(n.result?n.result.value:null)})}).catch(()=>null)}removeItem(e){return this.withObjectStore("readwrite",r=>{let n=r.delete(e);return new Promise((o,i)=>{n.onerror=()=>i(n.error),n.onsuccess=()=>o()})})}setItem(e,r){return this.withObjectStore("readwrite",n=>{let o=n.put({id:e,value:r});return new Promise((i,a)=>{o.onerror=()=>a(o.error),o.onsuccess=()=>i()})})}getDb(){let e=self.indexedDB.open(this.dbName,1);return new Promise((r,n)=>{e.onsuccess=()=>{r(e.result)},e.onerror=()=>{n(e.error)},e.onblocked=()=>{n(new Error("Unable to access DB"))},e.onupgradeneeded=()=>{let o=e.result;o.onerror=()=>{n(new Error("Failed to create object store"))},o.createObjectStore(wIe,{keyPath:"id"})}})}withObjectStore(e,r){return this.getDb().then(n=>{let o=n.transaction(wIe,e);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(wIe)))}).catch(i=>{throw n.close(),i})})}}});var wie,fOt=b(()=>{wie=class{constructor(e={}){this.store=e}getItem(e){return e in this.store?this.store[e]:null}removeItem(e){delete this.store[e]}setItem(e,r){this.store[e]=r}}});function pOt(){return typeof self=="object"&&self.indexedDB?new vie:typeof window=="object"&&window.localStorage?window.localStorage:ILr}var ILr,mOt=b(()=>{dOt();fOt();ILr=new wie});function hOt({accountId:t,cache:e=pOt(),client:r,clientConfig:n,customRoleArn:o,identityPoolId:i,logins:a,userIdentifier:s=!a||Object.keys(a).length===0?"ANONYMOUS":void 0,logger:u,parentClientConfig:l}){u?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let c=s?`aws:cognito-identity-credentials:${i}:${s}`:void 0,d=async()=>{let{GetIdCommand:f,CognitoIdentityClient:p}=await Promise.resolve().then(()=>(_Ie(),bIe)),m=r??new p(Object.assign({},n??{},{region:n?.region??l?.region})),h=c&&await e.getItem(c);if(!h){let{IdentityId:y=MLr(u)}=await m.send(new f({AccountId:t,IdentityPoolId:i,Logins:a?await bne(a):void 0}));h=y,c&&Promise.resolve(e.setItem(c,h)).catch(()=>{})}return d=_ie({client:m,customRoleArn:o,logins:a,identityId:h}),d()};return()=>d().catch(async f=>{throw c&&Promise.resolve(e.removeItem(c)).catch(()=>{}),f})}function MLr(t){throw new pc("Response from Amazon Cognito contained no identity ID",{logger:t})}var gOt=b(()=>{eP();vIe();mOt();$Pe()});var xIe=b(()=>{Iht();Mht();Rht();vIe();gOt()});var RLr,yOt=b(()=>{xIe();RLr=t=>_ie({...t})});var NLr,bOt=b(()=>{xIe();NLr=t=>hOt({...t})});var jLr,DLr,LLr,_Ot,vOt=b(()=>{eP();jLr="169.254.170.2",DLr="169.254.170.23",LLr="[fd00:ec2::23]",_Ot=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===jLr||t.hostname===DLr||t.hostname===LLr)){if(t.hostname.includes("[")){if(t.hostname==="[::1]"||t.hostname==="[0000:0000:0000:0000:0000:0000:0000:0001]")return}else{if(t.hostname==="localhost")return;let r=t.hostname.split("."),n=o=>{let i=parseInt(o,10);return 0<=i&&i<=255};if(r[0]==="127"&&n(r[1])&&n(r[2])&&n(r[3])&&r.length===4)return}throw new pc(`URL not accepted. It must either be HTTPS or match one of the following:
- loopback CIDR 127.0.0.0/8 or [::1/128]
- ECS container host 169.254.170.2
- EKS container host 169.254.170.23 or [fd00:ec2::23]`,{logger:e})}}});var wOt=b(()=>{});var xOt=b(()=>{wOt()});var SOt=b(()=>{Ou()});var COt=b(()=>{});var OOt=b(()=>{});function FLr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var xie,EOt=b(()=>{xie=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=FLr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var POt=b(()=>{});var TOt=b(()=>{});var AOt=b(()=>{});var IOt=b(()=>{xOt();SOt();COt();OOt();EOt();POt();TOt();AOt()});function MOt(t){return new xie({protocol:t.protocol,hostname:t.hostname,port:Number(t.port),path:t.pathname,query:Array.from(t.searchParams.entries()).reduce((e,[r,n])=>(e[r]=n,e),{}),fragment:t.hash})}async function ROt(t,e){let n=await Jvt(t.body).transformToString();if(t.statusCode===200){let o=JSON.parse(n);if(typeof o.AccessKeyId!="string"||typeof o.SecretAccessKey!="string"||typeof o.Token!="string"||typeof o.Expiration!="string")throw new pc("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:e});return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.Token,expiration:fwt(o.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new pc(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:o.Code,Message:o.Message})}throw new pc(`Server responded with status: ${t.statusCode}`,{logger:e})}var NOt=b(()=>{eP();IOt();mr();kTe()});var jOt,DOt=b(()=>{jOt=(t,e,r)=>async()=>{for(let n=0;n<e;++n)try{return await t()}catch{await new Promise(i=>setTimeout(i,r))}return await t()}});var SIe,LOt=b(()=>{pW();eP();vOt();NOt();DOt();SIe=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.credentialsFullUri;if(r)e=r;else throw new pc("No HTTP credential provider host provided.",{logger:t.logger});let n=new URL(e);_Ot(n,t.logger);let o=new XI;return jOt(async()=>{let i=MOt(n);t.authorizationToken&&(i.headers.Authorization=t.authorizationToken);let a=await o.handle(i);return ROt(a.response)},t.maxRetries??3,t.timeout??1e3)}});var FOt=b(()=>{LOt()});function kLr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function kOt(t){return{schemeId:"smithy.api#noAuth"}}var $Ot,BOt,$Lr,zOt,CIe=b(()=>{LD();e_();IW();$Ot=async(t,e,r)=>({operation:cw(e).operation,region:await qf(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});BOt=t=>{let e=[];switch(t.operation){case"AssumeRoleWithSAML":{e.push(kOt(t));break}case"AssumeRoleWithWebIdentity":{e.push(kOt(t));break}default:e.push(kLr(t))}return e},$Lr=t=>({...t,stsClientCtor:by}),zOt=t=>{let e=$Lr(t);return{...Poe(e)}}});var UOt,Vf,yw=b(()=>{UOt=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),Vf={UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var HOt,qOt=b(()=>{HOt={name:"@aws-sdk/client-sts",description:"AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native",version:"3.645.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-sts","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"rimraf ./dist-types tsconfig.types.tsbuildinfo && tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo sts",test:"yarn test:unit","test:unit":"jest"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.645.0","@aws-sdk/core":"3.635.0","@aws-sdk/credential-provider-node":"3.645.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.645.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.645.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.4.0","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.15","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.2.0","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.15","@smithy/util-defaults-mode-node":"^3.0.15","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2"},devDependencies:{"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sts",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-sts"}}});var OIe,EIe=b(()=>{OIe=t=>new TextEncoder().encode(t)});var VOt=b(()=>{EIe()});var WOt,KOt=b(()=>{WOt=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});var GOt=b(()=>{EIe();VOt();KOt()});var iEt,vn,zo,Uo,aM,iM,Md,aEt,sEt,uEt,Va,JOt,bw,PU,TIe,ZOt,PIe,lEt,YOt,Rd,XOt,cEt,dEt,Wf,Jh,QOt,fEt,pEt,eEt,mEt,tEt,rEt,nEt,oEt,zLr,hEt,gEt=b(()=>{iEt="required",vn="type",zo="fn",Uo="argv",aM="ref",iM="booleanEquals",Md="stringEquals",aEt="sigv4",sEt="sts",uEt="us-east-1",Va="endpoint",JOt="https://sts.{Region}.{PartitionResult#dnsSuffix}",bw="tree",PU="error",TIe="getAttr",ZOt={[iEt]:!1,[vn]:"String"},PIe={[iEt]:!0,default:!1,[vn]:"Boolean"},lEt={[aM]:"Endpoint"},YOt={[zo]:"isSet",[Uo]:[{[aM]:"Region"}]},Rd={[aM]:"Region"},XOt={[zo]:"aws.partition",[Uo]:[Rd],assign:"PartitionResult"},cEt={[aM]:"UseFIPS"},dEt={[aM]:"UseDualStack"},Wf={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:aEt,signingName:sEt,signingRegion:uEt}]},headers:{}},Jh={},QOt={conditions:[{[zo]:Md,[Uo]:[Rd,"aws-global"]}],[Va]:Wf,[vn]:Va},fEt={[zo]:iM,[Uo]:[cEt,!0]},pEt={[zo]:iM,[Uo]:[dEt,!0]},eEt={[zo]:TIe,[Uo]:[{[aM]:"PartitionResult"},"supportsFIPS"]},mEt={[aM]:"PartitionResult"},tEt={[zo]:iM,[Uo]:[!0,{[zo]:TIe,[Uo]:[mEt,"supportsDualStack"]}]},rEt=[{[zo]:"isSet",[Uo]:[lEt]}],nEt=[fEt],oEt=[pEt],zLr={version:"1.0",parameters:{Region:ZOt,UseDualStack:PIe,UseFIPS:PIe,Endpoint:ZOt,UseGlobalEndpoint:PIe},rules:[{conditions:[{[zo]:iM,[Uo]:[{[aM]:"UseGlobalEndpoint"},!0]},{[zo]:"not",[Uo]:rEt},YOt,XOt,{[zo]:iM,[Uo]:[cEt,!1]},{[zo]:iM,[Uo]:[dEt,!1]}],rules:[{conditions:[{[zo]:Md,[Uo]:[Rd,"ap-northeast-1"]}],endpoint:Wf,[vn]:Va},{conditions:[{[zo]:Md,[Uo]:[Rd,"ap-south-1"]}],endpoint:Wf,[vn]:Va},{conditions:[{[zo]:Md,[Uo]:[Rd,"ap-southeast-1"]}],endpoint:Wf,[vn]:Va},{conditions:[{[zo]:Md,[Uo]:[Rd,"ap-southeast-2"]}],endpoint:Wf,[vn]:Va},QOt,{conditions:[{[zo]:Md,[Uo]:[Rd,"ca-central-1"]}],endpoint:Wf,[vn]:Va},{conditions:[{[zo]:Md,[Uo]:[Rd,"eu-central-1"]}],endpoint:Wf,[vn]:Va},{conditions:[{[zo]:Md,[Uo]:[Rd,"eu-north-1"]}],endpoint:Wf,[vn]:Va},{conditions:[{[zo]:Md,[Uo]:[Rd,"eu-west-1"]}],endpoint:Wf,[vn]:Va},{conditions:[{[zo]:Md,[Uo]:[Rd,"eu-west-2"]}],endpoint:Wf,[vn]:Va},{conditions:[{[zo]:Md,[Uo]:[Rd,"eu-west-3"]}],endpoint:Wf,[vn]:Va},{conditions:[{[zo]:Md,[Uo]:[Rd,"sa-east-1"]}],endpoint:Wf,[vn]:Va},{conditions:[{[zo]:Md,[Uo]:[Rd,uEt]}],endpoint:Wf,[vn]:Va},{conditions:[{[zo]:Md,[Uo]:[Rd,"us-east-2"]}],endpoint:Wf,[vn]:Va},{conditions:[{[zo]:Md,[Uo]:[Rd,"us-west-1"]}],endpoint:Wf,[vn]:Va},{conditions:[{[zo]:Md,[Uo]:[Rd,"us-west-2"]}],endpoint:Wf,[vn]:Va},{endpoint:{url:JOt,properties:{authSchemes:[{name:aEt,signingName:sEt,signingRegion:"{Region}"}]},headers:Jh},[vn]:Va}],[vn]:bw},{conditions:rEt,rules:[{conditions:nEt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[vn]:PU},{conditions:oEt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[vn]:PU},{endpoint:{url:lEt,properties:Jh,headers:Jh},[vn]:Va}],[vn]:bw},{conditions:[YOt],rules:[{conditions:[XOt],rules:[{conditions:[fEt,pEt],rules:[{conditions:[{[zo]:iM,[Uo]:[!0,eEt]},tEt],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Jh,headers:Jh},[vn]:Va}],[vn]:bw},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[vn]:PU}],[vn]:bw},{conditions:nEt,rules:[{conditions:[{[zo]:iM,[Uo]:[eEt,!0]}],rules:[{conditions:[{[zo]:Md,[Uo]:[{[zo]:TIe,[Uo]:[mEt,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:Jh,headers:Jh},[vn]:Va},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Jh,headers:Jh},[vn]:Va}],[vn]:bw},{error:"FIPS is enabled but this partition does not support FIPS",[vn]:PU}],[vn]:bw},{conditions:oEt,rules:[{conditions:[tEt],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Jh,headers:Jh},[vn]:Va}],[vn]:bw},{error:"DualStack is enabled but this partition does not support DualStack",[vn]:PU}],[vn]:bw},QOt,{endpoint:{url:JOt,properties:Jh,headers:Jh},[vn]:Va}],[vn]:bw}],[vn]:bw},{error:"Invalid Configuration: Missing Region",[vn]:PU}]},hEt=zLr});var yEt,bEt=b(()=>{Rne();VI();gEt();yEt=(t,e={})=>nW(hEt,{endpointParams:t,logger:e.logger});tP.aws=oW});var _Et,vEt=b(()=>{LD();eM();mr();qne();pU();GOt();CIe();bEt();_Et=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??ZI,base64Encoder:t?.base64Encoder??YI,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??yEt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??BOt,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new ND},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new bU}],logger:t?.logger??new KI,serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??WI,utf8Decoder:t?.utf8Decoder??OIe,utf8Encoder:t?.utf8Encoder??WOt})});var wEt,xEt=b(()=>{qOt();jAe();FAe();iW();pW();kAe();$Ae();fw();vEt();mr();qAe();wEt=t=>{let e=Doe(t),r=()=>e().then(loe),n=_Et(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??joe,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??Roe({serviceId:n.serviceId,clientVersion:HOt.version}),maxAttempts:t?.maxAttempts??dw,region:t?.region??Noe("Region is missing"),requestHandler:XI.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||uW),sha256:t?.sha256??Moe,streamCollector:t?.streamCollector??mU,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(kne)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve($ne))}}});var SEt,CEt,OEt=b(()=>{SEt=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},CEt=t=>({httpHandler:t.httpHandler()})});var EEt=b(()=>{OEt()});var PEt=b(()=>{Ou()});var TEt=b(()=>{});var AEt=b(()=>{});function ULr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Sie,IEt=b(()=>{Sie=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=ULr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var MEt=b(()=>{});var REt=b(()=>{});var NEt=b(()=>{});var AIe=b(()=>{EEt();PEt();TEt();AEt();IEt();MEt();REt();NEt()});var jEt,DEt,LEt=b(()=>{jEt=t=>{let e=t.httpAuthSchemes,r=t.httpAuthSchemeProvider,n=t.credentials;return{setHttpAuthScheme(o){let i=e.findIndex(a=>a.schemeId===o.schemeId);i===-1?e.push(o):e.splice(i,1,o)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(o){r=o},httpAuthSchemeProvider(){return r},setCredentials(o){n=o},credentials(){return n}}},DEt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var Cie,FEt,kEt=b(()=>{VAe();AIe();mr();LEt();Cie=t=>t,FEt=(t,e)=>{let r={...Cie(Loe(t)),...Cie(coe(t)),...Cie(SEt(t)),...Cie(jEt(t))};return e.forEach(n=>n.configure(r)),{...t,...Foe(r),...doe(r),...CEt(r),...DEt(r)}}});var by,IW=b(()=>{UPe();qPe();HPe();sTe();iW();eM();YTe();po();moe();mr();CIe();yw();xEt();kEt();by=class extends TD{constructor(...[e]){let r=wEt(e||{}),n=UOt(r),o=Cne(n),i=roe(o),a=zne(i),s=a,u=Wne(s),l=zOt(u),c=FEt(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(Lne(this.config)),this.middlewareStack.use(poe(this.config)),this.middlewareStack.use(yoe(this.config)),this.middlewareStack.use(vne(this.config)),this.middlewareStack.use(wne(this.config)),this.middlewareStack.use(Sne(this.config)),this.middlewareStack.use(Kne(this.config,{httpAuthSchemeParametersProvider:$Ot,identityProviderConfigProvider:async d=>new yU({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(hoe(this.config))}destroy(){super.destroy()}}});var zp,Oie=b(()=>{mr();zp=class t extends gU{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var MW,RW,NW,jW,DW,LW,FW,kW,TU,IIe,MIe,RIe,NIe,jIe,DIe,LIe,sM=b(()=>{mr();Oie();MW=class t extends zp{constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},RW=class t extends zp{constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},NW=class t extends zp{constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},jW=class t extends zp{constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},DW=class t extends zp{constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},LW=class t extends zp{constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},FW=class t extends zp{constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},kW=class t extends zp{constructor(e){super({name:"InvalidAuthorizationMessageException",$fault:"client",...e}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},TU=t=>({...t,...t.SecretAccessKey&&{SecretAccessKey:ioe}}),IIe=t=>({...t,...t.Credentials&&{Credentials:TU(t.Credentials)}}),MIe=t=>({...t,...t.SAMLAssertion&&{SAMLAssertion:ioe}}),RIe=t=>({...t,...t.Credentials&&{Credentials:TU(t.Credentials)}}),NIe=t=>({...t,...t.WebIdentityToken&&{WebIdentityToken:ioe}}),jIe=t=>({...t,...t.Credentials&&{Credentials:TU(t.Credentials)}}),DIe=t=>({...t,...t.Credentials&&{Credentials:TU(t.Credentials)}}),LIe=t=>({...t,...t.Credentials&&{Credentials:TU(t.Credentials)}})});var $Et,BEt,zEt,UEt,qEt,HEt,VEt,WEt,KEt,GEt,JEt,ZEt,YEt,XEt,QEt,ePt,uM,qLr,HLr,VLr,WLr,KLr,GLr,JLr,ZLr,YLr,XLr,QLr,eFr,tFr,rFr,nFr,oFr,Eie,iFr,aFr,sFr,uFr,lFr,tPt,dMe,cFr,dFr,fFr,$W,pFr,mFr,hFr,gFr,yFr,bFr,_Fr,vFr,wFr,xFr,SFr,CFr,OFr,EFr,Kf,PFr,lM,cM,dM,fM,AU,TFr,FIe,sP,AFr,IFr,IU,uP,MU,Up,kIe,MFr,$Ie,qp,BIe,zIe,UIe,qIe,HIe,RFr,NFr,jFr,DFr,VIe,WIe,KIe,GIe,_y,vy,JIe,ZIe,YIe,XIe,wy,QIe,lP,RU,eMe,tMe,rMe,nMe,xy,NU,oMe,iMe,jU,DU,aMe,sMe,pM,uMe,lMe,cMe,Wa,mM,LFr,cP=b(()=>{LD();AIe();mr();sM();Oie();$Et=async(t,e)=>{let r=cM,n;return n=mM({...YLr(t,e),[fM]:TFr,[pM]:dM}),lM(e,r,"/",void 0,n)},BEt=async(t,e)=>{let r=cM,n;return n=mM({...XLr(t,e),[fM]:AFr,[pM]:dM}),lM(e,r,"/",void 0,n)},zEt=async(t,e)=>{let r=cM,n;return n=mM({...QLr(t,e),[fM]:IFr,[pM]:dM}),lM(e,r,"/",void 0,n)},UEt=async(t,e)=>{let r=cM,n;return n=mM({...eFr(t,e),[fM]:MFr,[pM]:dM}),lM(e,r,"/",void 0,n)},qEt=async(t,e)=>{let r=cM,n;return n=mM({...tFr(t,e),[fM]:RFr,[pM]:dM}),lM(e,r,"/",void 0,n)},HEt=async(t,e)=>{let r=cM,n;return n=mM({...rFr(t,e),[fM]:NFr,[pM]:dM}),lM(e,r,"/",void 0,n)},VEt=async(t,e)=>{let r=cM,n;return n=mM({...nFr(t,e),[fM]:jFr,[pM]:dM}),lM(e,r,"/",void 0,n)},WEt=async(t,e)=>{let r=cM,n;return n=mM({...oFr(t,e),[fM]:DFr,[pM]:dM}),lM(e,r,"/",void 0,n)},KEt=async(t,e)=>{if(t.statusCode>=300)return uM(t,e);let r=await pw(t.body,e),n={};return n=cFr(r.AssumeRoleResult,e),{$metadata:Kf(t),...n}},GEt=async(t,e)=>{if(t.statusCode>=300)return uM(t,e);let r=await pw(t.body,e),n={};return n=dFr(r.AssumeRoleWithSAMLResult,e),{$metadata:Kf(t),...n}},JEt=async(t,e)=>{if(t.statusCode>=300)return uM(t,e);let r=await pw(t.body,e),n={};return n=fFr(r.AssumeRoleWithWebIdentityResult,e),{$metadata:Kf(t),...n}},ZEt=async(t,e)=>{if(t.statusCode>=300)return uM(t,e);let r=await pw(t.body,e),n={};return n=pFr(r.DecodeAuthorizationMessageResult,e),{$metadata:Kf(t),...n}},YEt=async(t,e)=>{if(t.statusCode>=300)return uM(t,e);let r=await pw(t.body,e),n={};return n=gFr(r.GetAccessKeyInfoResult,e),{$metadata:Kf(t),...n}},XEt=async(t,e)=>{if(t.statusCode>=300)return uM(t,e);let r=await pw(t.body,e),n={};return n=yFr(r.GetCallerIdentityResult,e),{$metadata:Kf(t),...n}},QEt=async(t,e)=>{if(t.statusCode>=300)return uM(t,e);let r=await pw(t.body,e),n={};return n=bFr(r.GetFederationTokenResult,e),{$metadata:Kf(t),...n}},ePt=async(t,e)=>{if(t.statusCode>=300)return uM(t,e);let r=await pw(t.body,e),n={};return n=_Fr(r.GetSessionTokenResult,e),{$metadata:Kf(t),...n}},uM=async(t,e)=>{let r={...t,body:await Gxt(t.body,e)},n=LFr(t,r.body);switch(n){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await qLr(r,e);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await GLr(r,e);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await JLr(r,e);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await ZLr(r,e);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await VLr(r,e);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await KLr(r,e);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await HLr(r,e);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await WLr(r,e);default:let o=r.body;return PFr({output:t,parsedBody:o.Error,errorCode:n})}},qLr=async(t,e)=>{let r=t.body,n=mFr(r.Error,e),o=new MW({$metadata:Kf(t),...n});return ps(o,r)},HLr=async(t,e)=>{let r=t.body,n=vFr(r.Error,e),o=new FW({$metadata:Kf(t),...n});return ps(o,r)},VLr=async(t,e)=>{let r=t.body,n=wFr(r.Error,e),o=new DW({$metadata:Kf(t),...n});return ps(o,r)},WLr=async(t,e)=>{let r=t.body,n=xFr(r.Error,e),o=new kW({$metadata:Kf(t),...n});return ps(o,r)},KLr=async(t,e)=>{let r=t.body,n=SFr(r.Error,e),o=new LW({$metadata:Kf(t),...n});return ps(o,r)},GLr=async(t,e)=>{let r=t.body,n=CFr(r.Error,e),o=new RW({$metadata:Kf(t),...n});return ps(o,r)},JLr=async(t,e)=>{let r=t.body,n=OFr(r.Error,e),o=new NW({$metadata:Kf(t),...n});return ps(o,r)},ZLr=async(t,e)=>{let r=t.body,n=EFr(r.Error,e),o=new jW({$metadata:Kf(t),...n});return ps(o,r)},YLr=(t,e)=>{let r={};if(t[lP]!=null&&(r[lP]=t[lP]),t[RU]!=null&&(r[RU]=t[RU]),t[vy]!=null){let n=Eie(t[vy],e);t[vy]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[_y]!=null&&(r[_y]=t[_y]),t[qp]!=null&&(r[qp]=t[qp]),t[jU]!=null){let n=tPt(t[jU],e);t[jU]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}if(t[aMe]!=null){let n=lFr(t[aMe],e);t[aMe]?.length===0&&(r.TransitiveTagKeys=[]),Object.entries(n).forEach(([o,i])=>{let a=`TransitiveTagKeys.${o}`;r[a]=i})}if(t[zIe]!=null&&(r[zIe]=t[zIe]),t[NU]!=null&&(r[NU]=t[NU]),t[DU]!=null&&(r[DU]=t[DU]),t[xy]!=null&&(r[xy]=t[xy]),t[YIe]!=null){let n=sFr(t[YIe],e);t[YIe]?.length===0&&(r.ProvidedContexts=[]),Object.entries(n).forEach(([o,i])=>{let a=`ProvidedContexts.${o}`;r[a]=i})}return r},XLr=(t,e)=>{let r={};if(t[lP]!=null&&(r[lP]=t[lP]),t[JIe]!=null&&(r[JIe]=t[JIe]),t[rMe]!=null&&(r[rMe]=t[rMe]),t[vy]!=null){let n=Eie(t[vy],e);t[vy]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[_y]!=null&&(r[_y]=t[_y]),t[qp]!=null&&(r[qp]=t[qp]),r},QLr=(t,e)=>{let r={};if(t[lP]!=null&&(r[lP]=t[lP]),t[RU]!=null&&(r[RU]=t[RU]),t[lMe]!=null&&(r[lMe]=t[lMe]),t[XIe]!=null&&(r[XIe]=t[XIe]),t[vy]!=null){let n=Eie(t[vy],e);t[vy]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[_y]!=null&&(r[_y]=t[_y]),t[qp]!=null&&(r[qp]=t[qp]),r},eFr=(t,e)=>{let r={};return t[UIe]!=null&&(r[UIe]=t[UIe]),r},tFr=(t,e)=>{let r={};return t[AU]!=null&&(r[AU]=t[AU]),r},rFr=(t,e)=>({}),nFr=(t,e)=>{let r={};if(t[KIe]!=null&&(r[KIe]=t[KIe]),t[_y]!=null&&(r[_y]=t[_y]),t[vy]!=null){let n=Eie(t[vy],e);t[vy]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[qp]!=null&&(r[qp]=t[qp]),t[jU]!=null){let n=tPt(t[jU],e);t[jU]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}return r},oFr=(t,e)=>{let r={};return t[qp]!=null&&(r[qp]=t[qp]),t[NU]!=null&&(r[NU]=t[NU]),t[DU]!=null&&(r[DU]=t[DU]),r},Eie=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=iFr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},iFr=(t,e)=>{let r={};return t[cMe]!=null&&(r[cMe]=t[cMe]),r},aFr=(t,e)=>{let r={};return t[ZIe]!=null&&(r[ZIe]=t[ZIe]),t[kIe]!=null&&(r[kIe]=t[kIe]),r},sFr=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=aFr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},uFr=(t,e)=>{let r={};return t[WIe]!=null&&(r[WIe]=t[WIe]),t[uMe]!=null&&(r[uMe]=t[uMe]),r},lFr=(t,e)=>{let r={},n=1;for(let o of t)o!==null&&(r[`member.${n}`]=o,n++);return r},tPt=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=uFr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},dMe=(t,e)=>{let r={};return t[FIe]!=null&&(r[FIe]=An(t[FIe])),t[uP]!=null&&(r[uP]=An(t[uP])),r},cFr=(t,e)=>{let r={};return t[Up]!=null&&(r[Up]=$W(t[Up],e)),t[sP]!=null&&(r[sP]=dMe(t[sP],e)),t[wy]!=null&&(r[wy]=hW(t[wy])),t[xy]!=null&&(r[xy]=An(t[xy])),r},dFr=(t,e)=>{let r={};return t[Up]!=null&&(r[Up]=$W(t[Up],e)),t[sP]!=null&&(r[sP]=dMe(t[sP],e)),t[wy]!=null&&(r[wy]=hW(t[wy])),t[eMe]!=null&&(r[eMe]=An(t[eMe])),t[oMe]!=null&&(r[oMe]=An(t[oMe])),t[VIe]!=null&&(r[VIe]=An(t[VIe])),t[MU]!=null&&(r[MU]=An(t[MU])),t[GIe]!=null&&(r[GIe]=An(t[GIe])),t[xy]!=null&&(r[xy]=An(t[xy])),r},fFr=(t,e)=>{let r={};return t[Up]!=null&&(r[Up]=$W(t[Up],e)),t[nMe]!=null&&(r[nMe]=An(t[nMe])),t[sP]!=null&&(r[sP]=dMe(t[sP],e)),t[wy]!=null&&(r[wy]=hW(t[wy])),t[QIe]!=null&&(r[QIe]=An(t[QIe])),t[MU]!=null&&(r[MU]=An(t[MU])),t[xy]!=null&&(r[xy]=An(t[xy])),r},$W=(t,e)=>{let r={};return t[AU]!=null&&(r[AU]=An(t[AU])),t[tMe]!=null&&(r[tMe]=An(t[tMe])),t[iMe]!=null&&(r[iMe]=An(t[iMe])),t[BIe]!=null&&(r[BIe]=hU(pwt(t[BIe]))),r},pFr=(t,e)=>{let r={};return t[$Ie]!=null&&(r[$Ie]=An(t[$Ie])),r},mFr=(t,e)=>{let r={};return t[Wa]!=null&&(r[Wa]=An(t[Wa])),r},hFr=(t,e)=>{let r={};return t[HIe]!=null&&(r[HIe]=An(t[HIe])),t[uP]!=null&&(r[uP]=An(t[uP])),r},gFr=(t,e)=>{let r={};return t[IU]!=null&&(r[IU]=An(t[IU])),r},yFr=(t,e)=>{let r={};return t[sMe]!=null&&(r[sMe]=An(t[sMe])),t[IU]!=null&&(r[IU]=An(t[IU])),t[uP]!=null&&(r[uP]=An(t[uP])),r},bFr=(t,e)=>{let r={};return t[Up]!=null&&(r[Up]=$W(t[Up],e)),t[qIe]!=null&&(r[qIe]=hFr(t[qIe],e)),t[wy]!=null&&(r[wy]=hW(t[wy])),r},_Fr=(t,e)=>{let r={};return t[Up]!=null&&(r[Up]=$W(t[Up],e)),r},vFr=(t,e)=>{let r={};return t[Wa]!=null&&(r[Wa]=An(t[Wa])),r},wFr=(t,e)=>{let r={};return t[Wa]!=null&&(r[Wa]=An(t[Wa])),r},xFr=(t,e)=>{let r={};return t[Wa]!=null&&(r[Wa]=An(t[Wa])),r},SFr=(t,e)=>{let r={};return t[Wa]!=null&&(r[Wa]=An(t[Wa])),r},CFr=(t,e)=>{let r={};return t[Wa]!=null&&(r[Wa]=An(t[Wa])),r},OFr=(t,e)=>{let r={};return t[Wa]!=null&&(r[Wa]=An(t[Wa])),r},EFr=(t,e)=>{let r={};return t[Wa]!=null&&(r[Wa]=An(t[Wa])),r},Kf=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),PFr=uoe(zp),lM=async(t,e,r,n,o)=>{let{hostname:i,protocol:a="https",port:s,path:u}=await t.endpoint(),l={protocol:a,hostname:i,port:s,method:"POST",path:u.endsWith("/")?u.slice(0,-1)+r:u+r,headers:e};return n!==void 0&&(l.hostname=n),o!==void 0&&(l.body=o),new Sie(l)},cM={"content-type":"application/x-www-form-urlencoded"},dM="2011-06-15",fM="Action",AU="AccessKeyId",TFr="AssumeRole",FIe="AssumedRoleId",sP="AssumedRoleUser",AFr="AssumeRoleWithSAML",IFr="AssumeRoleWithWebIdentity",IU="Account",uP="Arn",MU="Audience",Up="Credentials",kIe="ContextAssertion",MFr="DecodeAuthorizationMessage",$Ie="DecodedMessage",qp="DurationSeconds",BIe="Expiration",zIe="ExternalId",UIe="EncodedMessage",qIe="FederatedUser",HIe="FederatedUserId",RFr="GetAccessKeyInfo",NFr="GetCallerIdentity",jFr="GetFederationToken",DFr="GetSessionToken",VIe="Issuer",WIe="Key",KIe="Name",GIe="NameQualifier",_y="Policy",vy="PolicyArns",JIe="PrincipalArn",ZIe="ProviderArn",YIe="ProvidedContexts",XIe="ProviderId",wy="PackedPolicySize",QIe="Provider",lP="RoleArn",RU="RoleSessionName",eMe="Subject",tMe="SecretAccessKey",rMe="SAMLAssertion",nMe="SubjectFromWebIdentityToken",xy="SourceIdentity",NU="SerialNumber",oMe="SubjectType",iMe="SessionToken",jU="Tags",DU="TokenCode",aMe="TransitiveTagKeys",sMe="UserId",pM="Version",uMe="Value",lMe="WebIdentityToken",cMe="arn",Wa="message",mM=t=>Object.entries(t).map(([e,r])=>foe(e)+"="+foe(r)).join("&"),LFr=(t,e)=>{if(e.Error?.Code!==void 0)return e.Error.Code;if(t.statusCode==404)return"NotFound"}});var dP,Pie=b(()=>{po();Oo();mr();yw();sM();cP();dP=class extends At.classBuilder().ep({...Vf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,IIe).ser($Et).de(KEt).build(){}});var BW,fMe=b(()=>{po();Oo();mr();yw();sM();cP();BW=class extends At.classBuilder().ep({...Vf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithSAML",{}).n("STSClient","AssumeRoleWithSAMLCommand").f(MIe,RIe).ser(BEt).de(GEt).build(){}});var FD,Tie=b(()=>{po();Oo();mr();yw();sM();cP();FD=class extends At.classBuilder().ep({...Vf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(NIe,jIe).ser(zEt).de(JEt).build(){}});var zW,pMe=b(()=>{po();Oo();mr();yw();cP();zW=class extends At.classBuilder().ep({...Vf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","DecodeAuthorizationMessage",{}).n("STSClient","DecodeAuthorizationMessageCommand").f(void 0,void 0).ser(UEt).de(ZEt).build(){}});var UW,mMe=b(()=>{po();Oo();mr();yw();cP();UW=class extends At.classBuilder().ep({...Vf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetAccessKeyInfo",{}).n("STSClient","GetAccessKeyInfoCommand").f(void 0,void 0).ser(qEt).de(YEt).build(){}});var qW,hMe=b(()=>{po();Oo();mr();yw();cP();qW=class extends At.classBuilder().ep({...Vf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetCallerIdentity",{}).n("STSClient","GetCallerIdentityCommand").f(void 0,void 0).ser(HEt).de(XEt).build(){}});var HW,gMe=b(()=>{po();Oo();mr();yw();sM();cP();HW=class extends At.classBuilder().ep({...Vf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetFederationToken",{}).n("STSClient","GetFederationTokenCommand").f(void 0,DIe).ser(VEt).de(QEt).build(){}});var VW,yMe=b(()=>{po();Oo();mr();yw();sM();cP();VW=class extends At.classBuilder().ep({...Vf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetSessionToken",{}).n("STSClient","GetSessionTokenCommand").f(void 0,LIe).ser(WEt).de(ePt).build(){}});var FFr,Aie,rPt=b(()=>{mr();Pie();fMe();Tie();pMe();mMe();hMe();gMe();yMe();IW();FFr={AssumeRoleCommand:dP,AssumeRoleWithSAMLCommand:BW,AssumeRoleWithWebIdentityCommand:FD,DecodeAuthorizationMessageCommand:zW,GetAccessKeyInfoCommand:UW,GetCallerIdentityCommand:qW,GetFederationTokenCommand:HW,GetSessionTokenCommand:VW},Aie=class extends by{};aoe(FFr,Aie)});var nPt=b(()=>{Pie();fMe();Tie();pMe();mMe();hMe();gMe();yMe()});var oPt=b(()=>{sM()});var iPt,aPt,sPt,uPt,lPt,cPt,dPt=b(()=>{Pie();Tie();iPt="us-east-1",aPt=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},sPt=async(t,e,r)=>{let n=typeof t=="function"?await t():t,o=typeof e=="function"?await e():e;return r?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${n} (provider)`,`${o} (parent client)`,`${iPt} (STS default)`),n??o??iPt},uPt=(t,e)=>{let r,n;return async(o,i)=>{if(n=o,!r){let{logger:l=t?.parentClientConfig?.logger,region:c,requestHandler:d=t?.parentClientConfig?.requestHandler,credentialProviderLogger:f}=t,p=await sPt(c,t?.parentClientConfig?.region,f),m=!cPt(d);r=new e({credentialDefaultProvider:()=>async()=>n,region:p,requestHandler:m?d:void 0,logger:l})}let{Credentials:a,AssumedRoleUser:s}=await r.send(new dP(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=aPt(s);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}}}},lPt=(t,e)=>{let r;return async n=>{if(!r){let{logger:s=t?.parentClientConfig?.logger,region:u,requestHandler:l=t?.parentClientConfig?.requestHandler,credentialProviderLogger:c}=t,d=await sPt(u,t?.parentClientConfig?.region,c),f=!cPt(l);r=new e({region:d,requestHandler:f?l:void 0,logger:s})}let{Credentials:o,AssumedRoleUser:i}=await r.send(new FD(n));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);let a=aPt(i);return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}}}},cPt=t=>t?.metadata?.handlerProtocol==="h2"});var fPt,pPt,mPt,kFr,hPt=b(()=>{dPt();IW();fPt=(t,e)=>e?class extends t{constructor(n){super(n);for(let o of e)this.middlewareStack.use(o)}}:t,pPt=(t={},e)=>uPt(t,fPt(by,e)),mPt=(t={},e)=>lPt(t,fPt(by,e)),kFr=t=>e=>t({roleAssumer:pPt(e),roleAssumerWithWebIdentity:mPt(e),...e})});var gPt={};as(gPt,{$Command:()=>At,AssumeRoleCommand:()=>dP,AssumeRoleResponseFilterSensitiveLog:()=>IIe,AssumeRoleWithSAMLCommand:()=>BW,AssumeRoleWithSAMLRequestFilterSensitiveLog:()=>MIe,AssumeRoleWithSAMLResponseFilterSensitiveLog:()=>RIe,AssumeRoleWithWebIdentityCommand:()=>FD,AssumeRoleWithWebIdentityRequestFilterSensitiveLog:()=>NIe,AssumeRoleWithWebIdentityResponseFilterSensitiveLog:()=>jIe,CredentialsFilterSensitiveLog:()=>TU,DecodeAuthorizationMessageCommand:()=>zW,ExpiredTokenException:()=>MW,GetAccessKeyInfoCommand:()=>UW,GetCallerIdentityCommand:()=>qW,GetFederationTokenCommand:()=>HW,GetFederationTokenResponseFilterSensitiveLog:()=>DIe,GetSessionTokenCommand:()=>VW,GetSessionTokenResponseFilterSensitiveLog:()=>LIe,IDPCommunicationErrorException:()=>FW,IDPRejectedClaimException:()=>DW,InvalidAuthorizationMessageException:()=>kW,InvalidIdentityTokenException:()=>LW,MalformedPolicyDocumentException:()=>RW,PackedPolicyTooLargeException:()=>NW,RegionDisabledException:()=>jW,STS:()=>Aie,STSClient:()=>by,STSServiceException:()=>zp,__Client:()=>TD,decorateDefaultCredentialProvider:()=>kFr,getDefaultRoleAssumer:()=>pPt,getDefaultRoleAssumerWithWebIdentity:()=>mPt});var bMe=b(()=>{IW();rPt();nPt();oPt();hPt();Oie()});var yPt={};as(yPt,{AssumeRoleCommand:()=>dP,STSClient:()=>by});var bPt=b(()=>{bMe()});var $Fr,_Pt=b(()=>{eP();$Fr=t=>{let e;return async()=>{t.logger?.debug("@aws-sdk/credential-providers - fromTemporaryCredentials (STS)");let r={...t.params,RoleSessionName:t.params.RoleSessionName??"aws-sdk-js-"+Date.now()};if(r?.SerialNumber){if(!t.mfaCodeProvider)throw new pc("Temporary credential requires multi-factor authentication, but no MFA code callback was provided.",{tryNextLink:!1,logger:t.logger});r.TokenCode=await t.mfaCodeProvider(r?.SerialNumber)}let{AssumeRoleCommand:n,STSClient:o}=await Promise.resolve().then(()=>(bPt(),yPt));if(e||(e=new o({...t.clientConfig,credentials:t.masterCredentials})),t.clientPlugins)for(let a of t.clientPlugins)e.middlewareStack.use(a);let{Credentials:i}=await e.send(new n(r));if(!i||!i.AccessKeyId||!i.SecretAccessKey)throw new pc(`Invalid response from STS.assumeRole call with role ${r.RoleArn}`,{logger:t.logger});return{accessKeyId:i.AccessKeyId,secretAccessKey:i.SecretAccessKey,sessionToken:i.SessionToken,expiration:i.Expiration,credentialScope:i.CredentialScope}}}});var vPt=b(()=>{});var wPt,xPt=b(()=>{wPt=t=>async()=>{t.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:e,roleSessionName:r,webIdentityToken:n,providerId:o,policyArns:i,policy:a,durationSeconds:s}=t,{roleAssumerWithWebIdentity:u}=t;if(!u){let{getDefaultRoleAssumerWithWebIdentity:l}=await Promise.resolve().then(()=>(bMe(),gPt));u=l({...t.clientConfig,credentialProviderLogger:t.logger,parentClientConfig:t.parentClientConfig},t.clientPlugins)}return u({RoleArn:e,RoleSessionName:r??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:n,ProviderId:o,PolicyArns:i,Policy:a,DurationSeconds:s})}});var SPt=b(()=>{vPt();xPt()});var BFr,CPt=b(()=>{SPt();BFr=t=>wPt({...t})});var OPt={};as(OPt,{fromCognitoIdentity:()=>RLr,fromCognitoIdentityPool:()=>NLr,fromHttp:()=>SIe,fromTemporaryCredentials:()=>$Fr,fromWebToken:()=>BFr});var EPt=b(()=>{yOt();bOt();FOt();_Pt();CPt()});var kD={};as(kD,{__addDisposableResource:()=>KPt,__assign:()=>Iie,__asyncDelegator:()=>$Pt,__asyncGenerator:()=>kPt,__asyncValues:()=>BPt,__await:()=>LU,__awaiter:()=>RPt,__classPrivateFieldGet:()=>HPt,__classPrivateFieldIn:()=>WPt,__classPrivateFieldSet:()=>VPt,__createBinding:()=>Rie,__decorate:()=>APt,__disposeResources:()=>GPt,__esDecorate:()=>zFr,__exportStar:()=>jPt,__extends:()=>PPt,__generator:()=>NPt,__importDefault:()=>qPt,__importStar:()=>UPt,__makeTemplateObject:()=>zPt,__metadata:()=>MPt,__param:()=>IPt,__propKey:()=>qFr,__read:()=>vMe,__rest:()=>TPt,__runInitializers:()=>UFr,__setFunctionName:()=>HFr,__spread:()=>DPt,__spreadArray:()=>FPt,__spreadArrays:()=>LPt,__values:()=>Mie,default:()=>KFr});function PPt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");_Me(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function TPt(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function APt(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function IPt(t,e){return function(r,n){e(r,n,t)}}function zFr(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var y=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(d=a(y.get))&&(c.get=d),(d=a(y.set))&&(c.set=d),(d=a(y.init))&&o.unshift(d)}else(d=a(y))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function UFr(t,e,r){for(var n=arguments.length>2,o=0;o<e.length;o++)r=n?e[o].call(t,r):e[o].call(t);return n?r:void 0}function qFr(t){return typeof t=="symbol"?t:"".concat(t)}function HFr(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function MPt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function RPt(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}function NPt(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function jPt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Rie(e,t,r)}function Mie(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function vMe(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function DPt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(vMe(arguments[e]));return t}function LPt(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function FPt(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function LU(t){return this instanceof LU?(this.v=t,this):new LU(t)}function kPt(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(y,g){i.push([p,h,y,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof LU?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function $Pt(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:LU(t[o](a)),done:!1}:i?i(a):a}:i}}function BPt(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Mie=="function"?Mie(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}}function zPt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function UPt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rie(e,t,r);return VFr(e,t),e}function qPt(t){return t&&t.__esModule?t:{default:t}}function HPt(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function VPt(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function WPt(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function KPt(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function GPt(t){function e(i){t.error=t.hasError?new WFr(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(o,function(a){return e(a),o()})}else n|=1}catch(a){e(a)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}var _Me,Iie,Rie,VFr,WFr,KFr,$D=b(()=>{_Me=function(t,e){return _Me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},_Me(t,e)};Iie=function(){return Iie=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Iie.apply(this,arguments)};Rie=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};VFr=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};WFr=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};KFr={__extends:PPt,__assign:Iie,__rest:TPt,__decorate:APt,__param:IPt,__metadata:MPt,__awaiter:RPt,__generator:NPt,__createBinding:Rie,__exportStar:jPt,__values:Mie,__read:vMe,__spread:DPt,__spreadArrays:LPt,__spreadArray:FPt,__await:LU,__asyncGenerator:kPt,__asyncDelegator:$Pt,__asyncValues:BPt,__makeTemplateObject:zPt,__importStar:UPt,__importDefault:qPt,__classPrivateFieldGet:HPt,__classPrivateFieldSet:VPt,__classPrivateFieldIn:WPt,__addDisposableResource:KPt,__disposeResources:GPt}});var ZPt=x(JPt=>{"use strict";Object.defineProperty(JPt,"__esModule",{value:!0})});var YPt=x(WW=>{"use strict";Object.defineProperty(WW,"__esModule",{value:!0});WW.HttpAuthLocation=void 0;var GFr;(function(t){t.HEADER="header",t.QUERY="query"})(GFr=WW.HttpAuthLocation||(WW.HttpAuthLocation={}))});var QPt=x(XPt=>{"use strict";Object.defineProperty(XPt,"__esModule",{value:!0})});var tTt=x(eTt=>{"use strict";Object.defineProperty(eTt,"__esModule",{value:!0})});var nTt=x(rTt=>{"use strict";Object.defineProperty(rTt,"__esModule",{value:!0})});var iTt=x(oTt=>{"use strict";Object.defineProperty(oTt,"__esModule",{value:!0})});var sTt=x(aTt=>{"use strict";Object.defineProperty(aTt,"__esModule",{value:!0})});var lTt=x(uTt=>{"use strict";Object.defineProperty(uTt,"__esModule",{value:!0})});var dTt=x(cTt=>{"use strict";Object.defineProperty(cTt,"__esModule",{value:!0})});var fTt=x(KW=>{"use strict";Object.defineProperty(KW,"__esModule",{value:!0});var wMe=($D(),jc(kD));wMe.__exportStar(sTt(),KW);wMe.__exportStar(lTt(),KW);wMe.__exportStar(dTt(),KW)});var mTt=x(pTt=>{"use strict";Object.defineProperty(pTt,"__esModule",{value:!0})});var gTt=x(hTt=>{"use strict";Object.defineProperty(hTt,"__esModule",{value:!0})});var yTt=x(GW=>{"use strict";Object.defineProperty(GW,"__esModule",{value:!0});GW.EndpointURLScheme=void 0;var JFr;(function(t){t.HTTP="http",t.HTTPS="https"})(JFr=GW.EndpointURLScheme||(GW.EndpointURLScheme={}))});var _Tt=x(bTt=>{"use strict";Object.defineProperty(bTt,"__esModule",{value:!0})});var wTt=x(vTt=>{"use strict";Object.defineProperty(vTt,"__esModule",{value:!0})});var STt=x(xTt=>{"use strict";Object.defineProperty(xTt,"__esModule",{value:!0})});var OTt=x(CTt=>{"use strict";Object.defineProperty(CTt,"__esModule",{value:!0})});var PTt=x(ETt=>{"use strict";Object.defineProperty(ETt,"__esModule",{value:!0})});var TTt=x(BD=>{"use strict";Object.defineProperty(BD,"__esModule",{value:!0});var JW=($D(),jc(kD));JW.__exportStar(_Tt(),BD);JW.__exportStar(wTt(),BD);JW.__exportStar(STt(),BD);JW.__exportStar(OTt(),BD);JW.__exportStar(PTt(),BD)});var ITt=x(ATt=>{"use strict";Object.defineProperty(ATt,"__esModule",{value:!0})});var MTt=x(ZW=>{"use strict";Object.defineProperty(ZW,"__esModule",{value:!0});ZW.FieldPosition=void 0;var ZFr;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(ZFr=ZW.FieldPosition||(ZW.FieldPosition={}))});var NTt=x(RTt=>{"use strict";Object.defineProperty(RTt,"__esModule",{value:!0})});var DTt=x(jTt=>{"use strict";Object.defineProperty(jTt,"__esModule",{value:!0})});var FTt=x(Nie=>{"use strict";Object.defineProperty(Nie,"__esModule",{value:!0});var LTt=($D(),jc(kD));LTt.__exportStar(NTt(),Nie);LTt.__exportStar(DTt(),Nie)});var $Tt=x(kTt=>{"use strict";Object.defineProperty(kTt,"__esModule",{value:!0})});var zTt=x(BTt=>{"use strict";Object.defineProperty(BTt,"__esModule",{value:!0})});var qTt=x(UTt=>{"use strict";Object.defineProperty(UTt,"__esModule",{value:!0})});var VTt=x(HTt=>{"use strict";Object.defineProperty(HTt,"__esModule",{value:!0})});var KTt=x(WTt=>{"use strict";Object.defineProperty(WTt,"__esModule",{value:!0})});var JTt=x(GTt=>{"use strict";Object.defineProperty(GTt,"__esModule",{value:!0})});var YTt=x(ZTt=>{"use strict";Object.defineProperty(ZTt,"__esModule",{value:!0})});var QTt=x(XTt=>{"use strict";Object.defineProperty(XTt,"__esModule",{value:!0})});var tAt=x(eAt=>{"use strict";Object.defineProperty(eAt,"__esModule",{value:!0})});var nAt=x(rAt=>{"use strict";Object.defineProperty(rAt,"__esModule",{value:!0})});var iAt=x(oAt=>{"use strict";Object.defineProperty(oAt,"__esModule",{value:!0})});var sAt=x(aAt=>{"use strict";Object.defineProperty(aAt,"__esModule",{value:!0})});var lAt=x(uAt=>{"use strict";Object.defineProperty(uAt,"__esModule",{value:!0})});var cAt=x(YW=>{"use strict";Object.defineProperty(YW,"__esModule",{value:!0});YW.RequestHandlerProtocol=void 0;var YFr;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(YFr=YW.RequestHandlerProtocol||(YW.RequestHandlerProtocol={}))});var fAt=x(dAt=>{"use strict";Object.defineProperty(dAt,"__esModule",{value:!0})});var mAt=x(pAt=>{"use strict";Object.defineProperty(pAt,"__esModule",{value:!0})});var gAt=x(hAt=>{"use strict";Object.defineProperty(hAt,"__esModule",{value:!0})});var bAt=x(yAt=>{"use strict";Object.defineProperty(yAt,"__esModule",{value:!0})});var vAt=x(_At=>{"use strict";Object.defineProperty(_At,"__esModule",{value:!0})});var wAt=x(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});var $o=($D(),jc(kD));$o.__exportStar(ZPt(),mo);$o.__exportStar(YPt(),mo);$o.__exportStar(QPt(),mo);$o.__exportStar(tTt(),mo);$o.__exportStar(nTt(),mo);$o.__exportStar(iTt(),mo);$o.__exportStar(fTt(),mo);$o.__exportStar(mTt(),mo);$o.__exportStar(gTt(),mo);$o.__exportStar(yTt(),mo);$o.__exportStar(TTt(),mo);$o.__exportStar(ITt(),mo);$o.__exportStar(MTt(),mo);$o.__exportStar(FTt(),mo);$o.__exportStar($Tt(),mo);$o.__exportStar(zTt(),mo);$o.__exportStar(qTt(),mo);$o.__exportStar(VTt(),mo);$o.__exportStar(KTt(),mo);$o.__exportStar(JTt(),mo);$o.__exportStar(YTt(),mo);$o.__exportStar(QTt(),mo);$o.__exportStar(tAt(),mo);$o.__exportStar(nAt(),mo);$o.__exportStar(iAt(),mo);$o.__exportStar(sAt(),mo);$o.__exportStar(lAt(),mo);$o.__exportStar(cAt(),mo);$o.__exportStar(fAt(),mo);$o.__exportStar(mAt(),mo);$o.__exportStar(gAt(),mo);$o.__exportStar(bAt(),mo);$o.__exportStar(vAt(),mo)});var xAt=x(jie=>{"use strict";Object.defineProperty(jie,"__esModule",{value:!0});jie.Field=void 0;var XFr=wAt(),xMe=class{constructor({name:e,kind:r=XFr.FieldPosition.HEADER,values:n=[]}){this.name=e,this.kind=r,this.values=n}add(e){this.values.push(e)}set(e){this.values=e}remove(e){this.values=this.values.filter(r=>r!==e)}toString(){return this.values.map(e=>e.includes(",")||e.includes(" ")?`"${e}"`:e).join(", ")}get(){return this.values}};jie.Field=xMe});var SAt=x(Die=>{"use strict";Object.defineProperty(Die,"__esModule",{value:!0});Die.Fields=void 0;var SMe=class{constructor({fields:e=[],encoding:r="utf-8"}){this.entries={},e.forEach(this.setField.bind(this)),this.encoding=r}setField(e){this.entries[e.name.toLowerCase()]=e}getField(e){return this.entries[e.toLowerCase()]}removeField(e){delete this.entries[e.toLowerCase()]}getByType(e){return Object.values(this.entries).filter(r=>r.kind===e)}};Die.Fields=SMe});var OAt=x(CAt=>{"use strict";Object.defineProperty(CAt,"__esModule",{value:!0})});var EAt=x(Lie=>{"use strict";Object.defineProperty(Lie,"__esModule",{value:!0});Lie.HttpRequest=void 0;var CMe=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){let e=new t({...this,headers:{...this.headers}});return e.query&&(e.query=QFr(e.query)),e}};Lie.HttpRequest=CMe;function QFr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}});var PAt=x(Fie=>{"use strict";Object.defineProperty(Fie,"__esModule",{value:!0});Fie.HttpResponse=void 0;var OMe=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}};Fie.HttpResponse=OMe});var TAt=x(kie=>{"use strict";Object.defineProperty(kie,"__esModule",{value:!0});kie.isValidHostname=void 0;function ekr(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}kie.isValidHostname=ekr});var IAt=x(AAt=>{"use strict";Object.defineProperty(AAt,"__esModule",{value:!0})});var MAt=x(fP=>{"use strict";Object.defineProperty(fP,"__esModule",{value:!0});var zD=($D(),jc(kD));zD.__exportStar(xAt(),fP);zD.__exportStar(SAt(),fP);zD.__exportStar(OAt(),fP);zD.__exportStar(EAt(),fP);zD.__exportStar(PAt(),fP);zD.__exportStar(TAt(),fP);zD.__exportStar(IAt(),fP)});var RAt=x(EMe=>{"use strict";Object.defineProperty(EMe,"__esModule",{value:!0});var tkr=($D(),jc(kD));tkr.__exportStar(MAt(),EMe)});var UD={};as(UD,{__addDisposableResource:()=>QAt,__assign:()=>$ie,__asyncDelegator:()=>VAt,__asyncGenerator:()=>HAt,__asyncValues:()=>WAt,__await:()=>FU,__awaiter:()=>kAt,__classPrivateFieldGet:()=>ZAt,__classPrivateFieldIn:()=>XAt,__classPrivateFieldSet:()=>YAt,__createBinding:()=>zie,__decorate:()=>DAt,__disposeResources:()=>eIt,__esDecorate:()=>rkr,__exportStar:()=>BAt,__extends:()=>NAt,__generator:()=>$At,__importDefault:()=>JAt,__importStar:()=>GAt,__makeTemplateObject:()=>KAt,__metadata:()=>FAt,__param:()=>LAt,__propKey:()=>okr,__read:()=>TMe,__rest:()=>jAt,__runInitializers:()=>nkr,__setFunctionName:()=>ikr,__spread:()=>zAt,__spreadArray:()=>qAt,__spreadArrays:()=>UAt,__values:()=>Bie,default:()=>ukr});function NAt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");PMe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function jAt(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function DAt(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function LAt(t,e){return function(r,n){e(r,n,t)}}function rkr(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var y=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(d=a(y.get))&&(c.get=d),(d=a(y.set))&&(c.set=d),(d=a(y.init))&&o.unshift(d)}else(d=a(y))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function nkr(t,e,r){for(var n=arguments.length>2,o=0;o<e.length;o++)r=n?e[o].call(t,r):e[o].call(t);return n?r:void 0}function okr(t){return typeof t=="symbol"?t:"".concat(t)}function ikr(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function FAt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function kAt(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}function $At(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function BAt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zie(e,t,r)}function Bie(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function TMe(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function zAt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(TMe(arguments[e]));return t}function UAt(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function qAt(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function FU(t){return this instanceof FU?(this.v=t,this):new FU(t)}function HAt(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(y,g){i.push([p,h,y,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof FU?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function VAt(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:FU(t[o](a)),done:!1}:i?i(a):a}:i}}function WAt(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Bie=="function"?Bie(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}}function KAt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function GAt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zie(e,t,r);return akr(e,t),e}function JAt(t){return t&&t.__esModule?t:{default:t}}function ZAt(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function YAt(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function XAt(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function QAt(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function eIt(t){function e(i){t.error=t.hasError?new skr(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(o,function(a){return e(a),o()})}else n|=1}catch(a){e(a)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}var PMe,$ie,zie,akr,skr,ukr,qD=b(()=>{PMe=function(t,e){return PMe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},PMe(t,e)};$ie=function(){return $ie=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},$ie.apply(this,arguments)};zie=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};akr=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};skr=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};ukr={__extends:NAt,__assign:$ie,__rest:jAt,__decorate:DAt,__param:LAt,__metadata:FAt,__awaiter:kAt,__generator:$At,__createBinding:zie,__exportStar:BAt,__values:Bie,__read:TMe,__spread:zAt,__spreadArrays:UAt,__spreadArray:qAt,__await:FU,__asyncGenerator:HAt,__asyncDelegator:VAt,__asyncValues:WAt,__makeTemplateObject:KAt,__importStar:GAt,__importDefault:JAt,__classPrivateFieldGet:ZAt,__classPrivateFieldSet:YAt,__classPrivateFieldIn:XAt,__addDisposableResource:QAt,__disposeResources:eIt}});var RMe={};as(RMe,{__assign:()=>IMe,__asyncDelegator:()=>wkr,__asyncGenerator:()=>vkr,__asyncValues:()=>xkr,__await:()=>XW,__awaiter:()=>mkr,__classPrivateFieldGet:()=>Ekr,__classPrivateFieldSet:()=>Pkr,__createBinding:()=>gkr,__decorate:()=>dkr,__exportStar:()=>ykr,__extends:()=>lkr,__generator:()=>hkr,__importDefault:()=>Okr,__importStar:()=>Ckr,__makeTemplateObject:()=>Skr,__metadata:()=>pkr,__param:()=>fkr,__read:()=>tIt,__rest:()=>ckr,__spread:()=>bkr,__spreadArrays:()=>_kr,__values:()=>MMe});function lkr(t,e){AMe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function ckr(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function dkr(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function fkr(t,e){return function(r,n){e(r,n,t)}}function pkr(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function mkr(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}function hkr(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function gkr(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function ykr(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function MMe(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function tIt(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function bkr(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(tIt(arguments[e]));return t}function _kr(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function XW(t){return this instanceof XW?(this.v=t,this):new XW(t)}function vkr(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof XW?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){s("next",f)}function c(f){s("throw",f)}function d(f,p){f(p),i.shift(),i.length&&s(i[0][0],i[0][1])}}function wkr(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:XW(t[o](a)),done:o==="return"}:i?i(a):a}:i}}function xkr(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof MMe=="function"?MMe(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}}function Skr(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Ckr(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function Okr(t){return t&&t.__esModule?t:{default:t}}function Ekr(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Pkr(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var AMe,IMe,NMe=b(()=>{AMe=function(t,e){return AMe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)n.hasOwnProperty(o)&&(r[o]=n[o])},AMe(t,e)};IMe=function(){return IMe=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},IMe.apply(this,arguments)}});var rIt=x(kU=>{"use strict";Object.defineProperty(kU,"__esModule",{value:!0});kU.toUtf8=kU.fromUtf8=void 0;var Tkr=t=>{let e=[];for(let r=0,n=t.length;r<n;r++){let o=t.charCodeAt(r);if(o<128)e.push(o);else if(o<2048)e.push(o>>6|192,o&63|128);else if(r+1<t.length&&(o&64512)===55296&&(t.charCodeAt(r+1)&64512)===56320){let i=65536+((o&1023)<<10)+(t.charCodeAt(++r)&1023);e.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else e.push(o>>12|224,o>>6&63|128,o&63|128)}return Uint8Array.from(e)};kU.fromUtf8=Tkr;var Akr=t=>{let e="";for(let r=0,n=t.length;r<n;r++){let o=t[r];if(o<128)e+=String.fromCharCode(o);else if(192<=o&&o<224){let i=t[++r];e+=String.fromCharCode((o&31)<<6|i&63)}else if(240<=o&&o<365){let a="%"+[o,t[++r],t[++r],t[++r]].map(s=>s.toString(16)).join("%");e+=decodeURIComponent(a)}else e+=String.fromCharCode((o&15)<<12|(t[++r]&63)<<6|t[++r]&63)}return e};kU.toUtf8=Akr});var nIt=x($U=>{"use strict";Object.defineProperty($U,"__esModule",{value:!0});$U.toUtf8=$U.fromUtf8=void 0;function Ikr(t){return new TextEncoder().encode(t)}$U.fromUtf8=Ikr;function Mkr(t){return new TextDecoder("utf-8").decode(t)}$U.toUtf8=Mkr});var aIt=x(BU=>{"use strict";Object.defineProperty(BU,"__esModule",{value:!0});BU.toUtf8=BU.fromUtf8=void 0;var oIt=rIt(),iIt=nIt(),Rkr=t=>typeof TextEncoder=="function"?(0,iIt.fromUtf8)(t):(0,oIt.fromUtf8)(t);BU.fromUtf8=Rkr;var Nkr=t=>typeof TextDecoder=="function"?(0,iIt.toUtf8)(t):(0,oIt.toUtf8)(t);BU.toUtf8=Nkr});var sIt=x(Uie=>{"use strict";Object.defineProperty(Uie,"__esModule",{value:!0});Uie.convertToBuffer=void 0;var jkr=aIt(),Dkr=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:jkr.fromUtf8;function Lkr(t){return t instanceof Uint8Array?t:typeof t=="string"?Dkr(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}Uie.convertToBuffer=Lkr});var uIt=x(qie=>{"use strict";Object.defineProperty(qie,"__esModule",{value:!0});qie.isEmptyData=void 0;function Fkr(t){return typeof t=="string"?t.length===0:t.byteLength===0}qie.isEmptyData=Fkr});var lIt=x(Hie=>{"use strict";Object.defineProperty(Hie,"__esModule",{value:!0});Hie.numToUint8=void 0;function kkr(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}Hie.numToUint8=kkr});var cIt=x(Vie=>{"use strict";Object.defineProperty(Vie,"__esModule",{value:!0});Vie.uint32ArrayFrom=void 0;function $kr(t){if(!Uint32Array.from){for(var e=new Uint32Array(t.length),r=0;r<t.length;)e[r]=t[r],r+=1;return e}return Uint32Array.from(t)}Vie.uint32ArrayFrom=$kr});var jMe=x(_w=>{"use strict";Object.defineProperty(_w,"__esModule",{value:!0});_w.uint32ArrayFrom=_w.numToUint8=_w.isEmptyData=_w.convertToBuffer=void 0;var Bkr=sIt();Object.defineProperty(_w,"convertToBuffer",{enumerable:!0,get:function(){return Bkr.convertToBuffer}});var zkr=uIt();Object.defineProperty(_w,"isEmptyData",{enumerable:!0,get:function(){return zkr.isEmptyData}});var Ukr=lIt();Object.defineProperty(_w,"numToUint8",{enumerable:!0,get:function(){return Ukr.numToUint8}});var qkr=cIt();Object.defineProperty(_w,"uint32ArrayFrom",{enumerable:!0,get:function(){return qkr.uint32ArrayFrom}})});var pIt=x(Wie=>{"use strict";Object.defineProperty(Wie,"__esModule",{value:!0});Wie.AwsCrc32=void 0;var dIt=(NMe(),jc(RMe)),DMe=jMe(),fIt=Kie(),Hkr=function(){function t(){this.crc32=new fIt.Crc32}return t.prototype.update=function(e){(0,DMe.isEmptyData)(e)||this.crc32.update((0,DMe.convertToBuffer)(e))},t.prototype.digest=function(){return dIt.__awaiter(this,void 0,void 0,function(){return dIt.__generator(this,function(e){return[2,(0,DMe.numToUint8)(this.crc32.digest())]})})},t.prototype.reset=function(){this.crc32=new fIt.Crc32},t}();Wie.AwsCrc32=Hkr});var Kie=x(hM=>{"use strict";Object.defineProperty(hM,"__esModule",{value:!0});hM.AwsCrc32=hM.Crc32=hM.crc32=void 0;var Vkr=(NMe(),jc(RMe)),Wkr=jMe();function Kkr(t){return new mIt().update(t).digest()}hM.crc32=Kkr;var mIt=function(){function t(){this.checksum=4294967295}return t.prototype.update=function(e){var r,n;try{for(var o=Vkr.__values(e),i=o.next();!i.done;i=o.next()){var a=i.value;this.checksum=this.checksum>>>8^Jkr[(this.checksum^a)&255]}}catch(s){r={error:s}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return this},t.prototype.digest=function(){return(this.checksum^4294967295)>>>0},t}();hM.Crc32=mIt;var Gkr=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],Jkr=(0,Wkr.uint32ArrayFrom)(Gkr),Zkr=pIt();Object.defineProperty(hM,"AwsCrc32",{enumerable:!0,get:function(){return Zkr.AwsCrc32}})});var UU=x(zU=>{"use strict";Object.defineProperty(zU,"__esModule",{value:!0});zU.toHex=zU.fromHex=void 0;var hIt={},LMe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),hIt[t]=e,LMe[e]=t}function Ykr(t){if(t.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2){let n=t.slice(r,r+2).toLowerCase();if(n in LMe)e[r/2]=LMe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}zU.fromHex=Ykr;function Xkr(t){let e="";for(let r=0;r<t.byteLength;r++)e+=hIt[t[r]];return e}zU.toHex=Xkr});var kMe=x(Gie=>{"use strict";Object.defineProperty(Gie,"__esModule",{value:!0});Gie.Int64=void 0;var Qkr=UU(),FMe=class t{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let n=7,o=Math.abs(Math.round(e));n>-1&&o>0;n--,o/=256)r[n]=o;return e<0&&gIt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&gIt(e),parseInt((0,Qkr.toHex)(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};Gie.Int64=FMe;function gIt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}});var zMe=x(Jie=>{"use strict";Object.defineProperty(Jie,"__esModule",{value:!0});Jie.HeaderMarshaller=void 0;var qU=UU(),$Me=kMe(),BMe=class{constructor(e,r){this.toUtf8=e,this.fromUtf8=r}format(e){let r=[];for(let i of Object.keys(e)){let a=this.fromUtf8(i);r.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(e[i]))}let n=new Uint8Array(r.reduce((i,a)=>i+a.byteLength,0)),o=0;for(let i of r)n.set(i,o),o+=i.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":let o=new Uint8Array(9);return o[0]=5,o.set(e.value.bytes,1),o;case"binary":let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case"string":let s=this.fromUtf8(e.value),u=new DataView(new ArrayBuffer(3+s.byteLength));u.setUint8(0,7),u.setUint16(1,s.byteLength,!1);let l=new Uint8Array(u.buffer);return l.set(s,3),l;case"timestamp":let c=new Uint8Array(9);return c[0]=8,c.set($Me.Int64.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!u$r.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set((0,qU.fromHex)(e.value.replace(/\-/g,"")),1),d}}parse(e){let r={},n=0;for(;n<e.byteLength;){let o=e.getUint8(n++),i=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,o));switch(n+=o,e.getUint8(n++)){case 0:r[i]={type:bIt,value:!0};break;case 1:r[i]={type:bIt,value:!1};break;case 2:r[i]={type:e$r,value:e.getInt8(n++)};break;case 3:r[i]={type:t$r,value:e.getInt16(n,!1)},n+=2;break;case 4:r[i]={type:r$r,value:e.getInt32(n,!1)},n+=4;break;case 5:r[i]={type:n$r,value:new $Me.Int64(new Uint8Array(e.buffer,e.byteOffset+n,8))},n+=8;break;case 6:let a=e.getUint16(n,!1);n+=2,r[i]={type:o$r,value:new Uint8Array(e.buffer,e.byteOffset+n,a)},n+=a;break;case 7:let s=e.getUint16(n,!1);n+=2,r[i]={type:i$r,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,s))},n+=s;break;case 8:r[i]={type:a$r,value:new Date(new $Me.Int64(new Uint8Array(e.buffer,e.byteOffset+n,8)).valueOf())},n+=8;break;case 9:let u=new Uint8Array(e.buffer,e.byteOffset+n,16);n+=16,r[i]={type:s$r,value:`${(0,qU.toHex)(u.subarray(0,4))}-${(0,qU.toHex)(u.subarray(4,6))}-${(0,qU.toHex)(u.subarray(6,8))}-${(0,qU.toHex)(u.subarray(8,10))}-${(0,qU.toHex)(u.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}};Jie.HeaderMarshaller=BMe;var yIt;(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(yIt||(yIt={}));var bIt="boolean",e$r="byte",t$r="short",r$r="integer",n$r="long",o$r="binary",i$r="string",a$r="timestamp",s$r="uuid",u$r=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});var vIt=x(Zie=>{"use strict";Object.defineProperty(Zie,"__esModule",{value:!0});Zie.splitMessage=void 0;var l$r=Kie(),_It=4,gM=_It*2,HD=4,c$r=gM+HD*2;function d$r({byteLength:t,byteOffset:e,buffer:r}){if(t<c$r)throw new Error("Provided message too short to accommodate event stream message overhead");let n=new DataView(r,e,t),o=n.getUint32(0,!1);if(t!==o)throw new Error("Reported message length does not match received message length");let i=n.getUint32(_It,!1),a=n.getUint32(gM,!1),s=n.getUint32(t-HD,!1),u=new l$r.Crc32().update(new Uint8Array(r,e,gM));if(a!==u.digest())throw new Error(`The prelude checksum specified in the message (${a}) does not match the calculated CRC32 checksum (${u.digest()})`);if(u.update(new Uint8Array(r,e+gM,t-(gM+HD))),s!==u.digest())throw new Error(`The message checksum (${u.digest()}) did not match the expected value of ${s}`);return{headers:new DataView(r,e+gM+HD,i),body:new Uint8Array(r,e+gM+HD+i,o-i-(gM+HD+HD))}}Zie.splitMessage=d$r});var wIt=x(Yie=>{"use strict";Object.defineProperty(Yie,"__esModule",{value:!0});Yie.EventStreamCodec=void 0;var f$r=Kie(),p$r=zMe(),m$r=vIt(),UMe=class{constructor(e,r){this.headerMarshaller=new p$r.HeaderMarshaller(e,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return r}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let r=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return r}}}encode({headers:e,body:r}){let n=this.headerMarshaller.format(e),o=n.byteLength+r.byteLength+16,i=new Uint8Array(o),a=new DataView(i.buffer,i.byteOffset,i.byteLength),s=new f$r.Crc32;return a.setUint32(0,o,!1),a.setUint32(4,n.byteLength,!1),a.setUint32(8,s.update(i.subarray(0,8)).digest(),!1),i.set(n,12),i.set(r,n.byteLength+12),a.setUint32(o-4,s.update(i.subarray(8,o-4)).digest(),!1),i}decode(e){let{headers:r,body:n}=(0,m$r.splitMessage)(e);return{headers:this.headerMarshaller.parse(r),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}};Yie.EventStreamCodec=UMe});var SIt=x(xIt=>{"use strict";Object.defineProperty(xIt,"__esModule",{value:!0})});var CIt=x(Xie=>{"use strict";Object.defineProperty(Xie,"__esModule",{value:!0});Xie.MessageDecoderStream=void 0;var qMe=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}};Xie.MessageDecoderStream=qMe});var OIt=x(Qie=>{"use strict";Object.defineProperty(Qie,"__esModule",{value:!0});Qie.MessageEncoderStream=void 0;var HMe=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array(0))}};Qie.MessageEncoderStream=HMe});var EIt=x(eae=>{"use strict";Object.defineProperty(eae,"__esModule",{value:!0});eae.SmithyMessageDecoderStream=void 0;var VMe=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let r=await this.options.deserializer(e);r!==void 0&&(yield r)}}};eae.SmithyMessageDecoderStream=VMe});var PIt=x(tae=>{"use strict";Object.defineProperty(tae,"__esModule",{value:!0});tae.SmithyMessageEncoderStream=void 0;var WMe=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}};tae.SmithyMessageEncoderStream=WMe});var TIt=x(vw=>{"use strict";Object.defineProperty(vw,"__esModule",{value:!0});var yM=(qD(),jc(UD));yM.__exportStar(wIt(),vw);yM.__exportStar(zMe(),vw);yM.__exportStar(kMe(),vw);yM.__exportStar(SIt(),vw);yM.__exportStar(CIt(),vw);yM.__exportStar(OIt(),vw);yM.__exportStar(EIt(),vw);yM.__exportStar(PIt(),vw)});var AIt=x(rae=>{"use strict";Object.defineProperty(rae,"__esModule",{value:!0});rae.normalizeProvider=void 0;var h$r=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};rae.normalizeProvider=h$r});var IIt=x(KMe=>{"use strict";Object.defineProperty(KMe,"__esModule",{value:!0});var g$r=(qD(),jc(UD));g$r.__exportStar(AIt(),KMe)});var GMe=x(nae=>{"use strict";Object.defineProperty(nae,"__esModule",{value:!0});nae.isArrayBuffer=void 0;var y$r=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";nae.isArrayBuffer=y$r});var ZMe=x(HU=>{"use strict";Object.defineProperty(HU,"__esModule",{value:!0});HU.fromString=HU.fromArrayBuffer=void 0;var b$r=GMe(),JMe=ty(),_$r=(t,e=0,r=t.byteLength-e)=>{if(!(0,b$r.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return JMe.Buffer.from(t,e,r)};HU.fromArrayBuffer=_$r;var v$r=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?JMe.Buffer.from(t,e):JMe.Buffer.from(t)};HU.fromString=v$r});var YMe=x(oae=>{"use strict";Object.defineProperty(oae,"__esModule",{value:!0});oae.fromUtf8=void 0;var w$r=ZMe(),x$r=t=>{let e=(0,w$r.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)};oae.fromUtf8=x$r});var MIt=x(iae=>{"use strict";Object.defineProperty(iae,"__esModule",{value:!0});iae.toUint8Array=void 0;var S$r=YMe(),C$r=t=>typeof t=="string"?(0,S$r.fromUtf8)(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t);iae.toUint8Array=C$r});var RIt=x(aae=>{"use strict";Object.defineProperty(aae,"__esModule",{value:!0});aae.toUtf8=void 0;var O$r=ZMe(),E$r=t=>(0,O$r.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8");aae.toUtf8=E$r});var sae=x(QW=>{"use strict";Object.defineProperty(QW,"__esModule",{value:!0});var XMe=(qD(),jc(UD));XMe.__exportStar(YMe(),QW);XMe.__exportStar(MIt(),QW);XMe.__exportStar(RIt(),QW)});var VD=x(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.MAX_PRESIGNED_TTL=Ut.KEY_TYPE_IDENTIFIER=Ut.MAX_CACHE_SIZE=Ut.UNSIGNED_PAYLOAD=Ut.EVENT_ALGORITHM_IDENTIFIER=Ut.ALGORITHM_IDENTIFIER_V4A=Ut.ALGORITHM_IDENTIFIER=Ut.UNSIGNABLE_PATTERNS=Ut.SEC_HEADER_PATTERN=Ut.PROXY_HEADER_PATTERN=Ut.ALWAYS_UNSIGNABLE_HEADERS=Ut.HOST_HEADER=Ut.TOKEN_HEADER=Ut.SHA256_HEADER=Ut.SIGNATURE_HEADER=Ut.GENERATED_HEADERS=Ut.DATE_HEADER=Ut.AMZ_DATE_HEADER=Ut.AUTH_HEADER=Ut.REGION_SET_PARAM=Ut.TOKEN_QUERY_PARAM=Ut.SIGNATURE_QUERY_PARAM=Ut.EXPIRES_QUERY_PARAM=Ut.SIGNED_HEADERS_QUERY_PARAM=Ut.AMZ_DATE_QUERY_PARAM=Ut.CREDENTIAL_QUERY_PARAM=Ut.ALGORITHM_QUERY_PARAM=void 0;Ut.ALGORITHM_QUERY_PARAM="X-Amz-Algorithm";Ut.CREDENTIAL_QUERY_PARAM="X-Amz-Credential";Ut.AMZ_DATE_QUERY_PARAM="X-Amz-Date";Ut.SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders";Ut.EXPIRES_QUERY_PARAM="X-Amz-Expires";Ut.SIGNATURE_QUERY_PARAM="X-Amz-Signature";Ut.TOKEN_QUERY_PARAM="X-Amz-Security-Token";Ut.REGION_SET_PARAM="X-Amz-Region-Set";Ut.AUTH_HEADER="authorization";Ut.AMZ_DATE_HEADER=Ut.AMZ_DATE_QUERY_PARAM.toLowerCase();Ut.DATE_HEADER="date";Ut.GENERATED_HEADERS=[Ut.AUTH_HEADER,Ut.AMZ_DATE_HEADER,Ut.DATE_HEADER];Ut.SIGNATURE_HEADER=Ut.SIGNATURE_QUERY_PARAM.toLowerCase();Ut.SHA256_HEADER="x-amz-content-sha256";Ut.TOKEN_HEADER=Ut.TOKEN_QUERY_PARAM.toLowerCase();Ut.HOST_HEADER="host";Ut.ALWAYS_UNSIGNABLE_HEADERS={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0};Ut.PROXY_HEADER_PATTERN=/^proxy-/;Ut.SEC_HEADER_PATTERN=/^sec-/;Ut.UNSIGNABLE_PATTERNS=[/^proxy-/i,/^sec-/i];Ut.ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256";Ut.ALGORITHM_IDENTIFIER_V4A="AWS4-ECDSA-P256-SHA256";Ut.EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD";Ut.UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD";Ut.MAX_CACHE_SIZE=50;Ut.KEY_TYPE_IDENTIFIER="aws4_request";Ut.MAX_PRESIGNED_TTL=60*60*24*7});var eRe=x(bM=>{"use strict";Object.defineProperty(bM,"__esModule",{value:!0});bM.clearCredentialCache=bM.getSigningKey=bM.createScope=void 0;var P$r=UU(),T$r=sae(),QMe=VD(),VU={},uae=[],A$r=(t,e,r)=>`${t}/${e}/${r}/${QMe.KEY_TYPE_IDENTIFIER}`;bM.createScope=A$r;var I$r=async(t,e,r,n,o)=>{let i=await NIt(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${(0,P$r.toHex)(i)}:${e.sessionToken}`;if(a in VU)return VU[a];for(uae.push(a);uae.length>QMe.MAX_CACHE_SIZE;)delete VU[uae.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,QMe.KEY_TYPE_IDENTIFIER])s=await NIt(t,s,u);return VU[a]=s};bM.getSigningKey=I$r;var M$r=()=>{uae.length=0,Object.keys(VU).forEach(t=>{delete VU[t]})};bM.clearCredentialCache=M$r;var NIt=(t,e,r)=>{let n=new t(e);return n.update((0,T$r.toUint8Array)(r)),n.digest()}});var rRe=x(lae=>{"use strict";Object.defineProperty(lae,"__esModule",{value:!0});lae.getCanonicalHeaders=void 0;var tRe=VD(),R$r=({headers:t},e,r)=>{let n={};for(let o of Object.keys(t).sort()){if(t[o]==null)continue;let i=o.toLowerCase();(i in tRe.ALWAYS_UNSIGNABLE_HEADERS||e?.has(i)||tRe.PROXY_HEADER_PATTERN.test(i)||tRe.SEC_HEADER_PATTERN.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n};lae.getCanonicalHeaders=R$r});var nRe=x(cae=>{"use strict";Object.defineProperty(cae,"__esModule",{value:!0});cae.escapeUri=void 0;var N$r=t=>encodeURIComponent(t).replace(/[!'()*]/g,j$r);cae.escapeUri=N$r;var j$r=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var jIt=x(dae=>{"use strict";Object.defineProperty(dae,"__esModule",{value:!0});dae.escapeUriPath=void 0;var D$r=nRe(),L$r=t=>t.split("/").map(D$r.escapeUri).join("/");dae.escapeUriPath=L$r});var LIt=x(fae=>{"use strict";Object.defineProperty(fae,"__esModule",{value:!0});var DIt=(qD(),jc(UD));DIt.__exportStar(nRe(),fae);DIt.__exportStar(jIt(),fae)});var oRe=x(mae=>{"use strict";Object.defineProperty(mae,"__esModule",{value:!0});mae.getCanonicalQuery=void 0;var pae=LIt(),F$r=VD(),k$r=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===F$r.SIGNATURE_HEADER)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${(0,pae.escapeUri)(n)}=${(0,pae.escapeUri)(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).sort().reduce((i,a)=>i.concat([`${(0,pae.escapeUri)(n)}=${(0,pae.escapeUri)(a)}`]),[]).join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")};mae.getCanonicalQuery=k$r});var iRe=x(hae=>{"use strict";Object.defineProperty(hae,"__esModule",{value:!0});hae.getPayloadHash=void 0;var $$r=GMe(),B$r=UU(),z$r=sae(),FIt=VD(),U$r=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===FIt.SHA256_HEADER)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||(0,$$r.isArrayBuffer)(e)){let n=new r;return n.update((0,z$r.toUint8Array)(e)),(0,B$r.toHex)(await n.digest())}return FIt.UNSIGNED_PAYLOAD};hae.getPayloadHash=U$r});var kIt=x(_M=>{"use strict";Object.defineProperty(_M,"__esModule",{value:!0});_M.deleteHeader=_M.getHeaderValue=_M.hasHeader=void 0;var q$r=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1};_M.hasHeader=q$r;var H$r=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return e[r]};_M.getHeaderValue=H$r;var V$r=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))t===r.toLowerCase()&&delete e[r]};_M.deleteHeader=V$r});var aRe=x(WD=>{"use strict";Object.defineProperty(WD,"__esModule",{value:!0});WD.cloneQuery=WD.cloneRequest=void 0;var W$r=({headers:t,query:e,...r})=>({...r,headers:{...t},query:e?(0,WD.cloneQuery)(e):void 0});WD.cloneRequest=W$r;var K$r=t=>Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{});WD.cloneQuery=K$r});var sRe=x(gae=>{"use strict";Object.defineProperty(gae,"__esModule",{value:!0});gae.moveHeadersToQuery=void 0;var G$r=aRe(),J$r=(t,e={})=>{var r;let{headers:n,query:o={}}=typeof t.clone=="function"?t.clone():(0,G$r.cloneRequest)(t);for(let i of Object.keys(n)){let a=i.toLowerCase();a.slice(0,6)==="x-amz-"&&!(!((r=e.unhoistableHeaders)===null||r===void 0)&&r.has(a))&&(o[i]=n[i],delete n[i])}return{...t,headers:n,query:o}};gae.moveHeadersToQuery=J$r});var uRe=x(yae=>{"use strict";Object.defineProperty(yae,"__esModule",{value:!0});yae.prepareRequest=void 0;var Z$r=aRe(),Y$r=VD(),X$r=t=>{t=typeof t.clone=="function"?t.clone():(0,Z$r.cloneRequest)(t);for(let e of Object.keys(t.headers))Y$r.GENERATED_HEADERS.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t};yae.prepareRequest=X$r});var $It=x(KD=>{"use strict";Object.defineProperty(KD,"__esModule",{value:!0});KD.toDate=KD.iso8601=void 0;var Q$r=t=>(0,KD.toDate)(t).toISOString().replace(/\.\d{3}Z$/,"Z");KD.iso8601=Q$r;var eBr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;KD.toDate=eBr});var HIt=x(wae=>{"use strict";Object.defineProperty(wae,"__esModule",{value:!0});wae.SignatureV4=void 0;var tBr=TIt(),bae=UU(),BIt=IIt(),e9=sae(),Nd=VD(),_ae=eRe(),zIt=rRe(),rBr=oRe(),lRe=iRe(),nBr=kIt(),oBr=sRe(),UIt=uRe(),iBr=$It(),cRe=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerMarshaller=new tBr.HeaderMarshaller(e9.toUtf8,e9.fromUtf8),this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=(0,BIt.normalizeProvider)(n),this.credentialProvider=(0,BIt.normalizeProvider)(r)}async presign(e,r={}){let{signingDate:n=new Date,expiresIn:o=3600,unsignableHeaders:i,unhoistableHeaders:a,signableHeaders:s,signingRegion:u,signingService:l}=r,c=await this.credentialProvider();this.validateResolvedCredentials(c);let d=u??await this.regionProvider(),{longDate:f,shortDate:p}=vae(n);if(o>Nd.MAX_PRESIGNED_TTL)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let m=(0,_ae.createScope)(p,d,l??this.service),h=(0,oBr.moveHeadersToQuery)((0,UIt.prepareRequest)(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[Nd.TOKEN_QUERY_PARAM]=c.sessionToken),h.query[Nd.ALGORITHM_QUERY_PARAM]=Nd.ALGORITHM_IDENTIFIER,h.query[Nd.CREDENTIAL_QUERY_PARAM]=`${c.accessKeyId}/${m}`,h.query[Nd.AMZ_DATE_QUERY_PARAM]=f,h.query[Nd.EXPIRES_QUERY_PARAM]=o.toString(10);let y=(0,zIt.getCanonicalHeaders)(h,i,s);return h.query[Nd.SIGNED_HEADERS_QUERY_PARAM]=qIt(y),h.query[Nd.SIGNATURE_QUERY_PARAM]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,y,await(0,lRe.getPayloadHash)(e,this.sha256))),h}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=vae(n),c=(0,_ae.createScope)(u,s,a??this.service),d=await(0,lRe.getPayloadHash)({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=(0,bae.toHex)(await f.digest()),m=[Nd.EVENT_ALGORITHM_IDENTIFIER,l,c,o,p,d].join(`
`);return this.signString(m,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerMarshaller.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=vae(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update((0,e9.toUint8Array)(e)),(0,bae.toHex)(await u.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:n,unsignableHeaders:o,signingRegion:i,signingService:a}={}){let s=await this.credentialProvider();this.validateResolvedCredentials(s);let u=i??await this.regionProvider(),l=(0,UIt.prepareRequest)(e),{longDate:c,shortDate:d}=vae(r),f=(0,_ae.createScope)(d,u,a??this.service);l.headers[Nd.AMZ_DATE_HEADER]=c,s.sessionToken&&(l.headers[Nd.TOKEN_HEADER]=s.sessionToken);let p=await(0,lRe.getPayloadHash)(l,this.sha256);!(0,nBr.hasHeader)(Nd.SHA256_HEADER,l.headers)&&this.applyChecksum&&(l.headers[Nd.SHA256_HEADER]=p);let m=(0,zIt.getCanonicalHeaders)(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[Nd.AUTH_HEADER]=`${Nd.ALGORITHM_IDENTIFIER} Credential=${s.accessKeyId}/${f}, SignedHeaders=${qIt(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${(0,rBr.getCanonicalQuery)(e)}
${o.map(i=>`${i}:${r[i]}`).join(`
`)}
${o.join(";")}
${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update((0,e9.toUint8Array)(n));let i=await o.digest();return`${Nd.ALGORITHM_IDENTIFIER}
${e}
${r}
${(0,bae.toHex)(i)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let r=[];for(let i of e.split("/"))i?.length!==0&&i!=="."&&(i===".."?r.pop():r.push(i));let n=`${e?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&e?.endsWith("/")?"/":""}`;return encodeURIComponent(n).replace(/%2F/g,"/")}return e}async getSignature(e,r,n,o){let i=await this.createStringToSign(e,r,o),a=new this.sha256(await n);return a.update((0,e9.toUint8Array)(i)),(0,bae.toHex)(await a.digest())}getSigningKey(e,r,n,o){return(0,_ae.getSigningKey)(this.sha256,e,n,r,o||this.service)}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}};wae.SignatureV4=cRe;var vae=t=>{let e=(0,iBr.iso8601)(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},qIt=t=>Object.keys(t).sort().join(";")});var WIt=x(Hm=>{"use strict";Object.defineProperty(Hm,"__esModule",{value:!0});Hm.prepareRequest=Hm.moveHeadersToQuery=Hm.getPayloadHash=Hm.getCanonicalQuery=Hm.getCanonicalHeaders=void 0;var VIt=(qD(),jc(UD));VIt.__exportStar(HIt(),Hm);var aBr=rRe();Object.defineProperty(Hm,"getCanonicalHeaders",{enumerable:!0,get:function(){return aBr.getCanonicalHeaders}});var sBr=oRe();Object.defineProperty(Hm,"getCanonicalQuery",{enumerable:!0,get:function(){return sBr.getCanonicalQuery}});var uBr=iRe();Object.defineProperty(Hm,"getPayloadHash",{enumerable:!0,get:function(){return uBr.getPayloadHash}});var lBr=sRe();Object.defineProperty(Hm,"moveHeadersToQuery",{enumerable:!0,get:function(){return lBr.moveHeadersToQuery}});var cBr=uRe();Object.defineProperty(Hm,"prepareRequest",{enumerable:!0,get:function(){return cBr.prepareRequest}});VIt.__exportStar(eRe(),Hm)});var KIt=x(dRe=>{"use strict";Object.defineProperty(dRe,"__esModule",{value:!0});var dBr=(qD(),jc(UD));dBr.__exportStar(WIt(),dRe)});var ys=x((H2o,GIt)=>{"use strict";GIt.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var WU=x((V2o,xae)=>{"use strict";var{AbortController:JIt,AbortSignal:fBr}=typeof self<"u"?self:typeof window<"u"?window:void 0;xae.exports=JIt;xae.exports.AbortSignal=fBr;xae.exports.default=JIt});var t9=x((W2o,fRe)=>{"use strict";var KU=typeof Reflect=="object"?Reflect:null,ZIt=KU&&typeof KU.apply=="function"?KU.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Sae;KU&&typeof KU.ownKeys=="function"?Sae=KU.ownKeys:Object.getOwnPropertySymbols?Sae=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Sae=function(e){return Object.getOwnPropertyNames(e)};function pBr(t){console&&console.warn&&console.warn(t)}var XIt=Number.isNaN||function(e){return e!==e};function Ji(){Ji.init.call(this)}fRe.exports=Ji;fRe.exports.once=yBr;Ji.EventEmitter=Ji;Ji.prototype._events=void 0;Ji.prototype._eventsCount=0;Ji.prototype._maxListeners=void 0;var YIt=10;function Cae(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ji,"defaultMaxListeners",{enumerable:!0,get:function(){return YIt},set:function(t){if(typeof t!="number"||t<0||XIt(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");YIt=t}});Ji.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Ji.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||XIt(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function QIt(t){return t._maxListeners===void 0?Ji.defaultMaxListeners:t._maxListeners}Ji.prototype.getMaxListeners=function(){return QIt(this)};Ji.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var o=e==="error",i=this._events;if(i!==void 0)o=o&&i.error===void 0;else if(!o)return!1;if(o){var a;if(r.length>0&&(a=r[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[e];if(u===void 0)return!1;if(typeof u=="function")ZIt(u,this,r);else for(var l=u.length,c=oMt(u,l),n=0;n<l;++n)ZIt(c[n],this,r);return!0};function eMt(t,e,r,n){var o,i,a;if(Cae(r),i=t._events,i===void 0?(i=t._events=Object.create(null),t._eventsCount=0):(i.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),a=i[e]),a===void 0)a=i[e]=r,++t._eventsCount;else if(typeof a=="function"?a=i[e]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),o=QIt(t),o>0&&a.length>o&&!a.warned){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=a.length,pBr(s)}return t}Ji.prototype.addListener=function(e,r){return eMt(this,e,r,!1)};Ji.prototype.on=Ji.prototype.addListener;Ji.prototype.prependListener=function(e,r){return eMt(this,e,r,!0)};function mBr(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function tMt(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=mBr.bind(n);return o.listener=r,n.wrapFn=o,o}Ji.prototype.once=function(e,r){return Cae(r),this.on(e,tMt(this,e,r)),this};Ji.prototype.prependOnceListener=function(e,r){return Cae(r),this.prependListener(e,tMt(this,e,r)),this};Ji.prototype.removeListener=function(e,r){var n,o,i,a,s;if(Cae(r),o=this._events,o===void 0)return this;if(n=o[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===r||n[a].listener===r){s=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():hBr(n,i),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};Ji.prototype.off=Ji.prototype.removeListener;Ji.prototype.removeAllListeners=function(e){var r,n,o;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(o=0;o<i.length;++o)a=i[o],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(o=r.length-1;o>=0;o--)this.removeListener(e,r[o]);return this};function rMt(t,e,r){var n=t._events;if(n===void 0)return[];var o=n[e];return o===void 0?[]:typeof o=="function"?r?[o.listener||o]:[o]:r?gBr(o):oMt(o,o.length)}Ji.prototype.listeners=function(e){return rMt(this,e,!0)};Ji.prototype.rawListeners=function(e){return rMt(this,e,!1)};Ji.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):nMt.call(t,e)};Ji.prototype.listenerCount=nMt;function nMt(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Ji.prototype.eventNames=function(){return this._eventsCount>0?Sae(this._events):[]};function oMt(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function hBr(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function gBr(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function yBr(t,e){return new Promise(function(r,n){function o(a){t.removeListener(e,i),n(a)}function i(){typeof t.removeListener=="function"&&t.removeListener("error",o),r([].slice.call(arguments))}iMt(t,e,i,{once:!0}),e!=="error"&&bBr(t,o,{once:!0})})}function bBr(t,e,r){typeof t.on=="function"&&iMt(t,"error",e,r)}function iMt(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function o(i){n.once&&t.removeEventListener(e,o),r(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var Gf=x((K2o,mRe)=>{"use strict";var _Br=ty(),{kResistStopPropagation:vBr,SymbolDispose:wBr}=ys(),xBr=globalThis.AbortSignal||WU().AbortSignal,SBr=globalThis.AbortController||WU().AbortController,CBr=Object.getPrototypeOf(async function(){}).constructor,aMt=globalThis.Blob||_Br.Blob,OBr=typeof aMt<"u"?function(e){return e instanceof aMt}:function(e){return!1},sMt=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},EBr=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},pRe=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let n=0;n<e.length;n++)r+=` ${e[n].stack}
`;super(r),this.name="AggregateError",this.errors=e}};mRe.exports={AggregateError:pRe,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((n,o)=>{t=n,e=o}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((n,...o)=>n?r(n):e(...o))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,n]){let o=e.shift();return n==="f"?o.toFixed(6):n==="j"?JSON.stringify(o):n==="s"&&typeof o=="object"?`${o.constructor!==Object?o.constructor.name:""} {}`.trim():o.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction(t){return t instanceof CBr},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:OBr,deprecate(t,e){return t},addAbortListener:t9().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);sMt(e,"signal"),EBr(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[vBr]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[wBr](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:xBr.any||function(e){if(e.length===1)return e[0];let r=new SBr,n=()=>r.abort();return e.forEach(o=>{sMt(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};mRe.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Hp=x((G2o,cMt)=>{"use strict";var{format:PBr,inspect:Oae,AggregateError:TBr}=Gf(),ABr=globalThis.AggregateError||TBr,IBr=Symbol("kIsNodeError"),MBr=["string","function","number","object","Function","Object","boolean","bigint","symbol"],RBr=/^([A-Z][a-z0-9]*)+$/,NBr="__node_internal_",Eae={};function GD(t,e){if(!t)throw new Eae.ERR_INTERNAL_ASSERTION(e)}function uMt(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function jBr(t,e,r){if(typeof e=="function")return GD(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let n=(e.match(/%[dfijoOs]/g)||[]).length;return GD(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:PBr(e,...r)}function jd(t,e,r){r||(r=Error);class n extends r{constructor(...i){super(jBr(t,e,i))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=t,n.prototype[IBr]=!0,Eae[t]=n}function lMt(t){let e=NBr+t.name;return Object.defineProperty(t,"name",{value:e}),t}function DBr(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new ABr([e,t],e.message);return r.code=e.code,r}return t||e}var hRe=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Eae.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};jd("ERR_ASSERTION","%s",Error);jd("ERR_INVALID_ARG_TYPE",(t,e,r)=>{GD(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let o=[],i=[],a=[];for(let u of e)GD(typeof u=="string","All expected entries have to be of type string"),MBr.includes(u)?o.push(u.toLowerCase()):RBr.test(u)?i.push(u):(GD(u!=="object",'The value "object" should be written as "Object"'),a.push(u));if(i.length>0){let u=o.indexOf("object");u!==-1&&(o.splice(o,u,1),i.push("Object"))}if(o.length>0){switch(o.length){case 1:n+=`of type ${o[0]}`;break;case 2:n+=`one of type ${o[0]} or ${o[1]}`;break;default:{let u=o.pop();n+=`one of type ${o.join(", ")}, or ${u}`}}(i.length>0||a.length>0)&&(n+=" or ")}if(i.length>0){switch(i.length){case 1:n+=`an instance of ${i[0]}`;break;case 2:n+=`an instance of ${i[0]} or ${i[1]}`;break;default:{let u=i.pop();n+=`an instance of ${i.join(", ")}, or ${u}`}}a.length>0&&(n+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(n+="an "),n+=`${a[0]}`;break;case 2:n+=`one of ${a[0]} or ${a[1]}`;break;default:{let u=a.pop();n+=`one of ${a.join(", ")}, or ${u}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var s;if((s=r.constructor)!==null&&s!==void 0&&s.name)n+=`. Received an instance of ${r.constructor.name}`;else{let u=Oae(r,{depth:-1});n+=`. Received ${u}`}}else{let u=Oae(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);jd("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=Oae(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);jd("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;let o=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${o}.`},TypeError);jd("ERR_MISSING_ARGS",(...t)=>{GD(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);jd("ERR_OUT_OF_RANGE",(t,e,r)=>{GD(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=uMt(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=uMt(n)),n+="n"):n=Oae(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);jd("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);jd("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);jd("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);jd("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);jd("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);jd("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);jd("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);jd("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);jd("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);jd("ERR_STREAM_WRITE_AFTER_END","write after end",Error);jd("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);cMt.exports={AbortError:hRe,aggregateTwoErrors:lMt(DBr),hideStackFrames:lMt,codes:Eae}});var JU=x((J2o,vMt)=>{"use strict";var{ArrayIsArray:yRe,ArrayPrototypeIncludes:mMt,ArrayPrototypeJoin:hMt,ArrayPrototypeMap:LBr,NumberIsInteger:bRe,NumberIsNaN:FBr,NumberMAX_SAFE_INTEGER:kBr,NumberMIN_SAFE_INTEGER:$Br,NumberParseInt:BBr,ObjectPrototypeHasOwnProperty:zBr,RegExpPrototypeExec:gMt,String:UBr,StringPrototypeToUpperCase:qBr,StringPrototypeTrim:HBr}=ys(),{hideStackFrames:Sy,codes:{ERR_SOCKET_BAD_PORT:VBr,ERR_INVALID_ARG_TYPE:Jf,ERR_INVALID_ARG_VALUE:GU,ERR_OUT_OF_RANGE:JD,ERR_UNKNOWN_SIGNAL:dMt}}=Hp(),{normalizeEncoding:WBr}=Gf(),{isAsyncFunction:KBr,isArrayBufferView:GBr}=Gf().types,fMt={};function JBr(t){return t===(t|0)}function ZBr(t){return t===t>>>0}var YBr=/^[0-7]+$/,XBr="must be a 32-bit unsigned integer or an octal string";function QBr(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(gMt(YBr,t)===null)throw new GU(e,t,XBr);t=BBr(t,8)}return yMt(t,e),t}var ezr=Sy((t,e,r=$Br,n=kBr)=>{if(typeof t!="number")throw new Jf(e,"number",t);if(!bRe(t))throw new JD(e,"an integer",t);if(t<r||t>n)throw new JD(e,`>= ${r} && <= ${n}`,t)}),tzr=Sy((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new Jf(e,"number",t);if(!bRe(t))throw new JD(e,"an integer",t);if(t<r||t>n)throw new JD(e,`>= ${r} && <= ${n}`,t)}),yMt=Sy((t,e,r=!1)=>{if(typeof t!="number")throw new Jf(e,"number",t);if(!bRe(t))throw new JD(e,"an integer",t);let n=r?1:0,o=4294967295;if(t<n||t>o)throw new JD(e,`>= ${n} && <= ${o}`,t)});function _Re(t,e){if(typeof t!="string")throw new Jf(e,"string",t)}function rzr(t,e,r=void 0,n){if(typeof t!="number")throw new Jf(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&FBr(t))throw new JD(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var nzr=Sy((t,e,r)=>{if(!mMt(r,t)){let o="must be one of: "+hMt(LBr(r,i=>typeof i=="string"?`'${i}'`:UBr(i)),", ");throw new GU(e,t,o)}});function bMt(t,e){if(typeof t!="boolean")throw new Jf(e,"boolean",t)}function gRe(t,e,r){return t==null||!zBr(t,e)?r:t[e]}var ozr=Sy((t,e,r=null)=>{let n=gRe(r,"allowArray",!1),o=gRe(r,"allowFunction",!1);if(!gRe(r,"nullable",!1)&&t===null||!n&&yRe(t)||typeof t!="object"&&(!o||typeof t!="function"))throw new Jf(e,"Object",t)}),izr=Sy((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Jf(e,"a dictionary",t)}),Pae=Sy((t,e,r=0)=>{if(!yRe(t))throw new Jf(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new GU(e,t,n)}});function azr(t,e){Pae(t,e);for(let r=0;r<t.length;r++)_Re(t[r],`${e}[${r}]`)}function szr(t,e){Pae(t,e);for(let r=0;r<t.length;r++)bMt(t[r],`${e}[${r}]`)}function uzr(t,e){Pae(t,e);for(let r=0;r<t.length;r++){let n=t[r],o=`${e}[${r}]`;if(n==null)throw new Jf(o,"AbortSignal",n);_Mt(n,o)}}function lzr(t,e="signal"){if(_Re(t,e),fMt[t]===void 0)throw fMt[qBr(t)]!==void 0?new dMt(t+" (signals must use all capital letters)"):new dMt(t)}var czr=Sy((t,e="buffer")=>{if(!GBr(t))throw new Jf(e,["Buffer","TypedArray","DataView"],t)});function dzr(t,e){let r=WBr(e),n=t.length;if(r==="hex"&&n%2!==0)throw new GU("encoding",e,`is invalid for data of length ${n}`)}function fzr(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&HBr(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new VBr(e,t,r);return t|0}var _Mt=Sy((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Jf(e,"AbortSignal",t)}),pzr=Sy((t,e)=>{if(typeof t!="function")throw new Jf(e,"Function",t)}),mzr=Sy((t,e)=>{if(typeof t!="function"||KBr(t))throw new Jf(e,"Function",t)}),hzr=Sy((t,e)=>{if(t!==void 0)throw new Jf(e,"undefined",t)});function gzr(t,e,r){if(!mMt(r,t))throw new Jf(e,`('${hMt(r,"|")}')`,t)}var yzr=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function pMt(t,e){if(typeof t>"u"||!gMt(yzr,t))throw new GU(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function bzr(t){if(typeof t=="string")return pMt(t,"hints"),t;if(yRe(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let o=t[n];pMt(o,"hints"),r+=o,n!==e-1&&(r+=", ")}return r}throw new GU("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}vMt.exports={isInt32:JBr,isUint32:ZBr,parseFileMode:QBr,validateArray:Pae,validateStringArray:azr,validateBooleanArray:szr,validateAbortSignalArray:uzr,validateBoolean:bMt,validateBuffer:czr,validateDictionary:izr,validateEncoding:dzr,validateFunction:pzr,validateInt32:tzr,validateInteger:ezr,validateNumber:rzr,validateObject:ozr,validateOneOf:nzr,validatePlainFunction:mzr,validatePort:fzr,validateSignalName:lzr,validateString:_Re,validateUint32:yMt,validateUndefined:hzr,validateUnion:gzr,validateAbortSignal:_Mt,validateLinkHeaderValue:bzr}});var vM=x((Z2o,CMt)=>{var lu=CMt.exports={},ww,xw;function vRe(){throw new Error("setTimeout has not been defined")}function wRe(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ww=setTimeout:ww=vRe}catch{ww=vRe}try{typeof clearTimeout=="function"?xw=clearTimeout:xw=wRe}catch{xw=wRe}})();function wMt(t){if(ww===setTimeout)return setTimeout(t,0);if((ww===vRe||!ww)&&setTimeout)return ww=setTimeout,setTimeout(t,0);try{return ww(t,0)}catch{try{return ww.call(null,t,0)}catch{return ww.call(this,t,0)}}}function _zr(t){if(xw===clearTimeout)return clearTimeout(t);if((xw===wRe||!xw)&&clearTimeout)return xw=clearTimeout,clearTimeout(t);try{return xw(t)}catch{try{return xw.call(null,t)}catch{return xw.call(this,t)}}}var pP=[],ZU=!1,ZD,Tae=-1;function vzr(){!ZU||!ZD||(ZU=!1,ZD.length?pP=ZD.concat(pP):Tae=-1,pP.length&&xMt())}function xMt(){if(!ZU){var t=wMt(vzr);ZU=!0;for(var e=pP.length;e;){for(ZD=pP,pP=[];++Tae<e;)ZD&&ZD[Tae].run();Tae=-1,e=pP.length}ZD=null,ZU=!1,_zr(t)}}lu.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];pP.push(new SMt(t,e)),pP.length===1&&!ZU&&wMt(xMt)};function SMt(t,e){this.fun=t,this.array=e}SMt.prototype.run=function(){this.fun.apply(null,this.array)};lu.title="browser";lu.browser=!0;lu.env={};lu.argv=[];lu.version="";lu.versions={};function mP(){}lu.on=mP;lu.addListener=mP;lu.once=mP;lu.off=mP;lu.removeListener=mP;lu.removeAllListeners=mP;lu.emit=mP;lu.prependListener=mP;lu.prependOnceListener=mP;lu.listeners=function(t){return[]};lu.binding=function(t){throw new Error("process.binding is not supported")};lu.cwd=function(){return"/"};lu.chdir=function(t){throw new Error("process.chdir is not supported")};lu.umask=function(){return 0}});var Cw=x((Y2o,$Mt)=>{"use strict";var{SymbolAsyncIterator:OMt,SymbolIterator:EMt,SymbolFor:YD}=ys(),PMt=YD("nodejs.stream.destroyed"),TMt=YD("nodejs.stream.errored"),xRe=YD("nodejs.stream.readable"),SRe=YD("nodejs.stream.writable"),AMt=YD("nodejs.stream.disturbed"),wzr=YD("nodejs.webstream.isClosedPromise"),xzr=YD("nodejs.webstream.controllerErrorFunction");function Aae(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function Iae(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function Szr(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function Sw(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function IMt(t){return!!(t&&!Sw(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function MMt(t){return!!(t&&!Sw(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function RMt(t){return!!(t&&!Sw(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Czr(t){return IMt(t)||MMt(t)||RMt(t)}function Ozr(t,e){return t==null?!1:e===!0?typeof t[OMt]=="function":e===!1?typeof t[EMt]=="function":typeof t[OMt]=="function"||typeof t[EMt]=="function"}function Mae(t){if(!Sw(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[PMt]||n!=null&&n.destroyed)}function NMt(t){if(!Iae(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Ezr(t,e){if(!Iae(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function Pzr(t){if(!Aae(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function jMt(t,e){if(!Aae(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function DMt(t){return t&&t[xRe]!=null?t[xRe]:typeof t?.readable!="boolean"?null:Mae(t)?!1:Aae(t)&&t.readable&&!jMt(t)}function LMt(t){return t&&t[SRe]!=null?t[SRe]:typeof t?.writable!="boolean"?null:Mae(t)?!1:Iae(t)&&t.writable&&!NMt(t)}function Tzr(t,e){return Sw(t)?Mae(t)?!0:!(e?.readable!==!1&&DMt(t)||e?.writable!==!1&&LMt(t)):null}function Azr(t){var e,r;return Sw(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function Izr(t){var e,r;return Sw(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function Mzr(t){if(!Sw(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&FMt(t)?t._closed:null}function FMt(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function kMt(t){return typeof t._sent100=="boolean"&&FMt(t)}function Rzr(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function Nzr(t){if(!Sw(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&kMt(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function jzr(t){var e;return!!(t&&((e=t[AMt])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Dzr(t){var e,r,n,o,i,a,s,u,l,c;return!!(t&&((e=(r=(n=(o=(i=(a=t[TMt])!==null&&a!==void 0?a:t.readableErrored)!==null&&i!==void 0?i:t.writableErrored)!==null&&o!==void 0?o:(s=t._readableState)===null||s===void 0?void 0:s.errorEmitted)!==null&&n!==void 0?n:(u=t._writableState)===null||u===void 0?void 0:u.errorEmitted)!==null&&r!==void 0?r:(l=t._readableState)===null||l===void 0?void 0:l.errored)!==null&&e!==void 0?e:!((c=t._writableState)===null||c===void 0)&&c.errored))}$Mt.exports={isDestroyed:Mae,kIsDestroyed:PMt,isDisturbed:jzr,kIsDisturbed:AMt,isErrored:Dzr,kIsErrored:TMt,isReadable:DMt,kIsReadable:xRe,kIsClosedPromise:wzr,kControllerErrorFunction:xzr,kIsWritable:SRe,isClosed:Mzr,isDuplexNodeStream:Szr,isFinished:Tzr,isIterable:Ozr,isReadableNodeStream:Aae,isReadableStream:IMt,isReadableEnded:Pzr,isReadableFinished:jMt,isReadableErrored:Izr,isNodeStream:Sw,isWebStream:Czr,isWritable:LMt,isWritableNodeStream:Iae,isWritableStream:MMt,isWritableEnded:NMt,isWritableFinished:Ezr,isWritableErrored:Azr,isServerRequest:Rzr,isServerResponse:kMt,willEmitClose:Nzr,isTransformStream:RMt}});var hP=x((X2o,TRe)=>{var wM=vM(),{AbortError:GMt,codes:Lzr}=Hp(),{ERR_INVALID_ARG_TYPE:Fzr,ERR_STREAM_PREMATURE_CLOSE:BMt}=Lzr,{kEmptyObject:ORe,once:ERe}=Gf(),{validateAbortSignal:kzr,validateFunction:$zr,validateObject:Bzr,validateBoolean:zzr}=JU(),{Promise:Uzr,PromisePrototypeThen:qzr,SymbolDispose:JMt}=ys(),{isClosed:Hzr,isReadable:zMt,isReadableNodeStream:CRe,isReadableStream:Vzr,isReadableFinished:UMt,isReadableErrored:qMt,isWritable:HMt,isWritableNodeStream:VMt,isWritableStream:Wzr,isWritableFinished:WMt,isWritableErrored:KMt,isNodeStream:Kzr,willEmitClose:Gzr,kIsClosedPromise:Jzr}=Cw(),YU;function Zzr(t){return t.setHeader&&typeof t.abort=="function"}var PRe=()=>{};function ZMt(t,e,r){var n,o;if(arguments.length===2?(r=e,e=ORe):e==null?e=ORe:Bzr(e,"options"),$zr(r,"callback"),kzr(e.signal,"options.signal"),r=ERe(r),Vzr(t)||Wzr(t))return Yzr(t,e,r);if(!Kzr(t))throw new Fzr("stream",["ReadableStream","WritableStream","Stream"],t);let i=(n=e.readable)!==null&&n!==void 0?n:CRe(t),a=(o=e.writable)!==null&&o!==void 0?o:VMt(t),s=t._writableState,u=t._readableState,l=()=>{t.writable||f()},c=Gzr(t)&&CRe(t)===i&&VMt(t)===a,d=WMt(t,!1),f=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||i))&&(!i||p)&&r.call(t)},p=UMt(t,!1),m=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||a))&&(!a||d)&&r.call(t)},h=C=>{r.call(t,C)},y=Hzr(t),g=()=>{y=!0;let C=KMt(t)||qMt(t);if(C&&typeof C!="boolean")return r.call(t,C);if(i&&!p&&CRe(t,!0)&&!UMt(t,!1))return r.call(t,new BMt);if(a&&!d&&!WMt(t,!1))return r.call(t,new BMt);r.call(t)},_=()=>{y=!0;let C=KMt(t)||qMt(t);if(C&&typeof C!="boolean")return r.call(t,C);r.call(t)},w=()=>{t.req.on("finish",f)};Zzr(t)?(t.on("complete",f),c||t.on("abort",g),t.req?w():t.on("request",w)):a&&!s&&(t.on("end",l),t.on("close",l)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",g),t.on("end",m),t.on("finish",f),e.error!==!1&&t.on("error",h),t.on("close",g),y?wM.nextTick(g):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||wM.nextTick(_):(!i&&(!c||zMt(t))&&(d||HMt(t)===!1)||!a&&(!c||HMt(t))&&(p||zMt(t)===!1)||u&&t.req&&t.aborted)&&wM.nextTick(_);let S=()=>{r=PRe,t.removeListener("aborted",g),t.removeListener("complete",f),t.removeListener("abort",g),t.removeListener("request",w),t.req&&t.req.removeListener("finish",f),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",f),t.removeListener("end",m),t.removeListener("error",h),t.removeListener("close",g)};if(e.signal&&!y){let C=()=>{let E=r;S(),E.call(t,new GMt(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)wM.nextTick(C);else{YU=YU||Gf().addAbortListener;let E=YU(e.signal,C),P=r;r=ERe((...T)=>{E[JMt](),P.apply(t,T)})}}return S}function Yzr(t,e,r){let n=!1,o=PRe;if(e.signal)if(o=()=>{n=!0,r.call(t,new GMt(void 0,{cause:e.signal.reason}))},e.signal.aborted)wM.nextTick(o);else{YU=YU||Gf().addAbortListener;let a=YU(e.signal,o),s=r;r=ERe((...u)=>{a[JMt](),s.apply(t,u)})}let i=(...a)=>{n||wM.nextTick(()=>r.apply(t,a))};return qzr(t[Jzr].promise,i,i),PRe}function Xzr(t,e){var r;let n=!1;return e===null&&(e=ORe),(r=e)!==null&&r!==void 0&&r.cleanup&&(zzr(e.cleanup,"cleanup"),n=e.cleanup),new Uzr((o,i)=>{let a=ZMt(t,e,s=>{n&&a(),s?i(s):o()})})}TRe.exports=ZMt;TRe.exports.finished=Xzr});var XD=x((Q2o,oRt)=>{"use strict";var Ow=vM(),{aggregateTwoErrors:Qzr,codes:{ERR_MULTIPLE_CALLBACK:eUr},AbortError:tUr}=Hp(),{Symbol:QMt}=ys(),{kIsDestroyed:rUr,isDestroyed:nUr,isFinished:oUr,isServerRequest:iUr}=Cw(),eRt=QMt("kDestroy"),ARe=QMt("kConstruct");function tRt(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function aUr(t,e){let r=this._readableState,n=this._writableState,o=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(tRt(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?YMt(this,t,e):this.once(eRt,function(i){YMt(this,Qzr(i,t),e)}),this)}function YMt(t,e,r){let n=!1;function o(i){if(n)return;n=!0;let a=t._readableState,s=t._writableState;tRt(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?Ow.nextTick(sUr,t,i):Ow.nextTick(rRt,t)}try{t._destroy(e||null,o)}catch(i){o(i)}}function sUr(t,e){IRe(t,e),rRt(t)}function rRt(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function IRe(t,e){let r=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function uUr(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function MRe(t,e,r){let n=t._readableState,o=t._writableState;if(o!=null&&o.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||o!=null&&o.autoDestroy?t.destroy(e):e&&(e.stack,o&&!o.errored&&(o.errored=e),n&&!n.errored&&(n.errored=e),r?Ow.nextTick(IRe,t,e):IRe(t,e))}function lUr(t,e){if(typeof t._construct!="function")return;let r=t._readableState,n=t._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),t.once(ARe,e),!(t.listenerCount(ARe)>1)&&Ow.nextTick(cUr,t)}function cUr(t){let e=!1;function r(n){if(e){MRe(t,n??new eUr);return}e=!0;let o=t._readableState,i=t._writableState,a=i||o;o&&(o.constructed=!0),i&&(i.constructed=!0),a.destroyed?t.emit(eRt,n):n?MRe(t,n,!0):Ow.nextTick(dUr,t)}try{t._construct(n=>{Ow.nextTick(r,n)})}catch(n){Ow.nextTick(r,n)}}function dUr(t){t.emit(ARe)}function XMt(t){return t?.setHeader&&typeof t.abort=="function"}function nRt(t){t.emit("close")}function fUr(t,e){t.emit("error",e),Ow.nextTick(nRt,t)}function pUr(t,e){!t||nUr(t)||(!e&&!oUr(t)&&(e=new tUr),iUr(t)?(t.socket=null,t.destroy(e)):XMt(t)?t.abort():XMt(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?Ow.nextTick(fUr,t,e):Ow.nextTick(nRt,t),t.destroyed||(t[rUr]=!0))}oRt.exports={construct:lUr,destroyer:pUr,destroy:aUr,undestroy:uUr,errorOrDestroy:MRe}});var jae=x((e4o,aRt)=>{"use strict";var{ArrayIsArray:mUr,ObjectSetPrototypeOf:iRt}=ys(),{EventEmitter:Rae}=t9();function Nae(t){Rae.call(this,t)}iRt(Nae.prototype,Rae.prototype);iRt(Nae,Rae);Nae.prototype.pipe=function(t,e){let r=this;function n(c){t.writable&&t.write(c)===!1&&r.pause&&r.pause()}r.on("data",n);function o(){r.readable&&r.resume&&r.resume()}t.on("drain",o),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",a),r.on("close",s));let i=!1;function a(){i||(i=!0,t.end())}function s(){i||(i=!0,typeof t.destroy=="function"&&t.destroy())}function u(c){l(),Rae.listenerCount(this,"error")===0&&this.emit("error",c)}RRe(r,"error",u),RRe(t,"error",u);function l(){r.removeListener("data",n),t.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",s),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",l),r.removeListener("close",l),t.removeListener("close",l)}return r.on("end",l),r.on("close",l),t.on("close",l),t.emit("pipe",r),t};function RRe(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):mUr(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}aRt.exports={Stream:Nae,prependListener:RRe}});var r9=x((t4o,Dae)=>{"use strict";var{SymbolDispose:hUr}=ys(),{AbortError:sRt,codes:gUr}=Hp(),{isNodeStream:uRt,isWebStream:yUr,kControllerErrorFunction:bUr}=Cw(),_Ur=hP(),{ERR_INVALID_ARG_TYPE:lRt}=gUr,NRe,vUr=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new lRt(e,"AbortSignal",t)};Dae.exports.addAbortSignal=function(e,r){if(vUr(e,"signal"),!uRt(r)&&!yUr(r))throw new lRt("stream",["ReadableStream","WritableStream","Stream"],r);return Dae.exports.addAbortSignalNoValidate(e,r)};Dae.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=uRt(e)?()=>{e.destroy(new sRt(void 0,{cause:t.reason}))}:()=>{e[bUr](new sRt(void 0,{cause:t.reason}))};if(t.aborted)r();else{NRe=NRe||Gf().addAbortListener;let n=NRe(t,r);_Ur(e,n[hUr])}return e}});var fRt=x((n4o,dRt)=>{"use strict";var{StringPrototypeSlice:cRt,SymbolIterator:wUr,TypedArrayPrototypeSet:Lae,Uint8Array:xUr}=ys(),{Buffer:jRe}=ty(),{inspect:SUr}=Gf();dRt.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,n=""+r.data;for(;(r=r.next)!==null;)n+=e+r.data;return n}concat(e){if(this.length===0)return jRe.alloc(0);let r=jRe.allocUnsafe(e>>>0),n=this.head,o=0;for(;n;)Lae(r,n.data,o),o+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(e<n.length){let o=n.slice(0,e);return this.head.data=n.slice(e),o}return e===n.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[wUr](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",n=this.head,o=0;do{let i=n.data;if(e>i.length)r+=i,e-=i.length;else{e===i.length?(r+=i,++o,n.next?this.head=n.next:this.head=this.tail=null):(r+=cRt(i,0,e),this.head=n,n.data=cRt(i,e));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(e){let r=jRe.allocUnsafe(e),n=e,o=this.head,i=0;do{let a=o.data;if(e>a.length)Lae(r,a,n-e),e-=a.length;else{e===a.length?(Lae(r,a,n-e),++i,o.next?this.head=o.next:this.head=this.tail=null):(Lae(r,new xUr(a.buffer,a.byteOffset,e),n-e),this.head=o,o.data=a.slice(e));break}++i}while((o=o.next)!==null);return this.length-=i,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return SUr(this,{...r,depth:0,customInspect:!1})}}});var n9=x((o4o,gRt)=>{"use strict";var{MathFloor:CUr,NumberIsInteger:OUr}=ys(),{validateInteger:EUr}=JU(),{ERR_INVALID_ARG_VALUE:PUr}=Hp().codes,pRt=16*1024,mRt=16;function TUr(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function hRt(t){return t?mRt:pRt}function AUr(t,e){EUr(e,"value",0),t?mRt=e:pRt=e}function IUr(t,e,r,n){let o=TUr(e,n,r);if(o!=null){if(!OUr(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new PUr(i,o)}return CUr(o)}return hRt(t.objectMode)}gRt.exports={getHighWaterMark:IUr,getDefaultHighWaterMark:hRt,setDefaultHighWaterMark:AUr}});var _Rt=x((DRe,bRt)=>{var Fae=ty(),Ew=Fae.Buffer;function yRt(t,e){for(var r in t)e[r]=t[r]}Ew.from&&Ew.alloc&&Ew.allocUnsafe&&Ew.allocUnsafeSlow?bRt.exports=Fae:(yRt(Fae,DRe),DRe.Buffer=QD);function QD(t,e,r){return Ew(t,e,r)}QD.prototype=Object.create(Ew.prototype);yRt(Ew,QD);QD.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Ew(t,e,r)};QD.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Ew(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};QD.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Ew(t)};QD.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Fae.SlowBuffer(t)}});var xRt=x(wRt=>{"use strict";var FRe=_Rt().Buffer,vRt=FRe.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function MUr(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function RUr(t){var e=MUr(t);if(typeof e!="string"&&(FRe.isEncoding===vRt||!vRt(t)))throw new Error("Unknown encoding: "+t);return e||t}wRt.StringDecoder=o9;function o9(t){this.encoding=RUr(t);var e;switch(this.encoding){case"utf16le":this.text=kUr,this.end=$Ur,e=4;break;case"utf8":this.fillLast=DUr,e=4;break;case"base64":this.text=BUr,this.end=zUr,e=3;break;default:this.write=UUr,this.end=qUr;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=FRe.allocUnsafe(e)}o9.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};o9.prototype.end=FUr;o9.prototype.text=LUr;o9.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function LRe(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function NUr(t,e,r){var n=e.length-1;if(n<r)return 0;var o=LRe(e[n]);return o>=0?(o>0&&(t.lastNeed=o-1),o):--n<r||o===-2?0:(o=LRe(e[n]),o>=0?(o>0&&(t.lastNeed=o-2),o):--n<r||o===-2?0:(o=LRe(e[n]),o>=0?(o>0&&(o===2?o=0:t.lastNeed=o-3),o):0))}function jUr(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function DUr(t){var e=this.lastTotal-this.lastNeed,r=jUr(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function LUr(t,e){var r=NUr(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function FUr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function kUr(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function $Ur(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function BUr(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function zUr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function UUr(t){return t.toString(this.encoding)}function qUr(t){return t&&t.length?this.write(t):""}});var kRe=x((a4o,ERt)=>{"use strict";var SRt=vM(),{PromisePrototypeThen:HUr,SymbolAsyncIterator:CRt,SymbolIterator:ORt}=ys(),{Buffer:VUr}=ty(),{ERR_INVALID_ARG_TYPE:WUr,ERR_STREAM_NULL_VALUES:KUr}=Hp().codes;function GUr(t,e,r){let n;if(typeof e=="string"||e instanceof VUr)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let o;if(e&&e[CRt])o=!0,n=e[CRt]();else if(e&&e[ORt])o=!1,n=e[ORt]();else throw new WUr("iterable",["Iterable"],e);let i=new t({objectMode:!0,highWaterMark:1,...r}),a=!1;i._read=function(){a||(a=!0,u())},i._destroy=function(l,c){HUr(s(l),()=>SRt.nextTick(c,l),d=>SRt.nextTick(c,d||l))};async function s(l){let c=l!=null,d=typeof n.throw=="function";if(c&&d){let{value:f,done:p}=await n.throw(l);if(await f,p)return}if(typeof n.return=="function"){let{value:f}=await n.return();await f}}async function u(){for(;;){try{let{value:l,done:c}=o?await n.next():n.next();if(c)i.push(null);else{let d=l&&typeof l.then=="function"?await l:l;if(d===null)throw a=!1,new KUr;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}ERt.exports=GUr});var a9=x((s4o,HRt)=>{var n_=vM(),{ArrayPrototypeIndexOf:JUr,NumberIsInteger:ZUr,NumberIsNaN:YUr,NumberParseInt:XUr,ObjectDefineProperties:WRe,ObjectKeys:QUr,ObjectSetPrototypeOf:ARt,Promise:IRt,SafeSet:eqr,SymbolAsyncDispose:tqr,SymbolAsyncIterator:rqr,Symbol:nqr}=ys();HRt.exports=In;In.ReadableState=zae;var{EventEmitter:oqr}=t9(),{Stream:xM,prependListener:iqr}=jae(),{Buffer:$Re}=ty(),{addAbortSignal:aqr}=r9(),MRt=hP(),to=Gf().debuglog("stream",t=>{to=t}),sqr=fRt(),eq=XD(),{getHighWaterMark:uqr,getDefaultHighWaterMark:lqr}=n9(),{aggregateTwoErrors:PRt,codes:{ERR_INVALID_ARG_TYPE:cqr,ERR_METHOD_NOT_IMPLEMENTED:dqr,ERR_OUT_OF_RANGE:fqr,ERR_STREAM_PUSH_AFTER_EOF:pqr,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:mqr},AbortError:hqr}=Hp(),{validateObject:gqr}=JU(),eL=nqr("kPaused"),{StringDecoder:RRt}=xRt(),yqr=kRe();ARt(In.prototype,xM.prototype);ARt(In,xM);var BRe=()=>{},{errorOrDestroy:XU}=eq,QU=1,bqr=2,NRt=4,i9=8,jRt=16,kae=32,$ae=64,DRt=128,_qr=256,vqr=512,wqr=1024,HRe=2048,VRe=4096,xqr=8192,Sqr=16384,Cqr=32768,LRt=65536,Oqr=1<<17,Eqr=1<<18;function mc(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}WRe(zae.prototype,{objectMode:mc(QU),ended:mc(bqr),endEmitted:mc(NRt),reading:mc(i9),constructed:mc(jRt),sync:mc(kae),needReadable:mc($ae),emittedReadable:mc(DRt),readableListening:mc(_qr),resumeScheduled:mc(vqr),errorEmitted:mc(wqr),emitClose:mc(HRe),autoDestroy:mc(VRe),destroyed:mc(xqr),closed:mc(Sqr),closeEmitted:mc(Cqr),multiAwaitDrain:mc(LRt),readingMore:mc(Oqr),dataEmitted:mc(Eqr)});function zae(t,e,r){typeof r!="boolean"&&(r=e instanceof Pw()),this.state=HRe|VRe|jRt|kae,t&&t.objectMode&&(this.state|=QU),r&&t&&t.readableObjectMode&&(this.state|=QU),this.highWaterMark=t?uqr(this,t,"readableHighWaterMark",r):lqr(!1),this.buffer=new sqr,this.length=0,this.pipes=[],this.flowing=null,this[eL]=null,t&&t.emitClose===!1&&(this.state&=~HRe),t&&t.autoDestroy===!1&&(this.state&=~VRe),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new RRt(t.encoding),this.encoding=t.encoding)}function In(t){if(!(this instanceof In))return new In(t);let e=this instanceof Pw();this._readableState=new zae(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&aqr(t.signal,this)),xM.call(this,t),eq.construct(this,()=>{this._readableState.needReadable&&Bae(this,this._readableState)})}In.prototype.destroy=eq.destroy;In.prototype._undestroy=eq.undestroy;In.prototype._destroy=function(t,e){e(t)};In.prototype[oqr.captureRejectionSymbol]=function(t){this.destroy(t)};In.prototype[tqr]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new hqr,this.destroy(t)),new IRt((e,r)=>MRt(this,n=>n&&n!==t?r(n):e(null)))};In.prototype.push=function(t,e){return FRt(this,t,e,!1)};In.prototype.unshift=function(t,e){return FRt(this,t,e,!0)};function FRt(t,e,r,n){to("readableAddChunk",e);let o=t._readableState,i;if((o.state&QU)===0&&(typeof e=="string"?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?e=$Re.from(e,r).toString(o.encoding):(e=$Re.from(e,r),r=""))):e instanceof $Re?r="":xM._isUint8Array(e)?(e=xM._uint8ArrayToBuffer(e),r=""):e!=null&&(i=new cqr("chunk",["string","Buffer","Uint8Array"],e))),i)XU(t,i);else if(e===null)o.state&=~i9,Aqr(t,o);else if((o.state&QU)!==0||e&&e.length>0)if(n)if((o.state&NRt)!==0)XU(t,new mqr);else{if(o.destroyed||o.errored)return!1;zRe(t,o,e,!0)}else if(o.ended)XU(t,new pqr);else{if(o.destroyed||o.errored)return!1;o.state&=~i9,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?zRe(t,o,e,!1):Bae(t,o)):zRe(t,o,e,!1)}else n||(o.state&=~i9,Bae(t,o));return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function zRe(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&LRt)!==0?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),(e.state&$ae)!==0&&Uae(t)),Bae(t,e)}In.prototype.isPaused=function(){let t=this._readableState;return t[eL]===!0||t.flowing===!1};In.prototype.setEncoding=function(t){let e=new RRt(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,n="";for(let o of r)n+=e.write(o);return r.clear(),n!==""&&r.push(n),this._readableState.length=n.length,this};var Pqr=1073741824;function Tqr(t){if(t>Pqr)throw new fqr("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function TRt(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&QU)!==0?1:YUr(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}In.prototype.read=function(t){to("read",t),t===void 0?t=NaN:ZUr(t)||(t=XUr(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=Tqr(t)),t!==0&&(e.state&=~DRt),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return to("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?URe(this):Uae(this),null;if(t=TRt(t,e),t===0&&e.ended)return e.length===0&&URe(this),null;let n=(e.state&$ae)!==0;if(to("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,to("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,to("reading, ended or constructing",n);else if(n){to("do read"),e.state|=i9|kae,e.length===0&&(e.state|=$ae);try{this._read(e.highWaterMark)}catch(i){XU(this,i)}e.state&=~kae,e.reading||(t=TRt(r,e))}let o;return t>0?o=URt(t,e):o=null,o===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&URe(this)),o!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",o)),o};function Aqr(t,e){if(to("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?Uae(t):(e.needReadable=!1,e.emittedReadable=!0,kRt(t))}}function Uae(t){let e=t._readableState;to("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(to("emitReadable",e.flowing),e.emittedReadable=!0,n_.nextTick(kRt,t))}function kRt(t){let e=t._readableState;to("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,BRt(t)}function Bae(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,n_.nextTick(Iqr,t,e))}function Iqr(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(to("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}In.prototype._read=function(t){throw new dqr("_read()")};In.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new eqr(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),to("pipe count=%d opts=%j",n.pipes.length,e);let i=(!e||e.end!==!1)&&t!==n_.stdout&&t!==n_.stderr?s:y;n.endEmitted?n_.nextTick(i):r.once("end",i),t.on("unpipe",a);function a(g,_){to("onunpipe"),g===r&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,c())}function s(){to("onend"),t.end()}let u,l=!1;function c(){to("cleanup"),t.removeListener("close",m),t.removeListener("finish",h),u&&t.removeListener("drain",u),t.removeListener("error",p),t.removeListener("unpipe",a),r.removeListener("end",s),r.removeListener("end",y),r.removeListener("data",f),l=!0,u&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&u()}function d(){l||(n.pipes.length===1&&n.pipes[0]===t?(to("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(to("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=Mqr(r,t),t.on("drain",u))}r.on("data",f);function f(g){to("ondata");let _=t.write(g);to("dest.write",_),_===!1&&d()}function p(g){if(to("onerror",g),y(),t.removeListener("error",p),t.listenerCount("error")===0){let _=t._writableState||t._readableState;_&&!_.errorEmitted?XU(t,g):t.emit("error",g)}}iqr(t,"error",p);function m(){t.removeListener("finish",h),y()}t.once("close",m);function h(){to("onfinish"),t.removeListener("close",m),y()}t.once("finish",h);function y(){to("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?d():n.flowing||(to("pipe resume"),r.resume()),t};function Mqr(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(to("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(to("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}In.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let o=e.pipes;e.pipes=[],this.pause();for(let i=0;i<o.length;i++)o[i].emit("unpipe",this,{hasUnpiped:!1});return this}let n=JUr(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};In.prototype.on=function(t,e){let r=xM.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,to("on readable",n.length,n.reading),n.length?Uae(this):n.reading||n_.nextTick(Rqr,this)),r};In.prototype.addListener=In.prototype.on;In.prototype.removeListener=function(t,e){let r=xM.prototype.removeListener.call(this,t,e);return t==="readable"&&n_.nextTick($Rt,this),r};In.prototype.off=In.prototype.removeListener;In.prototype.removeAllListeners=function(t){let e=xM.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&n_.nextTick($Rt,this),e};function $Rt(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[eL]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function Rqr(t){to("readable nexttick read 0"),t.read(0)}In.prototype.resume=function(){let t=this._readableState;return t.flowing||(to("resume"),t.flowing=!t.readableListening,Nqr(this,t)),t[eL]=!1,this};function Nqr(t,e){e.resumeScheduled||(e.resumeScheduled=!0,n_.nextTick(jqr,t,e))}function jqr(t,e){to("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),BRt(t),e.flowing&&!e.reading&&t.read(0)}In.prototype.pause=function(){return to("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(to("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[eL]=!0,this};function BRt(t){let e=t._readableState;for(to("flow",e.flowing);e.flowing&&t.read()!==null;);}In.prototype.wrap=function(t){let e=!1;t.on("data",n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",n=>{XU(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=QUr(t);for(let n=1;n<r.length;n++){let o=r[n];this[o]===void 0&&typeof t[o]=="function"&&(this[o]=t[o].bind(t))}return this};In.prototype[rqr]=function(){return zRt(this)};In.prototype.iterator=function(t){return t!==void 0&&gqr(t,"options"),zRt(this,t)};function zRt(t,e){typeof t.read!="function"&&(t=In.wrap(t,{objectMode:!0}));let r=Dqr(t,e);return r.stream=t,r}async function*Dqr(t,e){let r=BRe;function n(a){this===t?(r(),r=BRe):r=a}t.on("readable",n);let o,i=MRt(t,{writable:!1},a=>{o=a?PRt(o,a):null,r(),r=BRe});try{for(;;){let a=t.destroyed?null:t.read();if(a!==null)yield a;else{if(o)throw o;if(o===null)return;await new IRt(n)}}}catch(a){throw o=PRt(o,a),o}finally{(o||e?.destroyOnReturn!==!1)&&(o===void 0||t._readableState.autoDestroy)?eq.destroyer(t,null):(t.off("readable",n),i())}}WRe(In.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});WRe(zae.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[eL]!==!1},set(t){this[eL]=!!t}}});In._fromList=URt;function URt(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function URe(t){let e=t._readableState;to("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,n_.nextTick(Lqr,e,t))}function Lqr(t,e){if(to("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)n_.nextTick(Fqr,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function Fqr(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}In.from=function(t,e){return yqr(In,t,e)};var qRe;function qRt(){return qRe===void 0&&(qRe={}),qRe}In.fromWeb=function(t,e){return qRt().newStreamReadableFromReadableStream(t,e)};In.toWeb=function(t,e){return qRt().newReadableStreamFromStreamReadable(t,e)};In.wrap=function(t,e){var r,n;return new In({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(o,i){eq.destroyer(t,o),i(o)}}).wrap(t)}});var Kae=x((u4o,r1t)=>{var tL=vM(),{ArrayPrototypeSlice:KRt,Error:kqr,FunctionPrototypeSymbolHasInstance:GRt,ObjectDefineProperty:JRt,ObjectDefineProperties:$qr,ObjectSetPrototypeOf:ZRt,StringPrototypeToLowerCase:Bqr,Symbol:zqr,SymbolHasInstance:Uqr}=ys();r1t.exports=bs;bs.WritableState=l9;var{EventEmitter:qqr}=t9(),s9=jae().Stream,{Buffer:qae}=ty(),Wae=XD(),{addAbortSignal:Hqr}=r9(),{getHighWaterMark:Vqr,getDefaultHighWaterMark:Wqr}=n9(),{ERR_INVALID_ARG_TYPE:Kqr,ERR_METHOD_NOT_IMPLEMENTED:Gqr,ERR_MULTIPLE_CALLBACK:YRt,ERR_STREAM_CANNOT_PIPE:Jqr,ERR_STREAM_DESTROYED:u9,ERR_STREAM_ALREADY_FINISHED:Zqr,ERR_STREAM_NULL_VALUES:Yqr,ERR_STREAM_WRITE_AFTER_END:Xqr,ERR_UNKNOWN_ENCODING:XRt}=Hp().codes,{errorOrDestroy:tq}=Wae;ZRt(bs.prototype,s9.prototype);ZRt(bs,s9);function JRe(){}var rq=zqr("kOnFinished");function l9(t,e,r){typeof r!="boolean"&&(r=e instanceof Pw()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?Vqr(this,t,"writableHighWaterMark",r):Wqr(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(t&&t.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=e2r.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Vae(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[rq]=[]}function Vae(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}l9.prototype.getBuffer=function(){return KRt(this.buffered,this.bufferedIndex)};JRt(l9.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function bs(t){let e=this instanceof Pw();if(!e&&!GRt(bs,this))return new bs(t);this._writableState=new l9(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&Hqr(t.signal,this)),s9.call(this,t),Wae.construct(this,()=>{let r=this._writableState;r.writing||YRe(this,r),XRe(this,r)})}JRt(bs,Uqr,{__proto__:null,value:function(t){return GRt(this,t)?!0:this!==bs?!1:t&&t._writableState instanceof l9}});bs.prototype.pipe=function(){tq(this,new Jqr)};function QRt(t,e,r,n){let o=t._writableState;if(typeof r=="function")n=r,r=o.defaultEncoding;else{if(!r)r=o.defaultEncoding;else if(r!=="buffer"&&!qae.isEncoding(r))throw new XRt(r);typeof n!="function"&&(n=JRe)}if(e===null)throw new Yqr;if(!o.objectMode)if(typeof e=="string")o.decodeStrings!==!1&&(e=qae.from(e,r),r="buffer");else if(e instanceof qae)r="buffer";else if(s9._isUint8Array(e))e=s9._uint8ArrayToBuffer(e),r="buffer";else throw new Kqr("chunk",["string","Buffer","Uint8Array"],e);let i;return o.ending?i=new Xqr:o.destroyed&&(i=new u9("write")),i?(tL.nextTick(n,i),tq(t,i,!0),i):(o.pendingcb++,Qqr(t,o,e,r,n))}bs.prototype.write=function(t,e,r){return QRt(this,t,e,r)===!0};bs.prototype.cork=function(){this._writableState.corked++};bs.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||YRe(this,t))};bs.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=Bqr(e)),!qae.isEncoding(e))throw new XRt(e);return this._writableState.defaultEncoding=e,this};function Qqr(t,e,r,n,o){let i=e.objectMode?1:r.length;e.length+=i;let a=e.length<e.highWaterMark;return a||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:n,callback:o}),e.allBuffers&&n!=="buffer"&&(e.allBuffers=!1),e.allNoop&&o!==JRe&&(e.allNoop=!1)):(e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,t._write(r,n,e.onwrite),e.sync=!1),a&&!e.errored&&!e.destroyed}function VRt(t,e,r,n,o,i,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new u9("write")):r?t._writev(o,e.onwrite):t._write(o,i,e.onwrite),e.sync=!1}function WRt(t,e,r,n){--e.pendingcb,n(r),ZRe(e),tq(t,r)}function e2r(t,e){let r=t._writableState,n=r.sync,o=r.writecb;if(typeof o!="function"){tq(t,new YRt);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),n?tL.nextTick(WRt,t,r,e,o):WRt(t,r,e,o)):(r.buffered.length>r.bufferedIndex&&YRe(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:t,state:r},tL.nextTick(t2r,r.afterWriteTickInfo)):e1t(t,r,1,o))}function t2r({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,e1t(t,e,r,n)}function e1t(t,e,r,n){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,n();e.destroyed&&ZRe(e),XRe(t,e)}function ZRe(t){if(t.writing)return;for(let o=t.bufferedIndex;o<t.buffered.length;++o){var e;let{chunk:i,callback:a}=t.buffered[o],s=t.objectMode?1:i.length;t.length-=s,a((e=t.errored)!==null&&e!==void 0?e:new u9("write"))}let r=t[rq].splice(0);for(let o=0;o<r.length;o++){var n;r[o]((n=t.errored)!==null&&n!==void 0?n:new u9("end"))}Vae(t)}function YRe(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:n,objectMode:o}=e,i=r.length-n;if(!i)return;let a=n;if(e.bufferProcessing=!0,i>1&&t._writev){e.pendingcb-=i-1;let s=e.allNoop?JRe:l=>{for(let c=a;c<r.length;++c)r[c].callback(l)},u=e.allNoop&&a===0?r:KRt(r,a);u.allBuffers=e.allBuffers,VRt(t,e,!0,e.length,u,"",s),Vae(e)}else{do{let{chunk:s,encoding:u,callback:l}=r[a];r[a++]=null;let c=o?1:s.length;VRt(t,e,!1,c,s,u,l)}while(a<r.length&&!e.writing);a===r.length?Vae(e):a>256?(r.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}bs.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new Gqr("_write()")};bs.prototype._writev=null;bs.prototype.end=function(t,e,r){let n=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let o;if(t!=null){let i=QRt(this,t,e);i instanceof kqr&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,XRe(this,n,!0),n.ended=!0):n.finished?o=new Zqr("end"):n.destroyed&&(o=new u9("end"))),typeof r=="function"&&(o||n.finished?tL.nextTick(r,o):n[rq].push(r)),this};function Hae(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function r2r(t,e){let r=!1;function n(o){if(r){tq(t,o??YRt());return}if(r=!0,e.pendingcb--,o){let i=e[rq].splice(0);for(let a=0;a<i.length;a++)i[a](o);tq(t,o,e.sync)}else Hae(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,tL.nextTick(GRe,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(o){n(o)}e.sync=!1}function n2r(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,r2r(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function XRe(t,e,r){Hae(e)&&(n2r(t,e),e.pendingcb===0&&(r?(e.pendingcb++,tL.nextTick((n,o)=>{Hae(o)?GRe(n,o):o.pendingcb--},t,e)):Hae(e)&&(e.pendingcb++,GRe(t,e))))}function GRe(t,e){e.pendingcb--,e.finished=!0;let r=e[rq].splice(0);for(let n=0;n<r.length;n++)r[n]();if(t.emit("finish"),e.autoDestroy){let n=t._readableState;(!n||n.autoDestroy&&(n.endEmitted||n.readable===!1))&&t.destroy()}}$qr(bs.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var o2r=Wae.destroy;bs.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[rq].length)&&tL.nextTick(ZRe,r),o2r.call(this,t,e),this};bs.prototype._undestroy=Wae.undestroy;bs.prototype._destroy=function(t,e){e(t)};bs.prototype[qqr.captureRejectionSymbol]=function(t){this.destroy(t)};var KRe;function t1t(){return KRe===void 0&&(KRe={}),KRe}bs.fromWeb=function(t,e){return t1t().newStreamWritableFromWritableStream(t,e)};bs.toWeb=function(t){return t1t().newWritableStreamFromStreamWritable(t)}});var y1t=x((l4o,g1t)=>{var QRe=vM(),i2r=ty(),{isReadable:a2r,isWritable:s2r,isIterable:n1t,isNodeStream:u2r,isReadableNodeStream:o1t,isWritableNodeStream:i1t,isDuplexNodeStream:l2r,isReadableStream:a1t,isWritableStream:s1t}=Cw(),u1t=hP(),{AbortError:m1t,codes:{ERR_INVALID_ARG_TYPE:c2r,ERR_INVALID_RETURN_VALUE:l1t}}=Hp(),{destroyer:oq}=XD(),d2r=Pw(),h1t=a9(),f2r=Kae(),{createDeferredPromise:c1t}=Gf(),d1t=kRe(),f1t=globalThis.Blob||i2r.Blob,p2r=typeof f1t<"u"?function(e){return e instanceof f1t}:function(e){return!1},m2r=globalThis.AbortController||WU().AbortController,{FunctionPrototypeCall:p1t}=ys(),SM=class extends d2r{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};g1t.exports=function t(e,r){if(l2r(e))return e;if(o1t(e))return nq({readable:e});if(i1t(e))return nq({writable:e});if(u2r(e))return nq({writable:!1,readable:!1});if(a1t(e))return nq({readable:h1t.fromWeb(e)});if(s1t(e))return nq({writable:f2r.fromWeb(e)});if(typeof e=="function"){let{value:o,write:i,final:a,destroy:s}=h2r(e);if(n1t(o))return d1t(SM,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=p1t(u,o,d=>{if(d!=null)throw new l1t("nully","body",d)},d=>{oq(l,d)});return l=new SM({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,QRe.nextTick(d,null)}catch(f){QRe.nextTick(d,f)}})},destroy:s})}throw new l1t("Iterable, AsyncIterable or AsyncFunction",r,o)}if(p2r(e))return t(e.arrayBuffer());if(n1t(e))return d1t(SM,e,{objectMode:!0,writable:!1});if(a1t(e?.readable)&&s1t(e?.writable))return SM.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let o=e!=null&&e.readable?o1t(e?.readable)?e?.readable:t(e.readable):void 0,i=e!=null&&e.writable?i1t(e?.writable)?e?.writable:t(e.writable):void 0;return nq({readable:o,writable:i})}let n=e?.then;if(typeof n=="function"){let o;return p1t(n,e,i=>{i!=null&&o.push(i),o.push(null)},i=>{oq(o,i)}),o=new SM({objectMode:!0,writable:!1,read(){}})}throw new c2r(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function h2r(t){let{promise:e,resolve:r}=c1t(),n=new m2r,o=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:s,done:u,cb:l}=await a;if(QRe.nextTick(l),u)return;if(o.aborted)throw new m1t(void 0,{cause:o.reason});({promise:e,resolve:r}=c1t()),yield s}}(),{signal:o}),write(a,s,u){let l=r;r=null,l({chunk:a,done:!1,cb:u})},final(a){let s=r;r=null,s({done:!0,cb:a})},destroy(a,s){n.abort(),s(a)}}}function nq(t){let e=t.readable&&typeof t.readable.read!="function"?h1t.wrap(t.readable):t.readable,r=t.writable,n=!!a2r(e),o=!!s2r(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new SM({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(u1t(r,d=>{o=!1,d&&oq(e,d),c(d)}),l._write=function(d,f,p){r.write(d,f)?p():i=p},l._final=function(d){r.end(),a=d},r.on("drain",function(){if(i){let d=i;i=null,d()}}),r.on("finish",function(){if(a){let d=a;a=null,d()}})),n&&(u1t(e,d=>{n=!1,d&&oq(e,d),c(d)}),e.on("readable",function(){if(s){let d=s;s=null,d()}}),e.on("end",function(){l.push(null)}),l._read=function(){for(;;){let d=e.read();if(d===null){s=l._read;return}if(!l.push(d))return}}),l._destroy=function(d,f){!d&&u!==null&&(d=new m1t),s=null,i=null,a=null,u===null?f(d):(u=f,oq(r,d),oq(e,d))},l}});var Pw=x((c4o,v1t)=>{"use strict";var{ObjectDefineProperties:g2r,ObjectGetOwnPropertyDescriptor:gP,ObjectKeys:y2r,ObjectSetPrototypeOf:b1t}=ys();v1t.exports=o_;var r1e=a9(),Cy=Kae();b1t(o_.prototype,r1e.prototype);b1t(o_,r1e);{let t=y2r(Cy.prototype);for(let e=0;e<t.length;e++){let r=t[e];o_.prototype[r]||(o_.prototype[r]=Cy.prototype[r])}}function o_(t){if(!(this instanceof o_))return new o_(t);r1e.call(this,t),Cy.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}g2r(o_.prototype,{writable:{__proto__:null,...gP(Cy.prototype,"writable")},writableHighWaterMark:{__proto__:null,...gP(Cy.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...gP(Cy.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...gP(Cy.prototype,"writableBuffer")},writableLength:{__proto__:null,...gP(Cy.prototype,"writableLength")},writableFinished:{__proto__:null,...gP(Cy.prototype,"writableFinished")},writableCorked:{__proto__:null,...gP(Cy.prototype,"writableCorked")},writableEnded:{__proto__:null,...gP(Cy.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...gP(Cy.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var e1e;function _1t(){return e1e===void 0&&(e1e={}),e1e}o_.fromWeb=function(t,e){return _1t().newStreamDuplexFromReadableWritablePair(t,e)};o_.toWeb=function(t){return _1t().newReadableWritablePairFromDuplex(t)};var t1e;o_.from=function(t){return t1e||(t1e=y1t()),t1e(t,"body")}});var i1e=x((d4o,x1t)=>{"use strict";var{ObjectSetPrototypeOf:w1t,Symbol:b2r}=ys();x1t.exports=yP;var{ERR_METHOD_NOT_IMPLEMENTED:_2r}=Hp().codes,o1e=Pw(),{getHighWaterMark:v2r}=n9();w1t(yP.prototype,o1e.prototype);w1t(yP,o1e);var c9=b2r("kCallback");function yP(t){if(!(this instanceof yP))return new yP(t);let e=t?v2r(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),o1e.call(this,t),this._readableState.sync=!1,this[c9]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",w2r)}function n1e(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function w2r(){this._final!==n1e&&n1e.call(this)}yP.prototype._final=n1e;yP.prototype._transform=function(t,e,r){throw new _2r("_transform()")};yP.prototype._write=function(t,e,r){let n=this._readableState,o=this._writableState,i=n.length;this._transform(t,e,(a,s)=>{if(a){r(a);return}s!=null&&this.push(s),o.ended||i===n.length||n.length<n.highWaterMark?r():this[c9]=r})};yP.prototype._read=function(){if(this[c9]){let t=this[c9];this[c9]=null,t()}}});var s1e=x((f4o,C1t)=>{"use strict";var{ObjectSetPrototypeOf:S1t}=ys();C1t.exports=iq;var a1e=i1e();S1t(iq.prototype,a1e.prototype);S1t(iq,a1e);function iq(t){if(!(this instanceof iq))return new iq(t);a1e.call(this,t)}iq.prototype._transform=function(t,e,r){r(null,t)}});var Yae=x((p4o,A1t)=>{var d9=vM(),{ArrayIsArray:x2r,Promise:S2r,SymbolAsyncIterator:C2r,SymbolDispose:O2r}=ys(),Zae=hP(),{once:E2r}=Gf(),P2r=XD(),O1t=Pw(),{aggregateTwoErrors:T2r,codes:{ERR_INVALID_ARG_TYPE:g1e,ERR_INVALID_RETURN_VALUE:u1e,ERR_MISSING_ARGS:A2r,ERR_STREAM_DESTROYED:I2r,ERR_STREAM_PREMATURE_CLOSE:M2r},AbortError:R2r}=Hp(),{validateFunction:N2r,validateAbortSignal:j2r}=JU(),{isIterable:rL,isReadable:l1e,isReadableNodeStream:Jae,isNodeStream:E1t,isTransformStream:aq,isWebStream:D2r,isReadableStream:c1e,isReadableFinished:L2r}=Cw(),F2r=globalThis.AbortController||WU().AbortController,d1e,f1e,p1e;function P1t(t,e,r){let n=!1;t.on("close",()=>{n=!0});let o=Zae(t,{readable:e,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,P2r.destroyer(t,i||new I2r("pipe")))},cleanup:o}}function k2r(t){return N2r(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function m1e(t){if(rL(t))return t;if(Jae(t))return $2r(t);throw new g1e("val",["Readable","Iterable","AsyncIterable"],t)}async function*$2r(t){f1e||(f1e=a9()),yield*f1e.prototype[C2r].call(t)}async function Gae(t,e,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new S2r((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});e.on("drain",a);let u=Zae(e,{readable:!1},a);try{e.writableNeedDrain&&await s();for await(let l of t)e.write(l)||await s();n&&(e.end(),await s()),r()}catch(l){r(o!==l?T2r(o,l):l)}finally{u(),e.off("drain",a)}}async function h1e(t,e,r,{end:n}){aq(e)&&(e=e.writable);let o=e.getWriter();try{for await(let i of t)await o.ready,o.write(i).catch(()=>{});await o.ready,n&&await o.close(),r()}catch(i){try{await o.abort(i),r(i)}catch(a){r(a)}}}function B2r(...t){return T1t(t,E2r(k2r(t)))}function T1t(t,e,r){if(t.length===1&&x2r(t[0])&&(t=t[0]),t.length<2)throw new A2r("streams");let n=new F2r,o=n.signal,i=r?.signal,a=[];j2r(i,"options.signal");function s(){m(new R2r)}p1e=p1e||Gf().addAbortListener;let u;i&&(u=p1e(i,s));let l,c,d=[],f=0;function p(w){m(w,--f===0)}function m(w,S){var C;if(w&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=w),!(!l&&!S)){for(;d.length;)d.shift()(l);(C=u)===null||C===void 0||C[O2r](),n.abort(),S&&(l||a.forEach(E=>E()),d9.nextTick(e,l,c))}}let h;for(let w=0;w<t.length;w++){let S=t[w],C=w<t.length-1,E=w>0,P=C||r?.end!==!1,T=w===t.length-1;if(E1t(S)){let I=function(N){N&&N.name!=="AbortError"&&N.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(N)};var _=I;if(P){let{destroy:N,cleanup:M}=P1t(S,C,E);d.push(N),l1e(S)&&T&&a.push(M)}S.on("error",I),l1e(S)&&T&&a.push(()=>{S.removeListener("error",I)})}if(w===0)if(typeof S=="function"){if(h=S({signal:o}),!rL(h))throw new u1e("Iterable, AsyncIterable or Stream","source",h)}else rL(S)||Jae(S)||aq(S)?h=S:h=O1t.from(S);else if(typeof S=="function"){if(aq(h)){var y;h=m1e((y=h)===null||y===void 0?void 0:y.readable)}else h=m1e(h);if(h=S(h,{signal:o}),C){if(!rL(h,!0))throw new u1e("AsyncIterable",`transform[${w-1}]`,h)}else{var g;d1e||(d1e=s1e());let I=new d1e({objectMode:!0}),N=(g=h)===null||g===void 0?void 0:g.then;if(typeof N=="function")f++,N.call(h,k=>{c=k,k!=null&&I.write(k),P&&I.end(),d9.nextTick(p)},k=>{I.destroy(k),d9.nextTick(p,k)});else if(rL(h,!0))f++,Gae(h,I,p,{end:P});else if(c1e(h)||aq(h)){let k=h.readable||h;f++,Gae(k,I,p,{end:P})}else throw new u1e("AsyncIterable or Promise","destination",h);h=I;let{destroy:M,cleanup:D}=P1t(h,!1,!0);d.push(M),T&&a.push(D)}}else if(E1t(S)){if(Jae(h)){f+=2;let I=z2r(h,S,p,{end:P});l1e(S)&&T&&a.push(I)}else if(aq(h)||c1e(h)){let I=h.readable||h;f++,Gae(I,S,p,{end:P})}else if(rL(h))f++,Gae(h,S,p,{end:P});else throw new g1e("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=S}else if(D2r(S)){if(Jae(h))f++,h1e(m1e(h),S,p,{end:P});else if(c1e(h)||rL(h))f++,h1e(h,S,p,{end:P});else if(aq(h))f++,h1e(h.readable,S,p,{end:P});else throw new g1e("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=S}else h=O1t.from(S)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&d9.nextTick(s),h}function z2r(t,e,r,{end:n}){let o=!1;if(e.on("close",()=>{o||r(new M2r)}),t.pipe(e,{end:!1}),n){let a=function(){o=!0,e.end()};var i=a;L2r(t)?d9.nextTick(a):t.once("end",a)}else r();return Zae(t,{readable:!0,writable:!1},a=>{let s=t._readableState;a&&a.code==="ERR_STREAM_PREMATURE_CLOSE"&&s&&s.ended&&!s.errored&&!s.errorEmitted?t.once("end",r).once("error",r):r(a)}),Zae(e,{readable:!1,writable:!0},r)}A1t.exports={pipelineImpl:T1t,pipeline:B2r}});var b1e=x((m4o,D1t)=>{"use strict";var{pipeline:U2r}=Yae(),Xae=Pw(),{destroyer:q2r}=XD(),{isNodeStream:Qae,isReadable:I1t,isWritable:M1t,isWebStream:y1e,isTransformStream:nL,isWritableStream:R1t,isReadableStream:N1t}=Cw(),{AbortError:H2r,codes:{ERR_INVALID_ARG_VALUE:j1t,ERR_MISSING_ARGS:V2r}}=Hp(),W2r=hP();D1t.exports=function(...e){if(e.length===0)throw new V2r("streams");if(e.length===1)return Xae.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=Xae.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=Xae.from(e[p])}for(let p=0;p<e.length;++p)if(!(!Qae(e[p])&&!y1e(e[p]))){if(p<e.length-1&&!(I1t(e[p])||N1t(e[p])||nL(e[p])))throw new j1t(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(M1t(e[p])||R1t(e[p])||nL(e[p])))throw new j1t(`streams[${p}]`,r[p],"must be writable")}let n,o,i,a,s;function u(p){let m=a;a=null,m?m(p):p?s.destroy(p):!f&&!d&&s.destroy()}let l=e[0],c=U2r(e,u),d=!!(M1t(l)||R1t(l)||nL(l)),f=!!(I1t(c)||N1t(c)||nL(c));if(s=new Xae({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(Qae(l))s._write=function(m,h,y){l.write(m,h)?y():n=y},s._final=function(m){l.end(),o=m},l.on("drain",function(){if(n){let m=n;n=null,m()}});else if(y1e(l)){let h=(nL(l)?l.writable:l).getWriter();s._write=async function(y,g,_){try{await h.ready,h.write(y).catch(()=>{}),_()}catch(w){_(w)}},s._final=async function(y){try{await h.ready,h.close().catch(()=>{}),o=y}catch(g){y(g)}}}let p=nL(c)?c.readable:c;W2r(p,()=>{if(o){let m=o;o=null,m()}})}if(f){if(Qae(c))c.on("readable",function(){if(i){let p=i;i=null,p()}}),c.on("end",function(){s.push(null)}),s._read=function(){for(;;){let p=c.read();if(p===null){i=s._read;return}if(!s.push(p))return}};else if(y1e(c)){let m=(nL(c)?c.readable:c).getReader();s._read=async function(){for(;;)try{let{value:h,done:y}=await m.read();if(!s.push(h))return;if(y){s.push(null);return}}catch{return}}}}return s._destroy=function(p,m){!p&&a!==null&&(p=new H2r),i=null,n=null,o=null,a===null?m(p):(a=m,Qae(c)&&q2r(c,p))},s}});var V1t=x((h4o,w1e)=>{"use strict";var K2r=globalThis.AbortController||WU().AbortController,{codes:{ERR_INVALID_ARG_VALUE:G2r,ERR_INVALID_ARG_TYPE:f9,ERR_MISSING_ARGS:J2r,ERR_OUT_OF_RANGE:Z2r},AbortError:Tw}=Hp(),{validateAbortSignal:oL,validateInteger:L1t,validateObject:iL}=JU(),Y2r=ys().Symbol("kWeak"),X2r=ys().Symbol("kResistStopPropagation"),{finished:Q2r}=hP(),e4r=b1e(),{addAbortSignalNoValidate:t4r}=r9(),{isWritable:r4r,isNodeStream:n4r}=Cw(),{deprecate:o4r}=Gf(),{ArrayPrototypePush:i4r,Boolean:a4r,MathFloor:F1t,Number:s4r,NumberIsNaN:u4r,Promise:k1t,PromiseReject:$1t,PromiseResolve:l4r,PromisePrototypeThen:B1t,Symbol:U1t}=ys(),ese=U1t("kEmpty"),z1t=U1t("kEof");function c4r(t,e){if(e!=null&&iL(e,"options"),e?.signal!=null&&oL(e.signal,"options.signal"),n4r(t)&&!r4r(t))throw new G2r("stream",t,"must be writable");let r=e4r(this,t);return e!=null&&e.signal&&t4r(e.signal,r),r}function tse(t,e){if(typeof t!="function")throw new f9("fn",["Function","AsyncFunction"],t);e!=null&&iL(e,"options"),e?.signal!=null&&oL(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=F1t(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=F1t(e.highWaterMark)),L1t(r,"options.concurrency",1),L1t(n,"options.highWaterMark",0),n+=r,async function*(){let i=Gf().AbortSignalAny([e?.signal].filter(a4r)),a=this,s=[],u={signal:i},l,c,d=!1,f=0;function p(){d=!0,m()}function m(){f-=1,h()}function h(){c&&!d&&f<r&&s.length<n&&(c(),c=null)}async function y(){try{for await(let g of a){if(d)return;if(i.aborted)throw new Tw;try{if(g=t(g,u),g===ese)continue;g=l4r(g)}catch(_){g=$1t(_)}f+=1,B1t(g,m,p),s.push(g),l&&(l(),l=null),!d&&(s.length>=n||f>=r)&&await new k1t(_=>{c=_})}s.push(z1t)}catch(g){let _=$1t(g);B1t(_,m,p),s.push(_)}finally{d=!0,l&&(l(),l=null)}}y();try{for(;;){for(;s.length>0;){let g=await s[0];if(g===z1t)return;if(i.aborted)throw new Tw;g!==ese&&(yield g),s.shift(),h()}await new k1t(g=>{l=g})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function d4r(t=void 0){return t!=null&&iL(t,"options"),t?.signal!=null&&oL(t.signal,"options.signal"),async function*(){let r=0;for await(let o of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new Tw({cause:t.signal.reason});yield[r++,o]}}.call(this)}async function q1t(t,e=void 0){for await(let r of v1e.call(this,t,e))return!0;return!1}async function f4r(t,e=void 0){if(typeof t!="function")throw new f9("fn",["Function","AsyncFunction"],t);return!await q1t.call(this,async(...r)=>!await t(...r),e)}async function p4r(t,e){for await(let r of v1e.call(this,t,e))return r}async function m4r(t,e){if(typeof t!="function")throw new f9("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o),ese}for await(let n of tse.call(this,r,e));}function v1e(t,e){if(typeof t!="function")throw new f9("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o)?n:ese}return tse.call(this,r,e)}var _1e=class extends J2r{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function h4r(t,e,r){var n;if(typeof t!="function")throw new f9("reducer",["Function","AsyncFunction"],t);r!=null&&iL(r,"options"),r?.signal!=null&&oL(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new Tw(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await Q2r(this.destroy(l)),l}let i=new K2r,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[Y2r]:this,[X2r]:!0};r.signal.addEventListener("abort",()=>i.abort(),l)}let s=!1;try{for await(let l of this){var u;if(s=!0,r!=null&&(u=r.signal)!==null&&u!==void 0&&u.aborted)throw new Tw;o?e=await t(e,l,{signal:a}):(e=l,o=!0)}if(!s&&!o)throw new _1e}finally{i.abort()}return e}async function g4r(t){t!=null&&iL(t,"options"),t?.signal!=null&&oL(t.signal,"options.signal");let e=[];for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Tw(void 0,{cause:t.signal.reason});i4r(e,n)}return e}function y4r(t,e){let r=tse.call(this,t,e);return async function*(){for await(let o of r)yield*o}.call(this)}function H1t(t){if(t=s4r(t),u4r(t))return 0;if(t<0)throw new Z2r("number",">= 0",t);return t}function b4r(t,e=void 0){return e!=null&&iL(e,"options"),e?.signal!=null&&oL(e.signal,"options.signal"),t=H1t(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Tw;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new Tw;t--<=0&&(yield i)}}.call(this)}function _4r(t,e=void 0){return e!=null&&iL(e,"options"),e?.signal!=null&&oL(e.signal,"options.signal"),t=H1t(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Tw;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new Tw;if(t-- >0&&(yield i),t<=0)return}}.call(this)}w1e.exports.streamReturningOperators={asIndexedPairs:o4r(d4r,"readable.asIndexedPairs will be removed in a future version."),drop:b4r,filter:v1e,flatMap:y4r,map:tse,take:_4r,compose:c4r};w1e.exports.promiseReturningOperators={every:f4r,forEach:m4r,reduce:h4r,toArray:g4r,some:q1t,find:p4r}});var x1e=x((g4o,W1t)=>{"use strict";var{ArrayPrototypePop:v4r,Promise:w4r}=ys(),{isIterable:x4r,isNodeStream:S4r,isWebStream:C4r}=Cw(),{pipelineImpl:O4r}=Yae(),{finished:E4r}=hP();S1e();function P4r(...t){return new w4r((e,r)=>{let n,o,i=t[t.length-1];if(i&&typeof i=="object"&&!S4r(i)&&!x4r(i)&&!C4r(i)){let a=v4r(t);n=a.signal,o=a.end}O4r(t,(a,s)=>{a?r(a):e(s)},{signal:n,end:o})})}W1t.exports={finished:E4r,pipeline:P4r}});var S1e=x((y4o,tNt)=>{var{Buffer:T4r}=ty(),{ObjectDefineProperty:bP,ObjectKeys:J1t,ReflectApply:Z1t}=ys(),{promisify:{custom:Y1t}}=Gf(),{streamReturningOperators:K1t,promiseReturningOperators:G1t}=V1t(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:X1t}}=Hp(),A4r=b1e(),{setDefaultHighWaterMark:I4r,getDefaultHighWaterMark:M4r}=n9(),{pipeline:Q1t}=Yae(),{destroyer:R4r}=XD(),eNt=hP(),C1e=x1e(),p9=Cw(),Ea=tNt.exports=jae().Stream;Ea.isDestroyed=p9.isDestroyed;Ea.isDisturbed=p9.isDisturbed;Ea.isErrored=p9.isErrored;Ea.isReadable=p9.isReadable;Ea.isWritable=p9.isWritable;Ea.Readable=a9();for(let t of J1t(K1t)){let r=function(...n){if(new.target)throw X1t();return Ea.Readable.from(Z1t(e,this,n))};O1e=r;let e=K1t[t];bP(r,"name",{__proto__:null,value:e.name}),bP(r,"length",{__proto__:null,value:e.length}),bP(Ea.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var O1e;for(let t of J1t(G1t)){let r=function(...o){if(new.target)throw X1t();return Z1t(e,this,o)};O1e=r;let e=G1t[t];bP(r,"name",{__proto__:null,value:e.name}),bP(r,"length",{__proto__:null,value:e.length}),bP(Ea.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var O1e;Ea.Writable=Kae();Ea.Duplex=Pw();Ea.Transform=i1e();Ea.PassThrough=s1e();Ea.pipeline=Q1t;var{addAbortSignal:N4r}=r9();Ea.addAbortSignal=N4r;Ea.finished=eNt;Ea.destroy=R4r;Ea.compose=A4r;Ea.setDefaultHighWaterMark=I4r;Ea.getDefaultHighWaterMark=M4r;bP(Ea,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return C1e}});bP(Q1t,Y1t,{__proto__:null,enumerable:!0,get(){return C1e.pipeline}});bP(eNt,Y1t,{__proto__:null,enumerable:!0,get(){return C1e.finished}});Ea.Stream=Ea;Ea._isUint8Array=function(e){return e instanceof Uint8Array};Ea._uint8ArrayToBuffer=function(e){return T4r.from(e.buffer,e.byteOffset,e.byteLength)}});var m9=x((b4o,cu)=>{"use strict";var hc=S1e(),j4r=x1e(),D4r=hc.Readable.destroy;cu.exports=hc.Readable;cu.exports._uint8ArrayToBuffer=hc._uint8ArrayToBuffer;cu.exports._isUint8Array=hc._isUint8Array;cu.exports.isDisturbed=hc.isDisturbed;cu.exports.isErrored=hc.isErrored;cu.exports.isReadable=hc.isReadable;cu.exports.Readable=hc.Readable;cu.exports.Writable=hc.Writable;cu.exports.Duplex=hc.Duplex;cu.exports.Transform=hc.Transform;cu.exports.PassThrough=hc.PassThrough;cu.exports.addAbortSignal=hc.addAbortSignal;cu.exports.finished=hc.finished;cu.exports.destroy=hc.destroy;cu.exports.destroy=D4r;cu.exports.pipeline=hc.pipeline;cu.exports.compose=hc.compose;Object.defineProperty(hc,"promises",{configurable:!0,enumerable:!0,get(){return j4r}});cu.exports.Stream=hc.Stream;cu.exports.default=cu.exports});var aL=x((_4o,rNt)=>{"use strict";rNt.exports=TypeError});var nNt=x(()=>{});var b9=x((x4o,SNt)=>{var D1e=typeof Map=="function"&&Map.prototype,E1e=Object.getOwnPropertyDescriptor&&D1e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,nse=D1e&&E1e&&typeof E1e.get=="function"?E1e.get:null,oNt=D1e&&Map.prototype.forEach,L1e=typeof Set=="function"&&Set.prototype,P1e=Object.getOwnPropertyDescriptor&&L1e?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ose=L1e&&P1e&&typeof P1e.get=="function"?P1e.get:null,iNt=L1e&&Set.prototype.forEach,L4r=typeof WeakMap=="function"&&WeakMap.prototype,g9=L4r?WeakMap.prototype.has:null,F4r=typeof WeakSet=="function"&&WeakSet.prototype,y9=F4r?WeakSet.prototype.has:null,k4r=typeof WeakRef=="function"&&WeakRef.prototype,aNt=k4r?WeakRef.prototype.deref:null,$4r=Boolean.prototype.valueOf,B4r=Object.prototype.toString,z4r=Function.prototype.toString,U4r=String.prototype.match,F1e=String.prototype.slice,CM=String.prototype.replace,q4r=String.prototype.toUpperCase,sNt=String.prototype.toLowerCase,gNt=RegExp.prototype.test,uNt=Array.prototype.concat,Aw=Array.prototype.join,H4r=Array.prototype.slice,lNt=Math.floor,I1e=typeof BigInt=="function"?BigInt.prototype.valueOf:null,T1e=Object.getOwnPropertySymbols,M1e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,sq=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Zf=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===sq||!0)?Symbol.toStringTag:null,yNt=Object.prototype.propertyIsEnumerable,cNt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function dNt(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||gNt.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-lNt(-t):lNt(t);if(n!==t){var o=String(n),i=F1e.call(e,o.length+1);return CM.call(o,r,"$&_")+"."+CM.call(CM.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return CM.call(e,r,"$&_")}var R1e=nNt(),fNt=R1e.custom,pNt=vNt(fNt)?fNt:null,bNt={__proto__:null,double:'"',single:"'"},V4r={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};SNt.exports=function t(e,r,n,o){var i=r||{};if(_P(i,"quoteStyle")&&!_P(bNt,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(_P(i,"maxStringLength")&&(typeof i.maxStringLength=="number"?i.maxStringLength<0&&i.maxStringLength!==1/0:i.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=_P(i,"customInspect")?i.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(_P(i,"indent")&&i.indent!==null&&i.indent!==" "&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(_P(i,"numericSeparator")&&typeof i.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var s=i.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return xNt(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return s?dNt(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return s?dNt(e,l):l}var c=typeof i.depth>"u"?5:i.depth;if(typeof n>"u"&&(n=0),n>=c&&c>0&&typeof e=="object")return N1e(e)?"[Array]":"[Object]";var d=l3r(i,n);if(typeof o>"u")o=[];else if(wNt(o,e)>=0)return"[Circular]";function f(k,L,H){if(L&&(o=H4r.call(o),o.push(L)),H){var K={depth:i.depth};return _P(i,"quoteStyle")&&(K.quoteStyle=i.quoteStyle),t(k,K,n+1,o)}return t(k,i,n+1,o)}if(typeof e=="function"&&!mNt(e)){var p=e3r(e),m=rse(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+Aw.call(m,", ")+" }":"")}if(vNt(e)){var h=sq?CM.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):M1e.call(e);return typeof e=="object"&&!sq?h9(h):h}if(a3r(e)){for(var y="<"+sNt.call(String(e.nodeName)),g=e.attributes||[],_=0;_<g.length;_++)y+=" "+g[_].name+"="+_Nt(W4r(g[_].value),"double",i);return y+=">",e.childNodes&&e.childNodes.length&&(y+="..."),y+="</"+sNt.call(String(e.nodeName))+">",y}if(N1e(e)){if(e.length===0)return"[]";var w=rse(e,f);return d&&!u3r(w)?"["+j1e(w,d)+"]":"[ "+Aw.call(w,", ")+" ]"}if(G4r(e)){var S=rse(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!yNt.call(e,"cause")?"{ ["+String(e)+"] "+Aw.call(uNt.call("[cause]: "+f(e.cause),S),", ")+" }":S.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Aw.call(S,", ")+" }"}if(typeof e=="object"&&a){if(pNt&&typeof e[pNt]=="function"&&R1e)return R1e(e,{depth:c-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(t3r(e)){var C=[];return oNt&&oNt.call(e,function(k,L){C.push(f(L,e,!0)+" => "+f(k,e))}),hNt("Map",nse.call(e),C,d)}if(o3r(e)){var E=[];return iNt&&iNt.call(e,function(k){E.push(f(k,e))}),hNt("Set",ose.call(e),E,d)}if(r3r(e))return A1e("WeakMap");if(i3r(e))return A1e("WeakSet");if(n3r(e))return A1e("WeakRef");if(Z4r(e))return h9(f(Number(e)));if(X4r(e))return h9(f(I1e.call(e)));if(Y4r(e))return h9($4r.call(e));if(J4r(e))return h9(f(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof window<"u"&&e===window)return"{ [object globalThis] }";if(!K4r(e)&&!mNt(e)){var P=rse(e,f),T=cNt?cNt(e)===Object.prototype:e instanceof Object||e.constructor===Object,I=e instanceof Object?"":"null prototype",N=!T&&Zf&&Object(e)===e&&Zf in e?F1e.call(OM(e),8,-1):I?"Object":"",M=T||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",D=M+(N||I?"["+Aw.call(uNt.call([],N||[],I||[]),": ")+"] ":"");return P.length===0?D+"{}":d?D+"{"+j1e(P,d)+"}":D+"{ "+Aw.call(P,", ")+" }"}return String(e)};function _Nt(t,e,r){var n=r.quoteStyle||e,o=bNt[n];return o+t+o}function W4r(t){return CM.call(String(t),/"/g,"&quot;")}function N1e(t){return OM(t)==="[object Array]"&&(!Zf||!(typeof t=="object"&&Zf in t))}function K4r(t){return OM(t)==="[object Date]"&&(!Zf||!(typeof t=="object"&&Zf in t))}function mNt(t){return OM(t)==="[object RegExp]"&&(!Zf||!(typeof t=="object"&&Zf in t))}function G4r(t){return OM(t)==="[object Error]"&&(!Zf||!(typeof t=="object"&&Zf in t))}function J4r(t){return OM(t)==="[object String]"&&(!Zf||!(typeof t=="object"&&Zf in t))}function Z4r(t){return OM(t)==="[object Number]"&&(!Zf||!(typeof t=="object"&&Zf in t))}function Y4r(t){return OM(t)==="[object Boolean]"&&(!Zf||!(typeof t=="object"&&Zf in t))}function vNt(t){if(sq)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!M1e)return!1;try{return M1e.call(t),!0}catch{}return!1}function X4r(t){if(!t||typeof t!="object"||!I1e)return!1;try{return I1e.call(t),!0}catch{}return!1}var Q4r=Object.prototype.hasOwnProperty||function(t){return t in this};function _P(t,e){return Q4r.call(t,e)}function OM(t){return B4r.call(t)}function e3r(t){if(t.name)return t.name;var e=U4r.call(z4r.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function wNt(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function t3r(t){if(!nse||!t||typeof t!="object")return!1;try{nse.call(t);try{ose.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function r3r(t){if(!g9||!t||typeof t!="object")return!1;try{g9.call(t,g9);try{y9.call(t,y9)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function n3r(t){if(!aNt||!t||typeof t!="object")return!1;try{return aNt.call(t),!0}catch{}return!1}function o3r(t){if(!ose||!t||typeof t!="object")return!1;try{ose.call(t);try{nse.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function i3r(t){if(!y9||!t||typeof t!="object")return!1;try{y9.call(t,y9);try{g9.call(t,g9)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function a3r(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function xNt(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return xNt(F1e.call(t,0,e.maxStringLength),e)+n}var o=V4r[e.quoteStyle||"single"];o.lastIndex=0;var i=CM.call(CM.call(t,o,"\\$1"),/[\x00-\x1f]/g,s3r);return _Nt(i,"single",e)}function s3r(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+q4r.call(e.toString(16))}function h9(t){return"Object("+t+")"}function A1e(t){return t+" { ? }"}function hNt(t,e,r,n){var o=n?j1e(r,n):Aw.call(r,", ");return t+" ("+e+") {"+o+"}"}function u3r(t){for(var e=0;e<t.length;e++)if(wNt(t[e],`
`)>=0)return!1;return!0}function l3r(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Aw.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Aw.call(Array(e+1),r)}}function j1e(t,e){if(t.length===0)return"";var r=`
`+e.prev+e.base;return r+Aw.call(t,","+r)+`
`+e.prev}function rse(t,e){var r=N1e(t),n=[];if(r){n.length=t.length;for(var o=0;o<t.length;o++)n[o]=_P(t,o)?e(t[o],t):""}var i=typeof T1e=="function"?T1e(t):[],a;if(sq){a={};for(var s=0;s<i.length;s++)a["$"+i[s]]=i[s]}for(var u in t)_P(t,u)&&(r&&String(Number(u))===u&&u<t.length||sq&&a["$"+u]instanceof Symbol||(gNt.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if(typeof T1e=="function")for(var l=0;l<i.length;l++)yNt.call(t,i[l])&&n.push("["+e(i[l])+"]: "+e(t[i[l]],t));return n}});var ONt=x((S4o,CNt)=>{"use strict";var c3r=b9(),d3r=aL(),ise=function(t,e,r){for(var n=t,o;(o=n.next)!=null;n=o)if(o.key===e)return n.next=o.next,r||(o.next=t.next,t.next=o),o},f3r=function(t,e){if(t){var r=ise(t,e);return r&&r.value}},p3r=function(t,e,r){var n=ise(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},m3r=function(t,e){return t?!!ise(t,e):!1},h3r=function(t,e){if(t)return ise(t,e,!0)};CNt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new d3r("Side channel does not contain "+c3r(n))},delete:function(n){var o=e&&e.next,i=h3r(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return f3r(e,n)},has:function(n){return m3r(e,n)},set:function(n,o){e||(e={next:void 0}),p3r(e,n,o)}};return r}});var k1e=x((C4o,ENt)=>{"use strict";ENt.exports=Object});var TNt=x((O4o,PNt)=>{"use strict";PNt.exports=Error});var INt=x((E4o,ANt)=>{"use strict";ANt.exports=EvalError});var RNt=x((P4o,MNt)=>{"use strict";MNt.exports=RangeError});var jNt=x((T4o,NNt)=>{"use strict";NNt.exports=ReferenceError});var LNt=x((A4o,DNt)=>{"use strict";DNt.exports=SyntaxError});var kNt=x((I4o,FNt)=>{"use strict";FNt.exports=URIError});var BNt=x((M4o,$Nt)=>{"use strict";$Nt.exports=Math.abs});var UNt=x((R4o,zNt)=>{"use strict";zNt.exports=Math.floor});var HNt=x((N4o,qNt)=>{"use strict";qNt.exports=Math.max});var WNt=x((j4o,VNt)=>{"use strict";VNt.exports=Math.min});var GNt=x((D4o,KNt)=>{"use strict";KNt.exports=Math.pow});var ZNt=x((L4o,JNt)=>{"use strict";JNt.exports=Math.round});var XNt=x((F4o,YNt)=>{"use strict";YNt.exports=Number.isNaN||function(e){return e!==e}});var ejt=x((k4o,QNt)=>{"use strict";var g3r=XNt();QNt.exports=function(e){return g3r(e)||e===0?e:e<0?-1:1}});var rjt=x(($4o,tjt)=>{"use strict";tjt.exports=Object.getOwnPropertyDescriptor});var $1e=x((B4o,njt)=>{"use strict";var ase=rjt();if(ase)try{ase([],"length")}catch{ase=null}njt.exports=ase});var ijt=x((z4o,ojt)=>{"use strict";var sse=Object.defineProperty||!1;if(sse)try{sse({},"a",{value:1})}catch{sse=!1}ojt.exports=sse});var sjt=x((U4o,ajt)=>{"use strict";ajt.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var o=42;e[r]=o;for(var i in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,r);if(s.value!==o||s.enumerable!==!0)return!1}return!0}});var cjt=x((q4o,ljt)=>{"use strict";var ujt=typeof Symbol<"u"&&Symbol,y3r=sjt();ljt.exports=function(){return typeof ujt!="function"||typeof Symbol!="function"||typeof ujt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:y3r()}});var B1e=x((H4o,djt)=>{"use strict";djt.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var z1e=x((V4o,fjt)=>{"use strict";var b3r=k1e();fjt.exports=b3r.getPrototypeOf||null});var hjt=x((W4o,mjt)=>{"use strict";var _3r="Function.prototype.bind called on incompatible ",v3r=Object.prototype.toString,w3r=Math.max,x3r="[object Function]",pjt=function(e,r){for(var n=[],o=0;o<e.length;o+=1)n[o]=e[o];for(var i=0;i<r.length;i+=1)n[i+e.length]=r[i];return n},S3r=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},C3r=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};mjt.exports=function(e){var r=this;if(typeof r!="function"||v3r.apply(r)!==x3r)throw new TypeError(_3r+r);for(var n=S3r(arguments,1),o,i=function(){if(this instanceof o){var c=r.apply(this,pjt(n,arguments));return Object(c)===c?c:this}return r.apply(e,pjt(n,arguments))},a=w3r(0,r.length-n.length),s=[],u=0;u<a;u++)s[u]="$"+u;if(o=Function("binder","return function ("+C3r(s,",")+"){ return binder.apply(this,arguments); }")(i),r.prototype){var l=function(){};l.prototype=r.prototype,o.prototype=new l,l.prototype=null}return o}});var _9=x((K4o,gjt)=>{"use strict";var O3r=hjt();gjt.exports=Function.prototype.bind||O3r});var use=x((G4o,yjt)=>{"use strict";yjt.exports=Function.prototype.call});var U1e=x((J4o,bjt)=>{"use strict";bjt.exports=Function.prototype.apply});var vjt=x((Z4o,_jt)=>{"use strict";_jt.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var xjt=x((Y4o,wjt)=>{"use strict";var E3r=_9(),P3r=U1e(),T3r=use(),A3r=vjt();wjt.exports=A3r||E3r.call(T3r,P3r)});var q1e=x((X4o,Sjt)=>{"use strict";var I3r=_9(),M3r=aL(),R3r=use(),N3r=xjt();Sjt.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new M3r("a function is required");return N3r(I3r,R3r,e)}});var Ajt=x((Q4o,Tjt)=>{"use strict";var j3r=q1e(),Cjt=$1e(),Ejt;try{Ejt=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var H1e=!!Ejt&&Cjt&&Cjt(Object.prototype,"__proto__"),Pjt=Object,Ojt=Pjt.getPrototypeOf;Tjt.exports=H1e&&typeof H1e.get=="function"?j3r([H1e.get]):typeof Ojt=="function"?function(e){return Ojt(e==null?e:Pjt(e))}:!1});var jjt=x((e3o,Njt)=>{"use strict";var Ijt=B1e(),Mjt=z1e(),Rjt=Ajt();Njt.exports=Ijt?function(e){return Ijt(e)}:Mjt?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return Mjt(e)}:Rjt?function(e){return Rjt(e)}:null});var Ljt=x((t3o,Djt)=>{"use strict";var D3r=Function.prototype.call,L3r=Object.prototype.hasOwnProperty,F3r=_9();Djt.exports=F3r.call(D3r,L3r)});var dse=x((r3o,Ujt)=>{"use strict";var ro,k3r=k1e(),$3r=TNt(),B3r=INt(),z3r=RNt(),U3r=jNt(),dq=LNt(),cq=aL(),q3r=kNt(),H3r=BNt(),V3r=UNt(),W3r=HNt(),K3r=WNt(),G3r=GNt(),J3r=ZNt(),Z3r=ejt(),Bjt=Function,V1e=function(t){try{return Bjt('"use strict"; return ('+t+").constructor;")()}catch{}},v9=$1e(),Y3r=ijt(),W1e=function(){throw new cq},X3r=v9?function(){try{return arguments.callee,W1e}catch{try{return v9(arguments,"callee").get}catch{return W1e}}}():W1e,uq=cjt()(),zc=jjt(),Q3r=z1e(),eHr=B1e(),zjt=U1e(),w9=use(),lq={},tHr=typeof Uint8Array>"u"||!zc?ro:zc(Uint8Array),sL={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ro:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ro:ArrayBuffer,"%ArrayIteratorPrototype%":uq&&zc?zc([][Symbol.iterator]()):ro,"%AsyncFromSyncIteratorPrototype%":ro,"%AsyncFunction%":lq,"%AsyncGenerator%":lq,"%AsyncGeneratorFunction%":lq,"%AsyncIteratorPrototype%":lq,"%Atomics%":typeof Atomics>"u"?ro:Atomics,"%BigInt%":typeof BigInt>"u"?ro:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ro:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ro:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ro:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":$3r,"%eval%":eval,"%EvalError%":B3r,"%Float32Array%":typeof Float32Array>"u"?ro:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ro:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ro:FinalizationRegistry,"%Function%":Bjt,"%GeneratorFunction%":lq,"%Int8Array%":typeof Int8Array>"u"?ro:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ro:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ro:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":uq&&zc?zc(zc([][Symbol.iterator]())):ro,"%JSON%":typeof JSON=="object"?JSON:ro,"%Map%":typeof Map>"u"?ro:Map,"%MapIteratorPrototype%":typeof Map>"u"||!uq||!zc?ro:zc(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":k3r,"%Object.getOwnPropertyDescriptor%":v9,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ro:Promise,"%Proxy%":typeof Proxy>"u"?ro:Proxy,"%RangeError%":z3r,"%ReferenceError%":U3r,"%Reflect%":typeof Reflect>"u"?ro:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ro:Set,"%SetIteratorPrototype%":typeof Set>"u"||!uq||!zc?ro:zc(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ro:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":uq&&zc?zc(""[Symbol.iterator]()):ro,"%Symbol%":uq?Symbol:ro,"%SyntaxError%":dq,"%ThrowTypeError%":X3r,"%TypedArray%":tHr,"%TypeError%":cq,"%Uint8Array%":typeof Uint8Array>"u"?ro:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ro:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ro:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ro:Uint32Array,"%URIError%":q3r,"%WeakMap%":typeof WeakMap>"u"?ro:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ro:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ro:WeakSet,"%Function.prototype.call%":w9,"%Function.prototype.apply%":zjt,"%Object.defineProperty%":Y3r,"%Object.getPrototypeOf%":Q3r,"%Math.abs%":H3r,"%Math.floor%":V3r,"%Math.max%":W3r,"%Math.min%":K3r,"%Math.pow%":G3r,"%Math.round%":J3r,"%Math.sign%":Z3r,"%Reflect.getPrototypeOf%":eHr};if(zc)try{null.error}catch(t){Fjt=zc(zc(t)),sL["%Error.prototype%"]=Fjt}var Fjt,rHr=function t(e){var r;if(e==="%AsyncFunction%")r=V1e("async function () {}");else if(e==="%GeneratorFunction%")r=V1e("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=V1e("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&zc&&(r=zc(o.prototype))}return sL[e]=r,r},kjt={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},x9=_9(),lse=Ljt(),nHr=x9.call(w9,Array.prototype.concat),oHr=x9.call(zjt,Array.prototype.splice),$jt=x9.call(w9,String.prototype.replace),cse=x9.call(w9,String.prototype.slice),iHr=x9.call(w9,RegExp.prototype.exec),aHr=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,sHr=/\\(\\)?/g,uHr=function(e){var r=cse(e,0,1),n=cse(e,-1);if(r==="%"&&n!=="%")throw new dq("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new dq("invalid intrinsic syntax, expected opening `%`");var o=[];return $jt(e,aHr,function(i,a,s,u){o[o.length]=s?$jt(u,sHr,"$1"):a||i}),o},lHr=function(e,r){var n=e,o;if(lse(kjt,n)&&(o=kjt[n],n="%"+o[0]+"%"),lse(sL,n)){var i=sL[n];if(i===lq&&(i=rHr(n)),typeof i>"u"&&!r)throw new cq("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new dq("intrinsic "+e+" does not exist!")};Ujt.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new cq("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new cq('"allowMissing" argument must be a boolean');if(iHr(/^%?[^%]*%?$/,e)===null)throw new dq("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=uHr(e),o=n.length>0?n[0]:"",i=lHr("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],oHr(n,nHr([0,1],l)));for(var c=1,d=!0;c<n.length;c+=1){var f=n[c],p=cse(f,0,1),m=cse(f,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new dq("property names with quotes must have matching quotes");if((f==="constructor"||!d)&&(u=!0),o+="."+f,a="%"+o+"%",lse(sL,a))s=sL[a];else if(s!=null){if(!(f in s)){if(!r)throw new cq("base intrinsic for "+e+" exists, but the property is not available.");return}if(v9&&c+1>=n.length){var h=v9(s,f);d=!!h,d&&"get"in h&&!("originalValue"in h.get)?s=h.get:s=s[f]}else d=lse(s,f),s=s[f];d&&!u&&(sL[a]=s)}}return s}});var K1e=x((n3o,Vjt)=>{"use strict";var qjt=dse(),Hjt=q1e(),cHr=Hjt([qjt("%String.prototype.indexOf%")]);Vjt.exports=function(e,r){var n=qjt(e,!!r);return typeof n=="function"&&cHr(e,".prototype.")>-1?Hjt([n]):n}});var G1e=x((o3o,Kjt)=>{"use strict";var dHr=dse(),S9=K1e(),fHr=b9(),pHr=aL(),Wjt=dHr("%Map%",!0),mHr=S9("Map.prototype.get",!0),hHr=S9("Map.prototype.set",!0),gHr=S9("Map.prototype.has",!0),yHr=S9("Map.prototype.delete",!0),bHr=S9("Map.prototype.size",!0);Kjt.exports=!!Wjt&&function(){var e,r={assert:function(n){if(!r.has(n))throw new pHr("Side channel does not contain "+fHr(n))},delete:function(n){if(e){var o=yHr(e,n);return bHr(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return mHr(e,n)},has:function(n){return e?gHr(e,n):!1},set:function(n,o){e||(e=new Wjt),hHr(e,n,o)}};return r}});var Jjt=x((i3o,Gjt)=>{"use strict";var _Hr=dse(),pse=K1e(),vHr=b9(),fse=G1e(),wHr=aL(),fq=_Hr("%WeakMap%",!0),xHr=pse("WeakMap.prototype.get",!0),SHr=pse("WeakMap.prototype.set",!0),CHr=pse("WeakMap.prototype.has",!0),OHr=pse("WeakMap.prototype.delete",!0);Gjt.exports=fq?function(){var e,r,n={assert:function(o){if(!n.has(o))throw new wHr("Side channel does not contain "+vHr(o))},delete:function(o){if(fq&&o&&(typeof o=="object"||typeof o=="function")){if(e)return OHr(e,o)}else if(fse&&r)return r.delete(o);return!1},get:function(o){return fq&&o&&(typeof o=="object"||typeof o=="function")&&e?xHr(e,o):r&&r.get(o)},has:function(o){return fq&&o&&(typeof o=="object"||typeof o=="function")&&e?CHr(e,o):!!r&&r.has(o)},set:function(o,i){fq&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new fq),SHr(e,o,i)):fse&&(r||(r=fse()),r.set(o,i))}};return n}:fse});var Yjt=x((a3o,Zjt)=>{"use strict";var EHr=aL(),PHr=b9(),THr=ONt(),AHr=G1e(),IHr=Jjt(),MHr=IHr||AHr||THr;Zjt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new EHr("Side channel does not contain "+PHr(n))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,o){e||(e=MHr()),e.set(n,o)}};return r}});var mse=x((s3o,Xjt)=>{"use strict";var RHr=String.prototype.replace,NHr=/%20/g,J1e={RFC1738:"RFC1738",RFC3986:"RFC3986"};Xjt.exports={default:J1e.RFC3986,formatters:{RFC1738:function(t){return RHr.call(t,NHr,"+")},RFC3986:function(t){return String(t)}},RFC1738:J1e.RFC1738,RFC3986:J1e.RFC3986}});var Y1e=x((u3o,eDt)=>{"use strict";var jHr=mse(),Z1e=Object.prototype.hasOwnProperty,uL=Array.isArray,Iw=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),DHr=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(uL(n)){for(var o=[],i=0;i<n.length;++i)typeof n[i]<"u"&&o.push(n[i]);r.obj[r.prop]=o}}},Qjt=function(e,r){for(var n=r&&r.plainObjects?Object.create(null):{},o=0;o<e.length;++o)typeof e[o]<"u"&&(n[o]=e[o]);return n},LHr=function t(e,r,n){if(!r)return e;if(typeof r!="object"){if(uL(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!Z1e.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var o=e;return uL(e)&&!uL(r)&&(o=Qjt(e,n)),uL(e)&&uL(r)?(r.forEach(function(i,a){if(Z1e.call(e,a)){var s=e[a];s&&typeof s=="object"&&i&&typeof i=="object"?e[a]=t(s,i,n):e.push(i)}else e[a]=i}),e):Object.keys(r).reduce(function(i,a){var s=r[a];return Z1e.call(i,a)?i[a]=t(i[a],s,n):i[a]=s,i},o)},FHr=function(e,r){return Object.keys(r).reduce(function(n,o){return n[o]=r[o],n},e)},kHr=function(t,e,r){var n=t.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},$Hr=function(e,r,n,o,i){if(e.length===0)return e;var a=e;if(typeof e=="symbol"?a=Symbol.prototype.toString.call(e):typeof e!="string"&&(a=String(e)),n==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});for(var s="",u=0;u<a.length;++u){var l=a.charCodeAt(u);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===jHr.RFC1738&&(l===40||l===41)){s+=a.charAt(u);continue}if(l<128){s=s+Iw[l];continue}if(l<2048){s=s+(Iw[192|l>>6]+Iw[128|l&63]);continue}if(l<55296||l>=57344){s=s+(Iw[224|l>>12]+Iw[128|l>>6&63]+Iw[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|a.charCodeAt(u)&1023),s+=Iw[240|l>>18]+Iw[128|l>>12&63]+Iw[128|l>>6&63]+Iw[128|l&63]}return s},BHr=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],o=0;o<r.length;++o)for(var i=r[o],a=i.obj[i.prop],s=Object.keys(a),u=0;u<s.length;++u){var l=s[u],c=a[l];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(r.push({obj:a,prop:l}),n.push(c))}return DHr(r),e},zHr=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},UHr=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},qHr=function(e,r){return[].concat(e,r)},HHr=function(e,r){if(uL(e)){for(var n=[],o=0;o<e.length;o+=1)n.push(r(e[o]));return n}return r(e)};eDt.exports={arrayToObject:Qjt,assign:FHr,combine:qHr,compact:BHr,decode:kHr,encode:$Hr,isBuffer:UHr,isRegExp:zHr,maybeMap:HHr,merge:LHr}});var aDt=x((l3o,iDt)=>{"use strict";var nDt=Yjt(),hse=Y1e(),C9=mse(),VHr=Object.prototype.hasOwnProperty,tDt={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},vP=Array.isArray,WHr=Array.prototype.push,oDt=function(t,e){WHr.apply(t,vP(e)?e:[e])},KHr=Date.prototype.toISOString,rDt=C9.default,Yf={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:hse.encode,encodeValuesOnly:!1,format:rDt,formatter:C9.formatters[rDt],indices:!1,serializeDate:function(e){return KHr.call(e)},skipNulls:!1,strictNullHandling:!1},GHr=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},X1e={},JHr=function t(e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,y){for(var g=e,_=y,w=0,S=!1;(_=_.get(X1e))!==void 0&&!S;){var C=_.get(e);if(w+=1,typeof C<"u"){if(C===w)throw new RangeError("Cyclic object value");S=!0}typeof _.get(X1e)>"u"&&(w=0)}if(typeof u=="function"?g=u(r,g):g instanceof Date?g=d(g):n==="comma"&&vP(g)&&(g=hse.maybeMap(g,function(K){return K instanceof Date?d(K):K})),g===null){if(i)return s&&!m?s(r,Yf.encoder,h,"key",f):r;g=""}if(GHr(g)||hse.isBuffer(g)){if(s){var E=m?r:s(r,Yf.encoder,h,"key",f);return[p(E)+"="+p(s(g,Yf.encoder,h,"value",f))]}return[p(r)+"="+p(String(g))]}var P=[];if(typeof g>"u")return P;var T;if(n==="comma"&&vP(g))m&&s&&(g=hse.maybeMap(g,s)),T=[{value:g.length>0?g.join(",")||null:void 0}];else if(vP(u))T=u;else{var I=Object.keys(g);T=l?I.sort(l):I}for(var N=o&&vP(g)&&g.length===1?r+"[]":r,M=0;M<T.length;++M){var D=T[M],k=typeof D=="object"&&typeof D.value<"u"?D.value:g[D];if(!(a&&k===null)){var L=vP(g)?typeof n=="function"?n(N,D):N:N+(c?"."+D:"["+D+"]");y.set(e,w);var H=nDt();H.set(X1e,y),oDt(P,t(k,L,n,o,i,a,n==="comma"&&m&&vP(g)?null:s,u,l,c,d,f,p,m,h,H))}}return P},ZHr=function(e){if(!e)return Yf;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||Yf.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=C9.default;if(typeof e.format<"u"){if(!VHr.call(C9.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var o=C9.formatters[n],i=Yf.filter;return(typeof e.filter=="function"||vP(e.filter))&&(i=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Yf.addQueryPrefix,allowDots:typeof e.allowDots>"u"?Yf.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Yf.charsetSentinel,delimiter:typeof e.delimiter>"u"?Yf.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Yf.encode,encoder:typeof e.encoder=="function"?e.encoder:Yf.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Yf.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Yf.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Yf.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Yf.strictNullHandling}};iDt.exports=function(t,e){var r=t,n=ZHr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):vP(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s;e&&e.arrayFormat in tDt?s=e.arrayFormat:e&&"indices"in e?s=e.indices?"indices":"repeat":s="indices";var u=tDt[s];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=u==="comma"&&e&&e.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);for(var c=nDt(),d=0;d<o.length;++d){var f=o[d];n.skipNulls&&r[f]===null||oDt(a,JHr(r[f],f,u,l,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,c))}var p=a.join(n.delimiter),m=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),p.length>0?m+p:""}});var lDt=x((c3o,uDt)=>{"use strict";var pq=Y1e(),Q1e=Object.prototype.hasOwnProperty,YHr=Array.isArray,Uc={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:pq.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},XHr=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},sDt=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},QHr="utf8=%26%2310003%3B",eVr="utf8=%E2%9C%93",tVr=function(e,r){var n={__proto__:null},o=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=r.parameterLimit===1/0?void 0:r.parameterLimit,a=o.split(r.delimiter,i),s=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u<a.length;++u)a[u].indexOf("utf8=")===0&&(a[u]===eVr?l="utf-8":a[u]===QHr&&(l="iso-8859-1"),s=u,u=a.length);for(u=0;u<a.length;++u)if(u!==s){var c=a[u],d=c.indexOf("]="),f=d===-1?c.indexOf("="):d+1,p,m;f===-1?(p=r.decoder(c,Uc.decoder,l,"key"),m=r.strictNullHandling?null:""):(p=r.decoder(c.slice(0,f),Uc.decoder,l,"key"),m=pq.maybeMap(sDt(c.slice(f+1),r),function(h){return r.decoder(h,Uc.decoder,l,"value")})),m&&r.interpretNumericEntities&&l==="iso-8859-1"&&(m=XHr(m)),c.indexOf("[]=")>-1&&(m=YHr(m)?[m]:m),Q1e.call(n,p)?n[p]=pq.combine(n[p],m):n[p]=m}return n},rVr=function(t,e,r,n){for(var o=n?e:sDt(e,r),i=t.length-1;i>=0;--i){var a,s=t[i];if(s==="[]"&&r.parseArrays)a=[].concat(o);else{a=r.plainObjects?Object.create(null):{};var u=s.charAt(0)==="["&&s.charAt(s.length-1)==="]"?s.slice(1,-1):s,l=parseInt(u,10);!r.parseArrays&&u===""?a={0:o}:!isNaN(l)&&s!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(a=[],a[l]=o):u!=="__proto__"&&(a[u]=o)}o=a}return o},nVr=function(e,r,n,o){if(e){var i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,u=n.depth>0&&a.exec(i),l=u?i.slice(0,u.index):i,c=[];if(l){if(!n.plainObjects&&Q1e.call(Object.prototype,l)&&!n.allowPrototypes)return;c.push(l)}for(var d=0;n.depth>0&&(u=s.exec(i))!==null&&d<n.depth;){if(d+=1,!n.plainObjects&&Q1e.call(Object.prototype,u[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(u[1])}return u&&c.push("["+i.slice(u.index)+"]"),rVr(c,r,n,o)}},oVr=function(e){if(!e)return Uc;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=typeof e.charset>"u"?Uc.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Uc.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Uc.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Uc.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Uc.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Uc.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Uc.comma,decoder:typeof e.decoder=="function"?e.decoder:Uc.decoder,delimiter:typeof e.delimiter=="string"||pq.isRegExp(e.delimiter)?e.delimiter:Uc.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Uc.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Uc.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Uc.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Uc.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Uc.strictNullHandling}};uDt.exports=function(t,e){var r=oVr(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?tVr(t,r):t,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a<i.length;++a){var s=i[a],u=nVr(s,n[s],r,typeof t=="string");o=pq.merge(o,u,r)}return r.allowSparse===!0?o:pq.compact(o)}});var dDt=x((d3o,cDt)=>{"use strict";var iVr=aDt(),aVr=lDt(),sVr=mse();cDt.exports={formats:sVr,parse:aVr,stringify:iVr}});var fDt=x(mq=>{"use strict";var uVr=mq&&mq.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mq,"__esModule",{value:!0});mq.createRequestUrl=void 0;var lVr=uVr(dDt());function cVr(t,e){return Object.keys(e??{}).length>0?`${t}?${lVr.default.stringify(e,{arrayFormat:"repeat"})}`:t}mq.createRequestUrl=cVr});var hDt=x(gse=>{"use strict";var eNe,tNe,rNe,nNe,oNe;Object.defineProperty(gse,"__esModule",{value:!0});gse.RUNTIME=void 0;var dVr=typeof window<"u"&&typeof window.document<"u",fVr=typeof self=="object"&&typeof self?.importScripts=="function"&&(((eNe=self.constructor)===null||eNe===void 0?void 0:eNe.name)==="DedicatedWorkerGlobalScope"||((tNe=self.constructor)===null||tNe===void 0?void 0:tNe.name)==="ServiceWorkerGlobalScope"||((rNe=self.constructor)===null||rNe===void 0?void 0:rNe.name)==="SharedWorkerGlobalScope"),pDt=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",mDt=typeof Bun<"u"&&typeof Bun.version<"u",pVr=typeof process<"u"&&!!process.version&&!!(!((nNe=process.versions)===null||nNe===void 0)&&nNe.node)&&!pDt&&!mDt,mVr=typeof navigator<"u"&&navigator?.product==="ReactNative",hVr=typeof globalThis<"u"&&((oNe=globalThis?.navigator)===null||oNe===void 0?void 0:oNe.userAgent)==="Cloudflare-Workers";gse.RUNTIME=gVr();function gVr(){return dVr?{type:"browser",version:window.navigator.userAgent}:hVr?{type:"workerd"}:fVr?{type:"web-worker"}:pDt?{type:"deno",version:Deno.version.deno}:mDt?{type:"bun",version:Bun.version}:pVr?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:mVr?{type:"react-native"}:{type:"unknown"}}});var hq=x(yse=>{"use strict";Object.defineProperty(yse,"__esModule",{value:!0});yse.RUNTIME=void 0;var yVr=hDt();Object.defineProperty(yse,"RUNTIME",{enumerable:!0,get:function(){return yVr.RUNTIME}})});var iNe=x((gq,gDt)=>{"use strict";var bVr=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},lL=bVr();gDt.exports=gq=lL.fetch;lL.fetch&&(gq.default=lL.fetch.bind(lL));gq.Headers=lL.Headers;gq.Request=lL.Request;gq.Response=lL.Response});var bDt=x(Oy=>{"use strict";var _Vr=Oy&&Oy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vVr=Oy&&Oy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yDt=Oy&&Oy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Vr(e,t,r);return vVr(e,t),e},wVr=Oy&&Oy.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Oy,"__esModule",{value:!0});Oy.getFetchFn=void 0;var bse=hq();function xVr(){return wVr(this,void 0,void 0,function*(){return bse.RUNTIME.type==="node"&&bse.RUNTIME.parsedVersion!=null&&bse.RUNTIME.parsedVersion>=18?fetch:bse.RUNTIME.type==="node"?(yield Promise.resolve().then(()=>yDt(iNe()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>yDt(iNe()))).default})}Oy.getFetchFn=xVr});var _Dt=x(yq=>{"use strict";var SVr=yq&&yq.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(yq,"__esModule",{value:!0});yq.getRequestBody=void 0;function CVr({body:t,type:e}){return SVr(this,void 0,void 0,function*(){return e.includes("json")?JSON.stringify(t):t})}yq.getRequestBody=CVr});var vDt=x(bq=>{"use strict";var i_=bq&&bq.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(bq,"__esModule",{value:!0});bq.Node18UniversalStreamWrapper=void 0;var aNe=class t{constructor(e){this.readableStream=e,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(e,r){var n;(n=this.events[e])===null||n===void 0||n.push(r)}off(e,r){var n;this.events[e]=(n=this.events[e])===null||n===void 0?void 0:n.filter(o=>o!==r)}pipe(e){return this.on("data",r=>i_(this,void 0,void 0,function*(){if(e instanceof t)e._write(r);else if(e instanceof WritableStream){let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}else e.write(r)})),this.on("end",()=>i_(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.on("error",r=>i_(this,void 0,void 0,function*(){e instanceof t?e._error(r):e instanceof WritableStream?e.getWriter().abort(r):e.destroy(r)})),this._startReading(),e}pipeTo(e){return this.pipe(e)}unpipe(e){this.off("data",r=>i_(this,void 0,void 0,function*(){if(e instanceof t)e._write(r);else if(e instanceof WritableStream){let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}else e.write(r)})),this.off("end",()=>i_(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.off("error",r=>i_(this,void 0,void 0,function*(){e instanceof t?e._error(r):e instanceof WritableStream?e.getWriter().abort(r):e.destroy(r)}))}destroy(e){this.reader.cancel(e).then(()=>{this._emit("close")}).catch(r=>{this._emit("error",r)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}read(){return i_(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();if(!e)return r})}setEncoding(e){this.encoding=e}text(){return i_(this,void 0,void 0,function*(){let e=[];for(;;){let{done:n,value:o}=yield this.reader.read();if(n)break;o&&e.push(o)}return new TextDecoder(this.encoding||"utf-8").decode(yield new Blob(e).arrayBuffer())})}json(){return i_(this,void 0,void 0,function*(){let e=yield this.text();return JSON.parse(e)})}_write(e){this._emit("data",e)}_end(){this._emit("end")}_error(e){this._emit("error",e)}_emit(e,r){if(this.events[e])for(let n of this.events[e]||[])n(r)}_startReading(){return i_(this,void 0,void 0,function*(){try{for(this._emit("readable");;){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();if(e){this._emit("end"),this._emit("close");break}r&&this._emit("data",r)}}catch(e){this._emit("error",e)}})}[Symbol.asyncIterator](){return{next:()=>i_(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();return e?{done:!0,value:void 0}:{done:!1,value:r}}),[Symbol.asyncIterator](){return this}}}};bq.Node18UniversalStreamWrapper=aNe});var wDt=x(_q=>{"use strict";var O9=_q&&_q.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(_q,"__esModule",{value:!0});_q.UndiciStreamWrapper=void 0;var sNe=class t{constructor(e){this.readableStream=e,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(e,r){var n;(n=this.events[e])===null||n===void 0||n.push(r)}off(e,r){var n;this.events[e]=(n=this.events[e])===null||n===void 0?void 0:n.filter(o=>o!==r)}pipe(e){return this.on("data",r=>{if(e instanceof t)e._write(r);else{let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}}),this.on("end",()=>{e instanceof t?e._end():e.getWriter().close()}),this.on("error",r=>{e instanceof t?e._error(r):e.getWriter().abort(r)}),this._startReading(),e}pipeTo(e){return this.pipe(e)}unpipe(e){this.off("data",r=>{if(e instanceof t)e._write(r);else{let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}}),this.off("end",()=>{e instanceof t?e._end():e.getWriter().close()}),this.off("error",r=>{e instanceof t?e._error(r):e.getWriter().abort(r)})}destroy(e){this.reader.cancel(e).then(()=>{this._emit("close")}).catch(r=>{this._emit("error",r)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}read(){return O9(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();if(!e)return r})}setEncoding(e){this.encoding=e}text(){return O9(this,void 0,void 0,function*(){let e=[];for(;;){let{done:n,value:o}=yield this.reader.read();if(n)break;o&&e.push(o)}return new TextDecoder(this.encoding||"utf-8").decode(yield new Blob(e).arrayBuffer())})}json(){return O9(this,void 0,void 0,function*(){let e=yield this.text();return JSON.parse(e)})}_write(e){this._emit("data",e)}_end(){this._emit("end")}_error(e){this._emit("error",e)}_emit(e,r){if(this.events[e])for(let n of this.events[e]||[])n(r)}_startReading(){return O9(this,void 0,void 0,function*(){try{for(this._emit("readable");;){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();if(e){this._emit("end"),this._emit("close");break}r&&this._emit("data",r)}}catch(e){this._emit("error",e)}})}[Symbol.asyncIterator](){return{next:()=>O9(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();return e?{done:!0,value:void 0}:{done:!1,value:r}}),[Symbol.asyncIterator](){return this}}}};_q.UndiciStreamWrapper=sNe});var xDt=x(EM=>{"use strict";var _se=EM&&EM.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},OVr=EM&&EM.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}};Object.defineProperty(EM,"__esModule",{value:!0});EM.NodePre18StreamWrapper=void 0;var uNe=class{constructor(e){this.readableStream=e}on(e,r){this.readableStream.on(e,r)}off(e,r){this.readableStream.off(e,r)}pipe(e){return this.readableStream.pipe(e),e}pipeTo(e){return this.pipe(e)}unpipe(e){e?this.readableStream.unpipe(e):this.readableStream.unpipe()}destroy(e){this.readableStream.destroy(e)}pause(){this.readableStream.pause()}resume(){this.readableStream.resume()}get isPaused(){return this.readableStream.isPaused()}read(){return _se(this,void 0,void 0,function*(){return new Promise((e,r)=>{let n=this.readableStream.read();n?e(n):(this.readableStream.once("readable",()=>{let o=this.readableStream.read();e(o)}),this.readableStream.once("error",r))})})}setEncoding(e){this.readableStream.setEncoding(e),this.encoding=e}text(){var e,r;return _se(this,void 0,void 0,function*(){let n=[],o=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");try{for(var i=OVr(this.readableStream),a;a=yield i.next(),!a.done;){let u=a.value;n.push(o.encode(u))}}catch(u){e={error:u}}finally{try{a&&!a.done&&(r=i.return)&&(yield r.call(i))}finally{if(e)throw e.error}}return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(n))})}json(){return _se(this,void 0,void 0,function*(){let e=yield this.text();return JSON.parse(e)})}[Symbol.asyncIterator](){let r=this.readableStream[Symbol.asyncIterator]();return{next(){return _se(this,void 0,void 0,function*(){let{value:n,done:o}=yield r.next();return{value:n,done:o}})},[Symbol.asyncIterator](){return this}}}};EM.NodePre18StreamWrapper=uNe});var SDt=x(Ey=>{"use strict";var EVr=Ey&&Ey.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PVr=Ey&&Ey.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lNe=Ey&&Ey.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EVr(e,t,r);return PVr(e,t),e},TVr=Ey&&Ey.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ey,"__esModule",{value:!0});Ey.chooseStreamWrapper=void 0;var vse=hq();function AVr(t){return TVr(this,void 0,void 0,function*(){return vse.RUNTIME.type==="node"&&vse.RUNTIME.parsedVersion!=null&&vse.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>lNe(vDt()))).Node18UniversalStreamWrapper(t):vse.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>lNe(wDt()))).UndiciStreamWrapper(t):new(yield Promise.resolve().then(()=>lNe(xDt()))).NodePre18StreamWrapper(t)})}Ey.chooseStreamWrapper=AVr});var CDt=x(vq=>{"use strict";var IVr=vq&&vq.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(vq,"__esModule",{value:!0});vq.getResponseBody=void 0;var MVr=SDt();function RVr(t,e){return IVr(this,void 0,void 0,function*(){if(t.body!=null&&e==="blob")return yield t.blob();if(t.body!=null&&e==="sse")return t.body;if(t.body!=null&&e==="streaming")return(0,MVr.chooseStreamWrapper)(t.body);if(t.body!=null&&e==="text")return yield t.text();{let r=yield t.text();if(r.length>0)try{return JSON.parse(r)}catch{return{ok:!1,error:{reason:"non-json",statusCode:t.status,rawBody:r}}}else return}})}vq.getResponseBody=RVr});var ODt=x(wq=>{"use strict";Object.defineProperty(wq,"__esModule",{value:!0});wq.anySignal=wq.getTimeoutSignal=void 0;var NVr="timeout";function jVr(t){let e=new AbortController,r=setTimeout(()=>e.abort(NVr),t);return{signal:e.signal,abortId:r}}wq.getTimeoutSignal=jVr;function DVr(...t){let e=t.length===1&&Array.isArray(t[0])?t[0]:t,r=new AbortController;for(let n of e){if(n.aborted){r.abort(n?.reason);break}n.addEventListener("abort",()=>r.abort(n?.reason),{signal:r.signal})}return r.signal}wq.anySignal=DVr});var PDt=x(xq=>{"use strict";var LVr=xq&&xq.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(xq,"__esModule",{value:!0});xq.makeRequest=void 0;var EDt=ODt(),FVr=(t,e,r,n,o,i,a,s,u)=>LVr(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:m}=(0,EDt.getTimeoutSignal)(i);c=m,l.push(p)}a!=null&&l.push(a);let d=(0,EDt.anySignal)(l),f=yield t(e,{method:r,headers:n,body:o,signal:d,credentials:s?"include":void 0,duplex:u});return c!=null&&clearTimeout(c),f});xq.makeRequest=FVr});var TDt=x(Sq=>{"use strict";var kVr=Sq&&Sq.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Sq,"__esModule",{value:!0});Sq.requestWithRetries=void 0;var $Vr=1,BVr=60,zVr=2;function UVr(t,e=zVr){return kVr(this,void 0,void 0,function*(){let r=yield t();for(let n=0;n<e&&([408,409,429].includes(r.status)||r.status>=500);++n){let o=Math.min($Vr*Math.pow(2,n),BVr);yield new Promise(i=>setTimeout(i,o)),r=yield t()}return r})}Sq.requestWithRetries=UVr});var MDt=x(PM=>{"use strict";var ADt=PM&&PM.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(PM,"__esModule",{value:!0});PM.fetcher=PM.fetcherImpl=void 0;var qVr=fDt(),HVr=bDt(),VVr=_Dt(),WVr=CDt(),KVr=PDt(),GVr=TDt();function IDt(t){return ADt(this,void 0,void 0,function*(){let e={};if(t.body!==void 0&&t.contentType!=null&&(e["Content-Type"]=t.contentType),t.headers!=null)for(let[i,a]of Object.entries(t.headers))a!=null&&(e[i]=a);let r=(0,qVr.createRequestUrl)(t.url,t.queryParameters),n=yield(0,VVr.getRequestBody)({body:t.body,type:t.requestType==="json"?"json":"other"}),o=yield(0,HVr.getFetchFn)();try{let i=yield(0,GVr.requestWithRetries)(()=>ADt(this,void 0,void 0,function*(){return(0,KVr.makeRequest)(o,r,t.method,e,n,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex)}),t.maxRetries),a=yield(0,WVr.getResponseBody)(i,t.responseType);return i.status>=200&&i.status<400?{ok:!0,body:a,headers:i.headers}:{ok:!1,error:{reason:"status-code",statusCode:i.status,body:a}}}catch(i){return t.abortSignal!=null&&t.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"}}:i instanceof Error&&i.name==="AbortError"?{ok:!1,error:{reason:"timeout"}}:i instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:i.message}}:{ok:!1,error:{reason:"unknown",errorMessage:JSON.stringify(i)}}}})}PM.fetcherImpl=IDt;PM.fetcher=IDt});var RDt=x(wse=>{"use strict";Object.defineProperty(wse,"__esModule",{value:!0});wse.getHeader=void 0;function JVr(t,e){for(let[r,n]of Object.entries(t))if(r.toLowerCase()===e.toLowerCase())return n}wse.getHeader=JVr});var NDt=x(Cq=>{"use strict";var ZVr=Cq&&Cq.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Cq,"__esModule",{value:!0});Cq.Supplier=void 0;Cq.Supplier={get:t=>ZVr(void 0,void 0,void 0,function*(){return typeof t=="function"?t():t})}});var jDt=x(TM=>{"use strict";Object.defineProperty(TM,"__esModule",{value:!0});TM.Supplier=TM.getHeader=TM.fetcher=void 0;var YVr=MDt();Object.defineProperty(TM,"fetcher",{enumerable:!0,get:function(){return YVr.fetcher}});var XVr=RDt();Object.defineProperty(TM,"getHeader",{enumerable:!0,get:function(){return XVr.getHeader}});var QVr=NDt();Object.defineProperty(TM,"Supplier",{enumerable:!0,get:function(){return QVr.Supplier}})});var DDt=x((cNe,dNe)=>{(function(t,e){typeof cNe=="object"&&typeof dNe<"u"?dNe.exports=e():typeof define=="function"&&define.amd?define(e):function(){var r=t.Base64,n=e();n.noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n}()})(typeof self<"u"?self:typeof window<"u"||typeof window<"u"?window:cNe,function(){"use strict";var t="3.7.2",e=t,r=typeof atob=="function",n=typeof btoa=="function",o=typeof Buffer=="function",i=typeof TextDecoder=="function"?new TextDecoder:void 0,a=typeof TextEncoder=="function"?new TextEncoder:void 0,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=Array.prototype.slice.call(s),l=function(q){var W={};return q.forEach(function(J,se){return W[J]=se}),W}(u),c=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,d=String.fromCharCode.bind(String),f=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(q,W){return W===void 0&&(W=function(J){return J}),new Uint8Array(Array.prototype.slice.call(q,0).map(W))},p=function(q){return q.replace(/=/g,"").replace(/[+\/]/g,function(W){return W=="+"?"-":"_"})},m=function(q){return q.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(q){for(var W,J,se,be,ce="",pe=q.length%3,Me=0;Me<q.length;){if((J=q.charCodeAt(Me++))>255||(se=q.charCodeAt(Me++))>255||(be=q.charCodeAt(Me++))>255)throw new TypeError("invalid character found");W=J<<16|se<<8|be,ce+=u[W>>18&63]+u[W>>12&63]+u[W>>6&63]+u[W&63]}return pe?ce.slice(0,pe-3)+"===".substring(pe):ce},y=n?function(q){return btoa(q)}:o?function(q){return Buffer.from(q,"binary").toString("base64")}:h,g=o?function(q){return Buffer.from(q).toString("base64")}:function(q){for(var W=4096,J=[],se=0,be=q.length;se<be;se+=W)J.push(d.apply(null,q.subarray(se,se+W)));return y(J.join(""))},_=function(q,W){return W===void 0&&(W=!1),W?p(g(q)):g(q)},w=function(q){if(q.length<2){var W=q.charCodeAt(0);return W<128?q:W<2048?d(192|W>>>6)+d(128|W&63):d(224|W>>>12&15)+d(128|W>>>6&63)+d(128|W&63)}else{var W=65536+(q.charCodeAt(0)-55296)*1024+(q.charCodeAt(1)-56320);return d(240|W>>>18&7)+d(128|W>>>12&63)+d(128|W>>>6&63)+d(128|W&63)}},S=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,C=function(q){return q.replace(S,w)},E=o?function(q){return Buffer.from(q,"utf8").toString("base64")}:a?function(q){return g(a.encode(q))}:function(q){return y(C(q))},P=function(q,W){return W===void 0&&(W=!1),W?p(E(q)):E(q)},T=function(q){return P(q,!0)},I=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,N=function(q){switch(q.length){case 4:var W=(7&q.charCodeAt(0))<<18|(63&q.charCodeAt(1))<<12|(63&q.charCodeAt(2))<<6|63&q.charCodeAt(3),J=W-65536;return d((J>>>10)+55296)+d((J&1023)+56320);case 3:return d((15&q.charCodeAt(0))<<12|(63&q.charCodeAt(1))<<6|63&q.charCodeAt(2));default:return d((31&q.charCodeAt(0))<<6|63&q.charCodeAt(1))}},M=function(q){return q.replace(I,N)},D=function(q){if(q=q.replace(/\s+/g,""),!c.test(q))throw new TypeError("malformed base64.");q+="==".slice(2-(q.length&3));for(var W,J="",se,be,ce=0;ce<q.length;)W=l[q.charAt(ce++)]<<18|l[q.charAt(ce++)]<<12|(se=l[q.charAt(ce++)])<<6|(be=l[q.charAt(ce++)]),J+=se===64?d(W>>16&255):be===64?d(W>>16&255,W>>8&255):d(W>>16&255,W>>8&255,W&255);return J},k=r?function(q){return atob(m(q))}:o?function(q){return Buffer.from(q,"base64").toString("binary")}:D,L=o?function(q){return f(Buffer.from(q,"base64"))}:function(q){return f(k(q),function(W){return W.charCodeAt(0)})},H=function(q){return L(G(q))},K=o?function(q){return Buffer.from(q,"base64").toString("utf8")}:i?function(q){return i.decode(L(q))}:function(q){return M(k(q))},G=function(q){return m(q.replace(/[-_]/g,function(W){return W=="-"?"+":"/"}))},X=function(q){return K(G(q))},F=function(q){if(typeof q!="string")return!1;var W=q.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(W)||!/[^\s0-9a-zA-Z\-_]/.test(W)},Q=function(q){return{value:q,enumerable:!1,writable:!0,configurable:!0}},ee=function(){var q=function(W,J){return Object.defineProperty(String.prototype,W,Q(J))};q("fromBase64",function(){return X(this)}),q("toBase64",function(W){return P(this,W)}),q("toBase64URI",function(){return P(this,!0)}),q("toBase64URL",function(){return P(this,!0)}),q("toUint8Array",function(){return H(this)})},U=function(){var q=function(W,J){return Object.defineProperty(Uint8Array.prototype,W,Q(J))};q("toBase64",function(W){return _(this,W)}),q("toBase64URI",function(){return _(this,!0)}),q("toBase64URL",function(){return _(this,!0)})},z=function(){ee(),U()},V={version:t,VERSION:e,atob:k,atobPolyfill:D,btoa:y,btoaPolyfill:h,fromBase64:X,toBase64:P,encode:P,encodeURI:T,encodeURL:T,utob:C,btou:M,decode:X,isValid:F,fromUint8Array:_,toUint8Array:H,extendString:ee,extendUint8Array:U,extendBuiltins:z};return V.Base64={},Object.keys(V).forEach(function(q){return V.Base64[q]=V[q]}),V})});var FDt=x(xse=>{"use strict";Object.defineProperty(xse,"__esModule",{value:!0});xse.BasicAuth=void 0;var LDt=DDt(),e6r=/^Basic /i;xse.BasicAuth={toAuthorizationHeader:t=>t==null?void 0:`Basic ${LDt.Base64.encode(`${t.username}:${t.password}`)}`,fromAuthorizationHeader:t=>{let e=t.replace(e6r,""),r=LDt.Base64.decode(e),[n,o]=r.split(":",2);if(n==null||o==null)throw new Error("Invalid basic auth");return{username:n,password:o}}}});var kDt=x(Sse=>{"use strict";Object.defineProperty(Sse,"__esModule",{value:!0});Sse.BearerToken=void 0;var t6r=/^Bearer /i;Sse.BearerToken={toAuthorizationHeader:t=>{if(t!=null)return`Bearer ${t}`},fromAuthorizationHeader:t=>t.replace(t6r,"").trim()}});var $Dt=x(Oq=>{"use strict";Object.defineProperty(Oq,"__esModule",{value:!0});Oq.BearerToken=Oq.BasicAuth=void 0;var r6r=FDt();Object.defineProperty(Oq,"BasicAuth",{enumerable:!0,get:function(){return r6r.BasicAuth}});var n6r=kDt();Object.defineProperty(Oq,"BearerToken",{enumerable:!0,get:function(){return n6r.BearerToken}})});var pNe=x(Vm=>{"use strict";var BDt=Vm&&Vm.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},zDt=Vm&&Vm.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}},a_=Vm&&Vm.__await||function(t){return this instanceof a_?(this.v=t,this):new a_(t)},UDt=Vm&&Vm.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof a_?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){s("next",f)}function c(f){s("throw",f)}function d(f,p){f(p),i.shift(),i.length&&s(i[0][0],i[0][1])}};Object.defineProperty(Vm,"__esModule",{value:!0});Vm.readableStreamAsyncIterable=Vm.Stream=void 0;var o6r=hq(),i6r="data:",fNe=class{constructor({stream:e,parse:r,eventShape:n,signal:o}){this.controller=new AbortController,this.stream=e,this.parse=r,n.type==="sse"?(this.prefix=i6r,this.messageTerminator=`
`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return UDt(this,arguments,function*(){var r,n;this.controller.signal;let o=qDt(this.stream),i="",a=!1;try{for(var s=zDt(o),u;u=yield a_(s.next()),!u.done;){let l=u.value;i+=this.decodeChunk(l);let c;for(;(c=i.indexOf(this.messageTerminator))>=0;){let d=i.slice(0,c+1);if(i=i.slice(c+1),d.length===0)continue;if(!a&&this.prefix!=null){let p=d.indexOf(this.prefix);if(p===-1)continue;a=!0,d=d.slice(p+this.prefix.length)}if(this.streamTerminator!=null&&d.includes(this.streamTerminator))return yield a_(void 0);let f=yield a_(this.parse(JSON.parse(d)));yield yield a_(f),a=!1}}}catch(l){r={error:l}}finally{try{u&&!u.done&&(n=s.return)&&(yield a_(n.call(s)))}finally{if(r)throw r.error}}})}[Symbol.asyncIterator](){return UDt(this,arguments,function*(){var r,n;try{for(var o=zDt(this.iterMessages()),i;i=yield a_(o.next()),!i.done;){let a=i.value;yield yield a_(a)}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&(yield a_(n.call(o)))}finally{if(r)throw r.error}}})}decodeChunk(e){let r="";if(typeof TextDecoder<"u"){let n=new TextDecoder("utf8");r+=n.decode(e)}else o6r.RUNTIME.type==="node"&&typeof e<"u"&&(r+=Buffer.isBuffer(e)?e:Buffer.from(e));return r}};Vm.Stream=fNe;function qDt(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return BDt(this,void 0,void 0,function*(){try{let r=yield e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}})},return(){return BDt(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}Vm.readableStreamAsyncIterable=qDt});var HDt=x(Cse=>{"use strict";Object.defineProperty(Cse,"__esModule",{value:!0});Cse.Stream=void 0;var a6r=pNe();Object.defineProperty(Cse,"Stream",{enumerable:!0,get:function(){return a6r.Stream}})});var KDt=x((j3o,WDt)=>{"use strict";var mNe=Object.defineProperty,s6r=Object.getOwnPropertyDescriptor,u6r=Object.getOwnPropertyNames,l6r=Object.prototype.hasOwnProperty,c6r=(t,e)=>{for(var r in e)mNe(t,r,{get:e[r],enumerable:!0})},d6r=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of u6r(e))!l6r.call(t,o)&&o!==r&&mNe(t,o,{get:()=>e[o],enumerable:!(n=s6r(e,o))||n.enumerable});return t},f6r=t=>d6r(mNe({},"__esModule",{value:!0}),t),VDt={};c6r(VDt,{Blob:()=>h6r,File:()=>g6r,FormData:()=>m6r});WDt.exports=f6r(VDt);var p6r=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:m6r,Blob:h6r,File:g6r}=p6r});var aLt=x((D3o,iLt)=>{"use strict";var yNe=Object.defineProperty,y6r=Object.getOwnPropertyDescriptor,b6r=Object.getOwnPropertyNames,_6r=Object.prototype.hasOwnProperty,v6r=(t,e)=>{for(var r in e)yNe(t,r,{get:e[r],enumerable:!0})},w6r=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of b6r(e))!_6r.call(t,o)&&o!==r&&yNe(t,o,{get:()=>e[o],enumerable:!(n=y6r(e,o))||n.enumerable});return t},x6r=t=>w6r(yNe({},"__esModule",{value:!0}),t),bNe=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},Ls=(t,e,r)=>(bNe(t,e,"read from private field"),r?r.call(t):e.get(t)),Mw=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},E9=(t,e,r,n)=>(bNe(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),hNe=(t,e,r)=>(bNe(t,e,"access private method"),r),eLt={};v6r(eLt,{FormDataEncoder:()=>I6r,isFile:()=>dL,isFormData:()=>nLt});iLt.exports=x6r(eLt);var wP=t=>typeof t=="function",S6r=t=>wP(t[Symbol.asyncIterator]),GDt=65536;function*tLt(t){if(t.byteLength<=GDt){yield t;return}let e=0;for(;e<t.byteLength;){let r=Math.min(t.byteLength-e,GDt),n=t.buffer.slice(e,e+r);e+=n.byteLength,yield new Uint8Array(n)}}async function*C6r(t){let e=t.getReader();for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}async function*JDt(t){for await(let e of t)yield*tLt(e)}var O6r=t=>{if(S6r(t))return JDt(t);if(wP(t.getReader))return JDt(C6r(t));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},ZDt="abcdefghijklmnopqrstuvwxyz0123456789";function E6r(){let t=16,e="";for(;t--;)e+=ZDt[Math.random()*ZDt.length<<0];return e}var rLt=t=>String(t).replace(/\r|\n/g,(e,r,n)=>e==="\r"&&n[r+1]!==`
`||e===`
`&&n[r-1]!=="\r"?`\r
`:e),P6r=t=>Object.prototype.toString.call(t).slice(8,-1).toLowerCase();function YDt(t){if(P6r(t)!=="object")return!1;let e=Object.getPrototypeOf(t);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}function XDt(t,e){if(typeof e=="string"){for(let[r,n]of Object.entries(t))if(e.toLowerCase()===r.toLowerCase())return n}}var T6r=t=>new Proxy(t,{get:(e,r)=>XDt(e,r),has:(e,r)=>XDt(e,r)!==void 0}),nLt=t=>!!(t&&wP(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&wP(t.append)&&wP(t.getAll)&&wP(t.entries)&&wP(t[Symbol.iterator])),QDt=t=>String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),dL=t=>!!(t&&typeof t=="object"&&wP(t.constructor)&&t[Symbol.toStringTag]==="File"&&wP(t.stream)&&t.name!=null),A6r={enableAdditionalHeaders:!1},Ose={writable:!1,configurable:!1},AM,P9,Ese,T9,cL,A9,I9,Pse,Tse,_Ne,gNe,oLt,I6r=class{constructor(t,e,r){if(Mw(this,Tse),Mw(this,gNe),Mw(this,AM,`\r
`),Mw(this,P9,void 0),Mw(this,Ese,void 0),Mw(this,T9,"-".repeat(2)),Mw(this,cL,new TextEncoder),Mw(this,A9,void 0),Mw(this,I9,void 0),Mw(this,Pse,void 0),!nLt(t))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(YDt(e)?r=e:n=e,n||(n=E6r()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!YDt(r))throw new TypeError("Expected options argument to be an object.");E9(this,I9,Array.from(t.entries())),E9(this,Pse,{...A6r,...r}),E9(this,P9,Ls(this,cL).encode(Ls(this,AM))),E9(this,Ese,Ls(this,P9).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,E9(this,A9,Ls(this,cL).encode(`${Ls(this,T9)}${this.boundary}${Ls(this,T9)}${Ls(this,AM).repeat(2)}`));let o={"Content-Type":this.contentType},i=hNe(this,gNe,oLt).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=T6r(Object.freeze(o)),Object.defineProperties(this,{boundary:Ose,contentType:Ose,contentLength:Ose,headers:Ose})}*values(){for(let[t,e]of Ls(this,I9)){let r=dL(e)?e:Ls(this,cL).encode(rLt(e));yield hNe(this,Tse,_Ne).call(this,t,r),yield r,yield Ls(this,P9)}yield Ls(this,A9)}async*encode(){for(let t of this.values())dL(t)?yield*O6r(t.stream()):yield*tLt(t)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};AM=new WeakMap;P9=new WeakMap;Ese=new WeakMap;T9=new WeakMap;cL=new WeakMap;A9=new WeakMap;I9=new WeakMap;Pse=new WeakMap;Tse=new WeakSet;_Ne=function(t,e){let r="";if(r+=`${Ls(this,T9)}${this.boundary}${Ls(this,AM)}`,r+=`Content-Disposition: form-data; name="${QDt(t)}"`,dL(e)&&(r+=`; filename="${QDt(e.name)}"${Ls(this,AM)}`,r+=`Content-Type: ${e.type||"application/octet-stream"}`),Ls(this,Pse).enableAdditionalHeaders===!0){let n=dL(e)?e.size:e.byteLength;n!=null&&!isNaN(n)&&(r+=`${Ls(this,AM)}Content-Length: ${n}`)}return Ls(this,cL).encode(`${r}${Ls(this,AM).repeat(2)}`)};gNe=new WeakSet;oLt=function(){let t=0;for(let[e,r]of Ls(this,I9)){let n=dL(r)?r:Ls(this,cL).encode(rLt(r)),o=dL(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;t+=hNe(this,Tse,_Ne).call(this,e,n).byteLength,t+=o,t+=Ls(this,Ese)}return String(t+Ls(this,A9).byteLength)}});var uLt=x((F3o,sLt)=>{"use strict";sLt.exports=typeof self=="object"?self.FormData:window.FormData});var lLt=x(qc=>{"use strict";var M6r=qc&&qc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R6r=qc&&qc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Eq=qc&&qc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&M6r(e,t,r);return R6r(e,t),e},IM=qc&&qc.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(qc,"__esModule",{value:!0});qc.WebFormData=qc.Node16FormData=qc.Node18FormData=qc.newFormData=void 0;var Ase=hq();function vNe(t){return typeof t=="object"&&t!=null&&"name"in t}function N6r(){return IM(this,void 0,void 0,function*(){let t;return Ase.RUNTIME.type==="node"&&Ase.RUNTIME.parsedVersion!=null&&Ase.RUNTIME.parsedVersion>=18?t=new Ise:Ase.RUNTIME.type==="node"?t=new Mse:t=new Rse,yield t.setup(),t})}qc.newFormData=N6r;var Ise=class{setup(){return IM(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>Eq(KDt()))).FormData})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){var o,i;return IM(this,void 0,void 0,function*(){n==null&&vNe(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>Eq(m9()))).Readable?(o=this.fd)===null||o===void 0||o.append(e,{type:void 0,name:n,[Symbol.toStringTag]:"File",stream(){return r}}):(i=this.fd)===null||i===void 0||i.append(e,r,n)})}getRequest(){return IM(this,void 0,void 0,function*(){let e=new(yield Promise.resolve().then(()=>Eq(aLt()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>Eq(m9()))).Readable.from(e),headers:e.headers,duplex:"half"}})}};qc.Node18FormData=Ise;var Mse=class{setup(){return IM(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>Eq(uLt()))).default})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){var o,i;return IM(this,void 0,void 0,function*(){n==null&&vNe(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>Eq(m9()))).Readable?a=r:a=Buffer.from(yield r.arrayBuffer()),n==null?(o=this.fd)===null||o===void 0||o.append(e,a):(i=this.fd)===null||i===void 0||i.append(e,a,{filename:n})})}getRequest(){return{body:this.fd,headers:this.fd?this.fd.getHeaders():{}}}};qc.Node16FormData=Mse;var Rse=class{setup(){return IM(this,void 0,void 0,function*(){this.fd=new FormData})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){var o;return IM(this,void 0,void 0,function*(){n==null&&vNe(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(e,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};qc.WebFormData=Rse});var cLt=x(fL=>{"use strict";var j6r=fL&&fL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),D6r=fL&&fL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&j6r(e,t,r)};Object.defineProperty(fL,"__esModule",{value:!0});D6r(lLt(),fL)});var Dd=x(Nse=>{"use strict";Object.defineProperty(Nse,"__esModule",{value:!0});Nse.SchemaType=void 0;Nse.SchemaType={DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"}});var Wm=x(jse=>{"use strict";Object.defineProperty(jse,"__esModule",{value:!0});jse.getErrorMessageForIncorrectType=void 0;function L6r(t,e){return`Expected ${e}. Received ${F6r(t)}.`}jse.getErrorMessageForIncorrectType=L6r;function F6r(t){if(Array.isArray(t))return"list";if(t===null)return"null";switch(typeof t){case"string":return`"${t}"`;case"number":case"boolean":case"undefined":return`${t}`}return typeof t}});var xP=x(Dse=>{"use strict";Object.defineProperty(Dse,"__esModule",{value:!0});Dse.maybeSkipValidation=void 0;function k6r(t){return Object.assign(Object.assign({},t),{json:dLt(t.json),parse:dLt(t.parse)})}Dse.maybeSkipValidation=k6r;function dLt(t){return(e,r)=>{let n=t(e,r),{skipValidation:o=!1}=r??{};return!n.ok&&o?(console.warn(["Failed to validate.",...n.errors.map(i=>" - "+(i.path.length>0?`${i.path.join(".")}: ${i.message}`:i.message))].join(`
`)),{ok:!0,value:e}):n}}});var wNe=x(Lse=>{"use strict";Object.defineProperty(Lse,"__esModule",{value:!0});Lse.stringifyValidationError=void 0;function $6r(t){return t.path.length===0?t.message:`${t.path.join(" -> ")}: ${t.message}`}Lse.stringifyValidationError=$6r});var SNe=x(Fse=>{"use strict";Object.defineProperty(Fse,"__esModule",{value:!0});Fse.JsonError=void 0;var B6r=wNe(),xNe=class t extends Error{constructor(e){super(e.map(B6r.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};Fse.JsonError=xNe});var ONe=x(kse=>{"use strict";Object.defineProperty(kse,"__esModule",{value:!0});kse.ParseError=void 0;var z6r=wNe(),CNe=class t extends Error{constructor(e){super(e.map(z6r.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};kse.ParseError=CNe});var mLt=x(MM=>{"use strict";Object.defineProperty(MM,"__esModule",{value:!0});MM.transform=MM.optional=MM.getSchemaUtils=void 0;var U6r=Dd(),q6r=SNe(),H6r=ONe();function ENe(t){return{optional:()=>fLt(t),transform:e=>pLt(t,e),parseOrThrow:(e,r)=>{let n=t.parse(e,r);if(n.ok)return n.value;throw new H6r.ParseError(n.errors)},jsonOrThrow:(e,r)=>{let n=t.json(e,r);if(n.ok)return n.value;throw new q6r.JsonError(n.errors)}}}MM.getSchemaUtils=ENe;function fLt(t){let e={parse:(r,n)=>r==null?{ok:!0,value:void 0}:t.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:t.json(r,n),getType:()=>U6r.SchemaType.OPTIONAL};return Object.assign(Object.assign({},e),ENe(e))}MM.optional=fLt;function pLt(t,e){let r={parse:(n,o)=>{let i=t.parse(n,o);return i.ok?{ok:!0,value:e.transform(i.value)}:i},json:(n,o)=>{let i=e.untransform(n);return t.json(i,o)},getType:()=>t.getType()};return Object.assign(Object.assign({},r),ENe(r))}MM.transform=pLt});var Zh=x(Py=>{"use strict";Object.defineProperty(Py,"__esModule",{value:!0});Py.ParseError=Py.JsonError=Py.transform=Py.optional=Py.getSchemaUtils=void 0;var PNe=mLt();Object.defineProperty(Py,"getSchemaUtils",{enumerable:!0,get:function(){return PNe.getSchemaUtils}});Object.defineProperty(Py,"optional",{enumerable:!0,get:function(){return PNe.optional}});Object.defineProperty(Py,"transform",{enumerable:!0,get:function(){return PNe.transform}});var V6r=SNe();Object.defineProperty(Py,"JsonError",{enumerable:!0,get:function(){return V6r.JsonError}});var W6r=ONe();Object.defineProperty(Py,"ParseError",{enumerable:!0,get:function(){return W6r.ParseError}})});var hLt=x($se=>{"use strict";Object.defineProperty($se,"__esModule",{value:!0});$se.date=void 0;var K6r=Dd(),TNe=Wm(),G6r=xP(),J6r=Zh(),Z6r=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function Y6r(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="string"?{ok:!1,errors:[{path:r,message:(0,TNe.getErrorMessageForIncorrectType)(e,"string")}]}:Z6r.test(e)?{ok:!0,value:new Date(e)}:{ok:!1,errors:[{path:r,message:(0,TNe.getErrorMessageForIncorrectType)(e,"ISO 8601 date string")}]},json:(e,{breadcrumbsPrefix:r=[]}={})=>e instanceof Date?{ok:!0,value:e.toISOString()}:{ok:!1,errors:[{path:r,message:(0,TNe.getErrorMessageForIncorrectType)(e,"Date object")}]},getType:()=>K6r.SchemaType.DATE};return Object.assign(Object.assign({},(0,G6r.maybeSkipValidation)(t)),(0,J6r.getSchemaUtils)(t))}$se.date=Y6r});var gLt=x(Bse=>{"use strict";Object.defineProperty(Bse,"__esModule",{value:!0});Bse.date=void 0;var X6r=hLt();Object.defineProperty(Bse,"date",{enumerable:!0,get:function(){return X6r.date}})});var SP=x(zse=>{"use strict";Object.defineProperty(zse,"__esModule",{value:!0});zse.createIdentitySchemaCreator=void 0;var Q6r=Zh(),e8r=xP();function t8r(t,e){return()=>{let r={parse:e,json:e,getType:()=>t};return Object.assign(Object.assign({},(0,e8r.maybeSkipValidation)(r)),(0,Q6r.getSchemaUtils)(r))}}zse.createIdentitySchemaCreator=t8r});var bLt=x(Use=>{"use strict";Object.defineProperty(Use,"__esModule",{value:!0});Use.enum_=void 0;var r8r=Dd(),n8r=SP(),yLt=Wm();function o8r(t){let e=new Set(t);return(0,n8r.createIdentitySchemaCreator)(r8r.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,yLt.getErrorMessageForIncorrectType)(n,"string")}]}:!e.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,yLt.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}Use.enum_=o8r});var ANe=x(qse=>{"use strict";Object.defineProperty(qse,"__esModule",{value:!0});qse.enum_=void 0;var i8r=bLt();Object.defineProperty(qse,"enum_",{enumerable:!0,get:function(){return i8r.enum_}})});var INe=x(RM=>{"use strict";Object.defineProperty(RM,"__esModule",{value:!0});RM.getMemoizedSchema=RM.constructLazyBaseSchema=RM.lazy=void 0;var a8r=Zh();function s8r(t){let e=_Lt(t);return Object.assign(Object.assign({},e),(0,a8r.getSchemaUtils)(e))}RM.lazy=s8r;function _Lt(t){return{parse:(e,r)=>Hse(t).parse(e,r),json:(e,r)=>Hse(t).json(e,r),getType:()=>Hse(t).getType()}}RM.constructLazyBaseSchema=_Lt;function Hse(t){let e=t;return e.__zurg_memoized==null&&(e.__zurg_memoized=t()),e.__zurg_memoized}RM.getMemoizedSchema=Hse});var MNe=x(Vse=>{"use strict";Object.defineProperty(Vse,"__esModule",{value:!0});Vse.entries=void 0;function u8r(t){return Object.entries(t)}Vse.entries=u8r});var RNe=x(Wse=>{"use strict";Object.defineProperty(Wse,"__esModule",{value:!0});Wse.filterObject=void 0;function l8r(t,e){let r=new Set(e);return Object.entries(t).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}Wse.filterObject=l8r});var M9=x(Kse=>{"use strict";Object.defineProperty(Kse,"__esModule",{value:!0});Kse.isPlainObject=void 0;function c8r(t){if(typeof t!="object"||t===null)return!1;if(Object.getPrototypeOf(t)===null)return!0;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}Kse.isPlainObject=c8r});var NNe=x(Gse=>{"use strict";Object.defineProperty(Gse,"__esModule",{value:!0});Gse.keys=void 0;function d8r(t){return Object.keys(t)}Gse.keys=d8r});var vLt=x(Jse=>{"use strict";Object.defineProperty(Jse,"__esModule",{value:!0});Jse.partition=void 0;function f8r(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}Jse.partition=f8r});var SLt=x(Pq=>{"use strict";Object.defineProperty(Pq,"__esModule",{value:!0});Pq.withParsedProperties=Pq.getObjectLikeUtils=void 0;var p8r=RNe(),m8r=Wm(),h8r=M9(),g8r=Zh();function wLt(t){return{withParsedProperties:e=>xLt(t,e)}}Pq.getObjectLikeUtils=wLt;function xLt(t,e){let r={parse:(n,o)=>{let i=t.parse(n,o);if(!i.ok)return i;let a=Object.entries(e).reduce((s,[u,l])=>Object.assign(Object.assign({},s),{[u]:typeof l=="function"?l(i.value):l}),{});return{ok:!0,value:Object.assign(Object.assign({},i.value),a)}},json:(n,o)=>{var i;if(!(0,h8r.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,m8r.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(e)),s=(0,p8r.filterObject)(n,Object.keys(n).filter(u=>!a.has(u)));return t.json(s,o)},getType:()=>t.getType()};return Object.assign(Object.assign(Object.assign({},r),(0,g8r.getSchemaUtils)(r)),wLt(r))}Pq.withParsedProperties=xLt});var R9=x(Tq=>{"use strict";Object.defineProperty(Tq,"__esModule",{value:!0});Tq.withParsedProperties=Tq.getObjectLikeUtils=void 0;var CLt=SLt();Object.defineProperty(Tq,"getObjectLikeUtils",{enumerable:!0,get:function(){return CLt.getObjectLikeUtils}});Object.defineProperty(Tq,"withParsedProperties",{enumerable:!0,get:function(){return CLt.withParsedProperties}})});var jNe=x(Aq=>{"use strict";Object.defineProperty(Aq,"__esModule",{value:!0});Aq.isProperty=Aq.property=void 0;function y8r(t,e){return{rawKey:t,valueSchema:e,isProperty:!0}}Aq.property=y8r;function b8r(t){return t.isProperty}Aq.isProperty=b8r});var LNe=x(Iq=>{"use strict";Object.defineProperty(Iq,"__esModule",{value:!0});Iq.getObjectUtils=Iq.object=void 0;var j9=Dd(),OLt=MNe(),ELt=RNe(),_8r=Wm(),v8r=M9(),ILt=NNe(),w8r=xP(),x8r=vLt(),MLt=R9(),RLt=Zh(),N9=jNe();function S8r(t){let e={_getRawProperties:()=>Object.entries(t).map(([r,n])=>(0,N9.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,ILt.keys)(t),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,OLt.entries)(t)){let u=(0,N9.isProperty)(s)?s.rawKey:a,l=(0,N9.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,ALt(l)&&i.push(u)}return PLt({value:r,requiredKeys:i,getProperty:a=>{let s=o[a];if(s!=null)return{transformedKey:s.parsedKey,transform:u=>{var l;return s.valueSchema.parse(u,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(l=n?.breadcrumbsPrefix)!==null&&l!==void 0?l:[],a]}))}}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let o=[];for(let[i,a]of(0,OLt.entries)(t)){let s=(0,N9.isProperty)(a)?a.valueSchema:a;ALt(s)&&o.push(i)}return PLt({value:r,requiredKeys:o,getProperty:i=>{let a=t[i];if(a!=null)return(0,N9.isProperty)(a)?{transformedKey:a.rawKey,transform:s=>{var u;return a.valueSchema.json(s,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(u=n?.breadcrumbsPrefix)!==null&&u!==void 0?u:[],i]}))}}:{transformedKey:i,transform:s=>{var u;return a.json(s,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(u=n?.breadcrumbsPrefix)!==null&&u!==void 0?u:[],i]}))}}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>j9.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,w8r.maybeSkipValidation)(e)),(0,RLt.getSchemaUtils)(e)),(0,MLt.getObjectLikeUtils)(e)),DNe(e))}Iq.object=S8r;function PLt({value:t,requiredKeys:e,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,v8r.isPlainObject)(t))return{ok:!1,errors:[{path:i,message:(0,_8r.getErrorMessageForIncorrectType)(t,"object")}]};let a=new Set(e),s=[],u={};for(let[l,c]of Object.entries(t)){let d=r(l);if(d!=null){a.delete(l);let f=d.transform(c);f.ok?u[d.transformedKey]=f.value:(u[l]=c,s.push(...f.errors))}else switch(n){case"fail":s.push({path:[...i,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":u[l]=c;break}}return s.push(...e.filter(l=>a.has(l)).map(l=>({path:i,message:`Missing required key "${l}"`}))),s.length===0||o?{ok:!0,value:u}:{ok:!1,errors:s}}function DNe(t){return{extend:e=>{let r={_getParsedProperties:()=>[...t._getParsedProperties(),...e._getParsedProperties()],_getRawProperties:()=>[...t._getRawProperties(),...e._getRawProperties()],parse:(n,o)=>TLt({extensionKeys:e._getRawProperties(),value:n,transformBase:i=>t.parse(i,o),transformExtension:i=>e.parse(i,o)}),json:(n,o)=>TLt({extensionKeys:e._getParsedProperties(),value:n,transformBase:i=>t.json(i,o),transformExtension:i=>e.json(i,o)}),getType:()=>j9.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,RLt.getSchemaUtils)(r)),(0,MLt.getObjectLikeUtils)(r)),DNe(r))}}}Iq.getObjectUtils=DNe;function TLt({extensionKeys:t,value:e,transformBase:r,transformExtension:n}){let o=new Set(t),[i,a]=(0,x8r.partition)((0,ILt.keys)(e),l=>o.has(l)),s=r((0,ELt.filterObject)(e,a)),u=n((0,ELt.filterObject)(e,i));return s.ok&&u.ok?{ok:!0,value:Object.assign(Object.assign({},s.value),u.value)}:{ok:!1,errors:[...s.ok?[]:s.errors,...u.ok?[]:u.errors]}}function ALt(t){return!C8r(t)}function C8r(t){switch(t.getType()){case j9.SchemaType.ANY:case j9.SchemaType.UNKNOWN:case j9.SchemaType.OPTIONAL:return!0;default:return!1}}});var NLt=x(Zse=>{"use strict";Object.defineProperty(Zse,"__esModule",{value:!0});Zse.objectWithoutOptionalProperties=void 0;var O8r=LNe();function E8r(t){return(0,O8r.object)(t)}Zse.objectWithoutOptionalProperties=E8r});var FNe=x(Ty=>{"use strict";Object.defineProperty(Ty,"__esModule",{value:!0});Ty.property=Ty.isProperty=Ty.objectWithoutOptionalProperties=Ty.object=Ty.getObjectUtils=void 0;var jLt=LNe();Object.defineProperty(Ty,"getObjectUtils",{enumerable:!0,get:function(){return jLt.getObjectUtils}});Object.defineProperty(Ty,"object",{enumerable:!0,get:function(){return jLt.object}});var P8r=NLt();Object.defineProperty(Ty,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return P8r.objectWithoutOptionalProperties}});var DLt=jNe();Object.defineProperty(Ty,"isProperty",{enumerable:!0,get:function(){return DLt.isProperty}});Object.defineProperty(Ty,"property",{enumerable:!0,get:function(){return DLt.property}})});var LLt=x(Yse=>{"use strict";Object.defineProperty(Yse,"__esModule",{value:!0});Yse.lazyObject=void 0;var T8r=FNe(),A8r=R9(),I8r=Zh(),kNe=INe();function M8r(t){let e=Object.assign(Object.assign({},(0,kNe.constructLazyBaseSchema)(t)),{_getRawProperties:()=>(0,kNe.getMemoizedSchema)(t)._getRawProperties(),_getParsedProperties:()=>(0,kNe.getMemoizedSchema)(t)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,I8r.getSchemaUtils)(e)),(0,A8r.getObjectLikeUtils)(e)),(0,T8r.getObjectUtils)(e))}Yse.lazyObject=M8r});var FLt=x(Mq=>{"use strict";Object.defineProperty(Mq,"__esModule",{value:!0});Mq.lazyObject=Mq.lazy=void 0;var R8r=INe();Object.defineProperty(Mq,"lazy",{enumerable:!0,get:function(){return R8r.lazy}});var N8r=LLt();Object.defineProperty(Mq,"lazyObject",{enumerable:!0,get:function(){return N8r.lazyObject}})});var $Lt=x(Xse=>{"use strict";Object.defineProperty(Xse,"__esModule",{value:!0});Xse.list=void 0;var j8r=Dd(),D8r=Wm(),L8r=xP(),F8r=Zh();function k8r(t){let e={parse:(r,n)=>kLt(r,(o,i)=>{var a;return t.parse(o,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(a=n?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`[${i}]`]}))}),json:(r,n)=>kLt(r,(o,i)=>{var a;return t.json(o,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(a=n?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`[${i}]`]}))}),getType:()=>j8r.SchemaType.LIST};return Object.assign(Object.assign({},(0,L8r.maybeSkipValidation)(e)),(0,F8r.getSchemaUtils)(e))}Xse.list=k8r;function kLt(t,e){return Array.isArray(t)?t.map((n,o)=>e(n,o)).reduce((n,o)=>{if(n.ok&&o.ok)return{ok:!0,value:[...n.value,o.value]};let i=[];return n.ok||i.push(...n.errors),o.ok||i.push(...o.errors),{ok:!1,errors:i}},{ok:!0,value:[]}):{ok:!1,errors:[{message:(0,D8r.getErrorMessageForIncorrectType)(t,"list"),path:[]}]}}});var $Ne=x(Qse=>{"use strict";Object.defineProperty(Qse,"__esModule",{value:!0});Qse.list=void 0;var $8r=$Lt();Object.defineProperty(Qse,"list",{enumerable:!0,get:function(){return $8r.list}})});var BLt=x(eue=>{"use strict";Object.defineProperty(eue,"__esModule",{value:!0});eue.stringLiteral=void 0;var B8r=Dd(),z8r=SP(),U8r=Wm();function q8r(t){return(0,z8r.createIdentitySchemaCreator)(B8r.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,U8r.getErrorMessageForIncorrectType)(r,`"${t}"`)}]})()}eue.stringLiteral=q8r});var zLt=x(tue=>{"use strict";Object.defineProperty(tue,"__esModule",{value:!0});tue.booleanLiteral=void 0;var H8r=Dd(),V8r=SP(),W8r=Wm();function K8r(t){return(0,V8r.createIdentitySchemaCreator)(H8r.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,W8r.getErrorMessageForIncorrectType)(r,`${t.toString()}`)}]})()}tue.booleanLiteral=K8r});var ULt=x(Rq=>{"use strict";Object.defineProperty(Rq,"__esModule",{value:!0});Rq.booleanLiteral=Rq.stringLiteral=void 0;var G8r=BLt();Object.defineProperty(Rq,"stringLiteral",{enumerable:!0,get:function(){return G8r.stringLiteral}});var J8r=zLt();Object.defineProperty(Rq,"booleanLiteral",{enumerable:!0,get:function(){return J8r.booleanLiteral}})});var qLt=x(rue=>{"use strict";Object.defineProperty(rue,"__esModule",{value:!0});rue.any=void 0;var Z8r=Dd(),Y8r=SP();rue.any=(0,Y8r.createIdentitySchemaCreator)(Z8r.SchemaType.ANY,t=>({ok:!0,value:t}))});var HLt=x(nue=>{"use strict";Object.defineProperty(nue,"__esModule",{value:!0});nue.boolean=void 0;var X8r=Dd(),Q8r=SP(),e5r=Wm();nue.boolean=(0,Q8r.createIdentitySchemaCreator)(X8r.SchemaType.BOOLEAN,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="boolean"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,e5r.getErrorMessageForIncorrectType)(t,"boolean")}]})});var VLt=x(oue=>{"use strict";Object.defineProperty(oue,"__esModule",{value:!0});oue.number=void 0;var t5r=Dd(),r5r=SP(),n5r=Wm();oue.number=(0,r5r.createIdentitySchemaCreator)(t5r.SchemaType.NUMBER,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="number"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,n5r.getErrorMessageForIncorrectType)(t,"number")}]})});var WLt=x(iue=>{"use strict";Object.defineProperty(iue,"__esModule",{value:!0});iue.string=void 0;var o5r=Dd(),i5r=SP(),a5r=Wm();iue.string=(0,i5r.createIdentitySchemaCreator)(o5r.SchemaType.STRING,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="string"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,a5r.getErrorMessageForIncorrectType)(t,"string")}]})});var KLt=x(aue=>{"use strict";Object.defineProperty(aue,"__esModule",{value:!0});aue.unknown=void 0;var s5r=Dd(),u5r=SP();aue.unknown=(0,u5r.createIdentitySchemaCreator)(s5r.SchemaType.UNKNOWN,t=>({ok:!0,value:t}))});var GLt=x(Ay=>{"use strict";Object.defineProperty(Ay,"__esModule",{value:!0});Ay.unknown=Ay.string=Ay.number=Ay.boolean=Ay.any=void 0;var l5r=qLt();Object.defineProperty(Ay,"any",{enumerable:!0,get:function(){return l5r.any}});var c5r=HLt();Object.defineProperty(Ay,"boolean",{enumerable:!0,get:function(){return c5r.boolean}});var d5r=VLt();Object.defineProperty(Ay,"number",{enumerable:!0,get:function(){return d5r.number}});var f5r=WLt();Object.defineProperty(Ay,"string",{enumerable:!0,get:function(){return f5r.string}});var p5r=KLt();Object.defineProperty(Ay,"unknown",{enumerable:!0,get:function(){return p5r.unknown}})});var ZLt=x(sue=>{"use strict";Object.defineProperty(sue,"__esModule",{value:!0});sue.record=void 0;var BNe=Dd(),m5r=MNe(),h5r=Wm(),g5r=M9(),y5r=xP(),b5r=Zh();function _5r(t,e){let r={parse:(n,o)=>JLt({value:n,isKeyNumeric:t.getType()===BNe.SchemaType.NUMBER,transformKey:i=>{var a;return t.parse(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(a=o?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`${i} (key)`]}))},transformValue:(i,a)=>{var s;return e.parse(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(s=o?.breadcrumbsPrefix)!==null&&s!==void 0?s:[],`${a}`]}))},breadcrumbsPrefix:o?.breadcrumbsPrefix}),json:(n,o)=>JLt({value:n,isKeyNumeric:t.getType()===BNe.SchemaType.NUMBER,transformKey:i=>{var a;return t.json(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(a=o?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`${i} (key)`]}))},transformValue:(i,a)=>{var s;return e.json(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(s=o?.breadcrumbsPrefix)!==null&&s!==void 0?s:[],`${a}`]}))},breadcrumbsPrefix:o?.breadcrumbsPrefix}),getType:()=>BNe.SchemaType.RECORD};return Object.assign(Object.assign({},(0,y5r.maybeSkipValidation)(r)),(0,b5r.getSchemaUtils)(r))}sue.record=_5r;function JLt({value:t,isKeyNumeric:e,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,g5r.isPlainObject)(t)?(0,m5r.entries)(t).reduce((i,[a,s])=>{if(s==null)return i;let u=i,l=a;if(e){let p=a.length>0?Number(a):NaN;isNaN(p)||(l=p)}let c=r(l),d=n(s,l);if(u.ok&&c.ok&&d.ok)return{ok:!0,value:Object.assign(Object.assign({},u.value),{[c.value]:d.value})};let f=[];return u.ok||f.push(...u.errors),c.ok||f.push(...c.errors),d.ok||f.push(...d.errors),{ok:!1,errors:f}},{ok:!0,value:{}}):{ok:!1,errors:[{path:o,message:(0,h5r.getErrorMessageForIncorrectType)(t,"object")}]}}});var YLt=x(uue=>{"use strict";Object.defineProperty(uue,"__esModule",{value:!0});uue.record=void 0;var v5r=ZLt();Object.defineProperty(uue,"record",{enumerable:!0,get:function(){return v5r.record}})});var XLt=x(lue=>{"use strict";Object.defineProperty(lue,"__esModule",{value:!0});lue.set=void 0;var w5r=Dd(),x5r=Wm(),S5r=xP(),C5r=$Ne(),O5r=Zh();function E5r(t){let e=(0,C5r.list)(t),r={parse:(n,o)=>{let i=e.parse(n,o);return i.ok?{ok:!0,value:new Set(i.value)}:i},json:(n,o)=>{var i;return n instanceof Set?e.json([...n],o):{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,x5r.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>w5r.SchemaType.SET};return Object.assign(Object.assign({},(0,S5r.maybeSkipValidation)(r)),(0,O5r.getSchemaUtils)(r))}lue.set=E5r});var QLt=x(cue=>{"use strict";Object.defineProperty(cue,"__esModule",{value:!0});cue.set=void 0;var P5r=XLt();Object.defineProperty(cue,"set",{enumerable:!0,get:function(){return P5r.set}})});var tFt=x(due=>{"use strict";Object.defineProperty(due,"__esModule",{value:!0});due.undiscriminatedUnion=void 0;var T5r=Dd(),A5r=xP(),I5r=Zh();function M5r(t){let e={parse:(r,n)=>eFt((o,i)=>o.parse(r,i),t,n),json:(r,n)=>eFt((o,i)=>o.json(r,i),t,n),getType:()=>T5r.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,A5r.maybeSkipValidation)(e)),(0,I5r.getSchemaUtils)(e))}due.undiscriminatedUnion=M5r;function eFt(t,e,r){let n=[];for(let[o,i]of e.entries()){let a=t(i,Object.assign(Object.assign({},r),{skipValidation:!1}));if(a.ok)return a;for(let s of a.errors)n.push({path:s.path,message:`[Variant ${o}] ${s.message}`})}return{ok:!1,errors:n}}});var rFt=x(fue=>{"use strict";Object.defineProperty(fue,"__esModule",{value:!0});fue.undiscriminatedUnion=void 0;var R5r=tFt();Object.defineProperty(fue,"undiscriminatedUnion",{enumerable:!0,get:function(){return R5r.undiscriminatedUnion}})});var nFt=x(pue=>{"use strict";Object.defineProperty(pue,"__esModule",{value:!0});pue.discriminant=void 0;function N5r(t,e){return{parsedDiscriminant:t,rawDiscriminant:e}}pue.discriminant=N5r});var iFt=x(Nq=>{"use strict";var j5r=Nq&&Nq.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r};Object.defineProperty(Nq,"__esModule",{value:!0});Nq.union=void 0;var D5r=Dd(),L5r=Wm(),F5r=M9(),k5r=NNe(),$5r=xP(),B5r=ANe(),z5r=R9(),U5r=Zh();function q5r(t,e){let r=typeof t=="string"?t:t.rawDiscriminant,n=typeof t=="string"?t:t.parsedDiscriminant,o=(0,B5r.enum_)((0,k5r.keys)(e)),i={parse:(a,s)=>oFt({value:a,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:u=>{var l;return o.parse(u,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(l=s?.breadcrumbsPrefix)!==null&&l!==void 0?l:[],r]})},getAdditionalPropertiesSchema:u=>e[u],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,l)=>l.parse(u,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(a,s)=>oFt({value:a,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:u=>{var l;return o.json(u,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(l=s?.breadcrumbsPrefix)!==null&&l!==void 0?l:[],n]})},getAdditionalPropertiesSchema:u=>e[u],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,l)=>l.json(u,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>D5r.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,$5r.maybeSkipValidation)(i)),(0,U5r.getSchemaUtils)(i)),(0,z5r.getObjectLikeUtils)(i))}Nq.union=q5r;function oFt({value:t,discriminant:e,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,F5r.isPlainObject)(t))return{ok:!1,errors:[{path:s,message:(0,L5r.getErrorMessageForIncorrectType)(t,"object")}]};let u=t,l=e,c=u[l],d=j5r(u,[typeof l=="symbol"?l:l+""]);if(c==null)return{ok:!1,errors:[{path:s,message:`Missing discriminant ("${e}")`}]};let f=n(c);if(!f.ok)return{ok:!1,errors:f.errors};let p=o(f.value);if(p==null)return i?{ok:!0,value:Object.assign({[r]:f.value},d)}:{ok:!1,errors:[{path:[...s,e],message:"Unexpected discriminant value"}]};let m=a(d,p);return m.ok?{ok:!0,value:Object.assign({[r]:c},m.value)}:m}});var aFt=x(jq=>{"use strict";Object.defineProperty(jq,"__esModule",{value:!0});jq.union=jq.discriminant=void 0;var H5r=nFt();Object.defineProperty(jq,"discriminant",{enumerable:!0,get:function(){return H5r.discriminant}});var V5r=iFt();Object.defineProperty(jq,"union",{enumerable:!0,get:function(){return V5r.union}})});var sFt=x(gc=>{"use strict";var W5r=gc&&gc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yh=gc&&gc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&W5r(e,t,r)};Object.defineProperty(gc,"__esModule",{value:!0});Yh(gLt(),gc);Yh(ANe(),gc);Yh(FLt(),gc);Yh($Ne(),gc);Yh(ULt(),gc);Yh(FNe(),gc);Yh(R9(),gc);Yh(GLt(),gc);Yh(YLt(),gc);Yh(Zh(),gc);Yh(QLt(),gc);Yh(rFt(),gc);Yh(aFt(),gc)});var uFt=x(pL=>{"use strict";var K5r=pL&&pL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),G5r=pL&&pL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&K5r(e,t,r)};Object.defineProperty(pL,"__esModule",{value:!0});G5r(sFt(),pL)});var Y=x(Ld=>{"use strict";var lFt=Ld&&Ld.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J5r=Ld&&Ld.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D9=Ld&&Ld.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&lFt(e,t,r)},Z5r=Ld&&Ld.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lFt(e,t,r);return J5r(e,t),e};Object.defineProperty(Ld,"__esModule",{value:!0});Ld.serialization=void 0;D9(jDt(),Ld);D9($Dt(),Ld);D9(HDt(),Ld);D9(hq(),Ld);D9(cLt(),Ld);Ld.serialization=Z5r(uFt())});var dFt=x(Eu=>{"use strict";var L9=Eu&&Eu.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},F9=Eu&&Eu.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}},Ka=Eu&&Eu.__await||function(t){return this instanceof Ka?(this.v=t,this):new Ka(t)},k9=Eu&&Eu.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof Ka?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){s("next",f)}function c(f){s("throw",f)}function d(f,p){f(p),i.shift(),i.length&&s(i[0][0],i[0][1])}};Object.defineProperty(Eu,"__esModule",{value:!0});Eu.readableStreamAsyncIterable=Eu._decodeChunks=Eu.LineDecoder=Eu._iterSSEMessages=Eu.StreamUtils=void 0;var Dq=au(),zNe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;function o(){return k9(this,arguments,function*(){var a,s;if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let u=!1;try{try{for(var l=F9(cFt(e,r)),c;c=yield Ka(l.next()),!c.done;){let d=c.value;if(!u){if(d.data.startsWith("[DONE]")){u=!0;continue}if(d.event===null){let f;try{f=JSON.parse(d.data)}catch(p){throw console.error("Could not parse message into JSON:",d.data),console.error("From chunk:",d.raw),p}if(f&&f.error)throw new Dq.CohereError({message:`Error: ${f.error}`});yield yield Ka(f)}else{let f;try{f=JSON.parse(d.data)}catch(p){throw console.error("Could not parse message into JSON:",d.data),console.error("From chunk:",d.raw),p}if(d.event=="error")throw new Dq.CohereError({message:`Error: ${f.message}, ${f.error}`});yield yield Ka({event:d.event,data:f})}}}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=l.return)&&(yield Ka(s.call(l)))}finally{if(a)throw a.error}}u=!0}catch(d){if(d instanceof Error&&d.name==="AbortError")return yield Ka(void 0);throw d}finally{u||r?.abort()}})}return new t(o,r)}static fromReadableStream(e,r){let n=!1;function o(){return k9(this,arguments,function*(){var s,u;let l=new NM,c=qNe(e);try{for(var d=F9(c),f;f=yield Ka(d.next()),!f.done;){let p=f.value;for(let m of l.decode(p))yield yield Ka(m)}}catch(p){s={error:p}}finally{try{f&&!f.done&&(u=d.return)&&(yield Ka(u.call(d)))}finally{if(s)throw s.error}}for(let p of l.flush())yield yield Ka(p)})}function i(){return k9(this,arguments,function*(){var s,u;if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let l=!1;try{try{for(var c=F9(o()),d;d=yield Ka(c.next()),!d.done;){let f=d.value;l||f&&(yield yield Ka(JSON.parse(f)))}}catch(f){s={error:f}}finally{try{d&&!d.done&&(u=c.return)&&(yield Ka(u.call(c)))}finally{if(s)throw s.error}}l=!0}catch(f){if(f instanceof Error&&f.name==="AbortError")return yield Ka(void 0);throw f}finally{l||r?.abort()}})}return new t(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller),new t(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new ReadableStream({start(){return L9(this,void 0,void 0,function*(){r=e[Symbol.asyncIterator]()})},pull(o){return L9(this,void 0,void 0,function*(){try{let{value:i,done:a}=yield r.next();if(a)return o.close();let s=n.encode(JSON.stringify(i)+`
`);o.enqueue(s)}catch(i){o.error(i)}})},cancel(){var o;return L9(this,void 0,void 0,function*(){yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};Eu.StreamUtils=zNe;function cFt(t,e){return k9(this,arguments,function*(){var n,o;if(!t.body)throw e?.abort(),new Dq.CohereError({message:"Attempted to iterate over a response with no body"});let i=new UNe,a=new NM,s=qNe(t.body);try{for(var u=F9(Y5r(s)),l;l=yield Ka(u.next()),!l.done;){let c=l.value;for(let d of a.decode(c)){let f=i.decode(d);f&&(yield yield Ka(f))}}}catch(c){n={error:c}}finally{try{l&&!l.done&&(o=u.return)&&(yield Ka(o.call(u)))}finally{if(n)throw n.error}}for(let c of a.flush()){let d=i.decode(c);d&&(yield yield Ka(d))}})}Eu._iterSSEMessages=cFt;function Y5r(t){return k9(this,arguments,function*(){var r,n;let o=new Uint8Array;try{for(var i=F9(t),a;a=yield Ka(i.next()),!a.done;){let s=a.value;if(s==null)continue;let u=s instanceof ArrayBuffer?new Uint8Array(s):typeof s=="string"?new TextEncoder().encode(s):s,l=new Uint8Array(o.length+u.length);l.set(o),l.set(u,o.length),o=l;let c;for(;(c=X5r(o))!==-1;)yield yield Ka(o.slice(0,c)),o=o.slice(c)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&(yield Ka(n.call(i)))}finally{if(r)throw r.error}}o.length>0&&(yield yield Ka(o))})}function X5r(t){for(let n=0;n<t.length-2;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var UNe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=eWr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},NM=class t{constructor(){this.buffer=[],this.trailingCR=!1}decode(e){let r=this.decodeText(e);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=t.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(t.NEWLINE_REGEXP);return n&&o.pop(),o.length===1&&!n?(this.buffer.push(o[0]),[]):(this.buffer.length>0&&(o=[this.buffer.join("")+o[0],...o.slice(1)],this.buffer=[]),n||(this.buffer=[o.pop()||""]),o)}decodeText(e){var r;if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new Dq.CohereError({message:`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`})}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return(r=this.textDecoder)!==null&&r!==void 0||(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new Dq.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`})}throw new Dq.CohereError({message:"Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error."})}flush(){if(!this.buffer.length&&!this.trailingCR)return[];let e=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,e}};Eu.LineDecoder=NM;NM.NEWLINE_CHARS=new Set([`
`,"\r"]);NM.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Q5r(t){let e=new NM,r=[];for(let n of t)r.push(...e.decode(n));return r}Eu._decodeChunks=Q5r;function eWr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function qNe(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return L9(this,void 0,void 0,function*(){try{let r=yield e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}})},return(){return L9(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}Eu.readableStreamAsyncIterable=qNe});var HNe=x(Rw=>{"use strict";var tWr=Rw&&Rw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rWr=Rw&&Rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nWr=Rw&&Rw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tWr(e,t,r);return rWr(e,t),e};Object.defineProperty(Rw,"__esModule",{value:!0});Rw.V2ChatStreamRequestCitationMode=void 0;var oWr=nWr(Y());Rw.V2ChatStreamRequestCitationMode=oWr.serialization.enum_(["FAST","ACCURATE","OFF"])});var VNe=x(Nw=>{"use strict";var iWr=Nw&&Nw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aWr=Nw&&Nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sWr=Nw&&Nw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iWr(e,t,r);return aWr(e,t),e};Object.defineProperty(Nw,"__esModule",{value:!0});Nw.V2ChatRequestCitationMode=void 0;var uWr=sWr(Y());Nw.V2ChatRequestCitationMode=uWr.serialization.enum_(["FAST","ACCURATE","OFF"])});var Lq=x(jw=>{"use strict";var lWr=jw&&jw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cWr=jw&&jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dWr=jw&&jw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lWr(e,t,r);return cWr(e,t),e};Object.defineProperty(jw,"__esModule",{value:!0});jw.TextContent=void 0;var fFt=dWr(Y());jw.TextContent=fFt.serialization.object({text:fFt.serialization.string()})});var WNe=x(Dw=>{"use strict";var fWr=Dw&&Dw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pWr=Dw&&Dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mWr=Dw&&Dw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fWr(e,t,r);return pWr(e,t),e};Object.defineProperty(Dw,"__esModule",{value:!0});Dw.Content=void 0;var hWr=mWr(Y()),gWr=Lq();Dw.Content=hWr.serialization.union("type",{text:gWr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var GNe=x(Lw=>{"use strict";var yWr=Lw&&Lw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bWr=Lw&&Lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Wr=Lw&&Lw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yWr(e,t,r);return bWr(e,t),e};Object.defineProperty(Lw,"__esModule",{value:!0});Lw.UserMessageContent=void 0;var KNe=_Wr(Y()),vWr=WNe();Lw.UserMessageContent=KNe.serialization.undiscriminatedUnion([KNe.serialization.string(),KNe.serialization.list(vWr.Content)])});var mL=x(Fw=>{"use strict";var wWr=Fw&&Fw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xWr=Fw&&Fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SWr=Fw&&Fw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wWr(e,t,r);return xWr(e,t),e};Object.defineProperty(Fw,"__esModule",{value:!0});Fw.ChatDocument=void 0;var JNe=SWr(Y());Fw.ChatDocument=JNe.serialization.record(JNe.serialization.string(),JNe.serialization.string())});var ZNe=x(kw=>{"use strict";var CWr=kw&&kw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OWr=kw&&kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EWr=kw&&kw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CWr(e,t,r);return OWr(e,t),e};Object.defineProperty(kw,"__esModule",{value:!0});kw.UserMessage=void 0;var pFt=EWr(Y()),PWr=GNe(),TWr=mL();kw.UserMessage=pFt.serialization.object({content:PWr.UserMessageContent,documents:pFt.serialization.list(TWr.ChatDocument).optional()})});var XNe=x($w=>{"use strict";var AWr=$w&&$w.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IWr=$w&&$w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MWr=$w&&$w.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&AWr(e,t,r);return IWr(e,t),e};Object.defineProperty($w,"__esModule",{value:!0});$w.ToolCall2Function=void 0;var YNe=MWr(Y());$w.ToolCall2Function=YNe.serialization.object({name:YNe.serialization.string().optional(),arguments:YNe.serialization.string().optional()})});var mue=x(Bw=>{"use strict";var RWr=Bw&&Bw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NWr=Bw&&Bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jWr=Bw&&Bw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RWr(e,t,r);return NWr(e,t),e};Object.defineProperty(Bw,"__esModule",{value:!0});Bw.ToolCall2=void 0;var QNe=jWr(Y()),DWr=XNe();Bw.ToolCall2=QNe.serialization.object({id:QNe.serialization.string().optional(),type:QNe.serialization.stringLiteral("function").optional(),function:DWr.ToolCall2Function.optional()})});var eje=x(zw=>{"use strict";var LWr=zw&&zw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FWr=zw&&zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kWr=zw&&zw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LWr(e,t,r);return FWr(e,t),e};Object.defineProperty(zw,"__esModule",{value:!0});zw.ToolSource=void 0;var Fq=kWr(Y());zw.ToolSource=Fq.serialization.object({id:Fq.serialization.string().optional(),toolOutput:Fq.serialization.property("tool_output",Fq.serialization.record(Fq.serialization.string(),Fq.serialization.unknown()).optional())})});var tje=x(Uw=>{"use strict";var $Wr=Uw&&Uw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BWr=Uw&&Uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zWr=Uw&&Uw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Wr(e,t,r);return BWr(e,t),e};Object.defineProperty(Uw,"__esModule",{value:!0});Uw.DocumentSource=void 0;var $9=zWr(Y());Uw.DocumentSource=$9.serialization.object({id:$9.serialization.string().optional(),document:$9.serialization.record($9.serialization.string(),$9.serialization.unknown()).optional()})});var rje=x(qw=>{"use strict";var UWr=qw&&qw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qWr=qw&&qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HWr=qw&&qw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UWr(e,t,r);return qWr(e,t),e};Object.defineProperty(qw,"__esModule",{value:!0});qw.Source=void 0;var VWr=HWr(Y()),WWr=eje(),KWr=tje();qw.Source=VWr.serialization.union("type",{tool:WWr.ToolSource,document:KWr.DocumentSource}).transform({transform:t=>t,untransform:t=>t})});var z9=x(Hw=>{"use strict";var GWr=Hw&&Hw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JWr=Hw&&Hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZWr=Hw&&Hw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GWr(e,t,r);return JWr(e,t),e};Object.defineProperty(Hw,"__esModule",{value:!0});Hw.Citation=void 0;var B9=ZWr(Y()),YWr=rje();Hw.Citation=B9.serialization.object({start:B9.serialization.number().optional(),end:B9.serialization.number().optional(),text:B9.serialization.string().optional(),sources:B9.serialization.list(YWr.Source).optional()})});var nje=x(Vw=>{"use strict";var XWr=Vw&&Vw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QWr=Vw&&Vw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e9r=Vw&&Vw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XWr(e,t,r);return QWr(e,t),e};Object.defineProperty(Vw,"__esModule",{value:!0});Vw.AssistantMessageContentItem=void 0;var t9r=e9r(Y()),r9r=Lq();Vw.AssistantMessageContentItem=t9r.serialization.union("type",{text:r9r.TextContent}).transform({transform:t=>t,untransform:t=>t})});var ije=x(Ww=>{"use strict";var n9r=Ww&&Ww.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o9r=Ww&&Ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i9r=Ww&&Ww.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&n9r(e,t,r);return o9r(e,t),e};Object.defineProperty(Ww,"__esModule",{value:!0});Ww.AssistantMessageContent=void 0;var oje=i9r(Y()),a9r=nje();Ww.AssistantMessageContent=oje.serialization.undiscriminatedUnion([oje.serialization.string(),oje.serialization.list(a9r.AssistantMessageContentItem)])});var aje=x(Kw=>{"use strict";var s9r=Kw&&Kw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u9r=Kw&&Kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l9r=Kw&&Kw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&s9r(e,t,r);return u9r(e,t),e};Object.defineProperty(Kw,"__esModule",{value:!0});Kw.AssistantMessage=void 0;var kq=l9r(Y()),c9r=mue(),d9r=ije(),f9r=z9();Kw.AssistantMessage=kq.serialization.object({toolCalls:kq.serialization.property("tool_calls",kq.serialization.list(c9r.ToolCall2).optional()),toolPlan:kq.serialization.property("tool_plan",kq.serialization.string().optional()),content:d9r.AssistantMessageContent.optional(),citations:kq.serialization.list(f9r.Citation).optional()})});var sje=x(Gw=>{"use strict";var p9r=Gw&&Gw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),m9r=Gw&&Gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h9r=Gw&&Gw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&p9r(e,t,r);return m9r(e,t),e};Object.defineProperty(Gw,"__esModule",{value:!0});Gw.SystemMessageContentItem=void 0;var g9r=h9r(Y()),y9r=Lq();Gw.SystemMessageContentItem=g9r.serialization.union("type",{text:y9r.TextContent}).transform({transform:t=>t,untransform:t=>t})});var lje=x(Jw=>{"use strict";var b9r=Jw&&Jw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_9r=Jw&&Jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v9r=Jw&&Jw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&b9r(e,t,r);return _9r(e,t),e};Object.defineProperty(Jw,"__esModule",{value:!0});Jw.SystemMessageContent=void 0;var uje=v9r(Y()),w9r=sje();Jw.SystemMessageContent=uje.serialization.undiscriminatedUnion([uje.serialization.string(),uje.serialization.list(w9r.SystemMessageContentItem)])});var cje=x(Zw=>{"use strict";var x9r=Zw&&Zw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),S9r=Zw&&Zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C9r=Zw&&Zw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&x9r(e,t,r);return S9r(e,t),e};Object.defineProperty(Zw,"__esModule",{value:!0});Zw.SystemMessage=void 0;var O9r=C9r(Y()),E9r=lje();Zw.SystemMessage=O9r.serialization.object({content:E9r.SystemMessageContent})});var dje=x(Yw=>{"use strict";var P9r=Yw&&Yw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T9r=Yw&&Yw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A9r=Yw&&Yw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P9r(e,t,r);return T9r(e,t),e};Object.defineProperty(Yw,"__esModule",{value:!0});Yw.ToolContent=void 0;var hue=A9r(Y());Yw.ToolContent=hue.serialization.object({output:hue.serialization.record(hue.serialization.string(),hue.serialization.unknown())})});var fje=x(Xw=>{"use strict";var I9r=Xw&&Xw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M9r=Xw&&Xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R9r=Xw&&Xw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&I9r(e,t,r);return M9r(e,t),e};Object.defineProperty(Xw,"__esModule",{value:!0});Xw.ToolMessage2ToolContentItem=void 0;var N9r=R9r(Y()),j9r=dje();Xw.ToolMessage2ToolContentItem=N9r.serialization.union("type",{tool_result_object:j9r.ToolContent}).transform({transform:t=>t,untransform:t=>t})});var pje=x(Qw=>{"use strict";var D9r=Qw&&Qw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L9r=Qw&&Qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F9r=Qw&&Qw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&D9r(e,t,r);return L9r(e,t),e};Object.defineProperty(Qw,"__esModule",{value:!0});Qw.ToolMessage2=void 0;var U9=F9r(Y()),k9r=fje();Qw.ToolMessage2=U9.serialization.object({toolCallId:U9.serialization.property("tool_call_id",U9.serialization.string()),toolContent:U9.serialization.property("tool_content",U9.serialization.list(k9r.ToolMessage2ToolContentItem))})});var mje=x(e0=>{"use strict";var $9r=e0&&e0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B9r=e0&&e0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z9r=e0&&e0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$9r(e,t,r);return B9r(e,t),e};Object.defineProperty(e0,"__esModule",{value:!0});e0.ChatMessage2=void 0;var U9r=z9r(Y()),q9r=ZNe(),H9r=aje(),V9r=cje(),W9r=pje();e0.ChatMessage2=U9r.serialization.union("role",{user:q9r.UserMessage,assistant:H9r.AssistantMessage,system:V9r.SystemMessage,tool:W9r.ToolMessage2}).transform({transform:t=>t,untransform:t=>t})});var gue=x(t0=>{"use strict";var K9r=t0&&t0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),G9r=t0&&t0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J9r=t0&&t0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&K9r(e,t,r);return G9r(e,t),e};Object.defineProperty(t0,"__esModule",{value:!0});t0.ChatMessages=void 0;var Z9r=J9r(Y()),Y9r=mje();t0.ChatMessages=Z9r.serialization.list(Y9r.ChatMessage2)});var hje=x(r0=>{"use strict";var X9r=r0&&r0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q9r=r0&&r0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eKr=r0&&r0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&X9r(e,t,r);return Q9r(e,t),e};Object.defineProperty(r0,"__esModule",{value:!0});r0.Tool2Function=void 0;var $q=eKr(Y());r0.Tool2Function=$q.serialization.object({name:$q.serialization.string().optional(),description:$q.serialization.string().optional(),parameters:$q.serialization.record($q.serialization.string(),$q.serialization.unknown()).optional()})});var yue=x(n0=>{"use strict";var tKr=n0&&n0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rKr=n0&&n0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nKr=n0&&n0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tKr(e,t,r);return rKr(e,t),e};Object.defineProperty(n0,"__esModule",{value:!0});n0.Tool2=void 0;var mFt=nKr(Y()),oKr=hje();n0.Tool2=mFt.serialization.object({type:mFt.serialization.stringLiteral("function").optional(),function:oKr.Tool2Function.optional()})});var bue=x(o0=>{"use strict";var iKr=o0&&o0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aKr=o0&&o0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sKr=o0&&o0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iKr(e,t,r);return aKr(e,t),e};Object.defineProperty(o0,"__esModule",{value:!0});o0.ChatFinishReason=void 0;var uKr=sKr(Y());o0.ChatFinishReason=uKr.serialization.enum_(["complete","stop_sequence","max_tokens","tool_call","error","content_blocked","error_limit"])});var gje=x(i0=>{"use strict";var lKr=i0&&i0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cKr=i0&&i0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dKr=i0&&i0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lKr(e,t,r);return cKr(e,t),e};Object.defineProperty(i0,"__esModule",{value:!0});i0.AssistantMessageResponseContentItem=void 0;var fKr=dKr(Y()),pKr=Lq();i0.AssistantMessageResponseContentItem=fKr.serialization.union("type",{text:pKr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var yje=x(a0=>{"use strict";var mKr=a0&&a0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hKr=a0&&a0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gKr=a0&&a0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mKr(e,t,r);return hKr(e,t),e};Object.defineProperty(a0,"__esModule",{value:!0});a0.AssistantMessageResponse=void 0;var jM=gKr(Y()),yKr=mue(),bKr=gje(),_Kr=z9();a0.AssistantMessageResponse=jM.serialization.object({role:jM.serialization.stringLiteral("assistant"),toolCalls:jM.serialization.property("tool_calls",jM.serialization.list(yKr.ToolCall2).optional()),toolPlan:jM.serialization.property("tool_plan",jM.serialization.string().optional()),content:jM.serialization.list(bKr.AssistantMessageResponseContentItem).optional(),citations:jM.serialization.list(_Kr.Citation).optional()})});var bje=x(s0=>{"use strict";var vKr=s0&&s0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wKr=s0&&s0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xKr=s0&&s0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vKr(e,t,r);return wKr(e,t),e};Object.defineProperty(s0,"__esModule",{value:!0});s0.UsageBilledUnits=void 0;var DM=xKr(Y());s0.UsageBilledUnits=DM.serialization.object({inputTokens:DM.serialization.property("input_tokens",DM.serialization.number().optional()),outputTokens:DM.serialization.property("output_tokens",DM.serialization.number().optional()),searchUnits:DM.serialization.property("search_units",DM.serialization.number().optional()),classifications:DM.serialization.number().optional()})});var _je=x(u0=>{"use strict";var SKr=u0&&u0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CKr=u0&&u0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OKr=u0&&u0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SKr(e,t,r);return CKr(e,t),e};Object.defineProperty(u0,"__esModule",{value:!0});u0.UsageTokens=void 0;var q9=OKr(Y());u0.UsageTokens=q9.serialization.object({inputTokens:q9.serialization.property("input_tokens",q9.serialization.number().optional()),outputTokens:q9.serialization.property("output_tokens",q9.serialization.number().optional())})});var _ue=x(l0=>{"use strict";var EKr=l0&&l0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PKr=l0&&l0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TKr=l0&&l0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EKr(e,t,r);return PKr(e,t),e};Object.defineProperty(l0,"__esModule",{value:!0});l0.Usage=void 0;var hFt=TKr(Y()),AKr=bje(),IKr=_je();l0.Usage=hFt.serialization.object({billedUnits:hFt.serialization.property("billed_units",AKr.UsageBilledUnits.optional()),tokens:IKr.UsageTokens.optional()})});var gFt=x(c0=>{"use strict";var MKr=c0&&c0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RKr=c0&&c0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NKr=c0&&c0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MKr(e,t,r);return RKr(e,t),e};Object.defineProperty(c0,"__esModule",{value:!0});c0.NonStreamedChatResponse2=void 0;var vue=NKr(Y()),jKr=bue(),DKr=yje(),LKr=_ue();c0.NonStreamedChatResponse2=vue.serialization.object({id:vue.serialization.string(),finishReason:vue.serialization.property("finish_reason",jKr.ChatFinishReason),prompt:vue.serialization.string().optional(),message:DKr.AssistantMessageResponse.optional(),usage:LKr.Usage.optional()})});var Xh=x(d0=>{"use strict";var FKr=d0&&d0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kKr=d0&&d0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Kr=d0&&d0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FKr(e,t,r);return kKr(e,t),e};Object.defineProperty(d0,"__esModule",{value:!0});d0.ChatStreamEventType=void 0;var BKr=$Kr(Y());d0.ChatStreamEventType=BKr.serialization.object({})});var vje=x(f0=>{"use strict";var zKr=f0&&f0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UKr=f0&&f0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qKr=f0&&f0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zKr(e,t,r);return UKr(e,t),e};Object.defineProperty(f0,"__esModule",{value:!0});f0.ChatMessageStartEventDeltaMessage=void 0;var yFt=qKr(Y());f0.ChatMessageStartEventDeltaMessage=yFt.serialization.object({role:yFt.serialization.stringLiteral("assistant").optional()})});var wje=x(p0=>{"use strict";var HKr=p0&&p0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VKr=p0&&p0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WKr=p0&&p0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HKr(e,t,r);return VKr(e,t),e};Object.defineProperty(p0,"__esModule",{value:!0});p0.ChatMessageStartEventDelta=void 0;var KKr=WKr(Y()),GKr=vje();p0.ChatMessageStartEventDelta=KKr.serialization.object({message:GKr.ChatMessageStartEventDeltaMessage.optional()})});var xje=x(m0=>{"use strict";var JKr=m0&&m0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZKr=m0&&m0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YKr=m0&&m0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JKr(e,t,r);return ZKr(e,t),e};Object.defineProperty(m0,"__esModule",{value:!0});m0.ChatMessageStartEvent=void 0;var bFt=YKr(Y()),XKr=wje(),QKr=Xh();m0.ChatMessageStartEvent=bFt.serialization.object({id:bFt.serialization.string().optional(),delta:XKr.ChatMessageStartEventDelta.optional()}).extend(QKr.ChatStreamEventType)});var Cje=x(h0=>{"use strict";var eGr=h0&&h0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tGr=h0&&h0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rGr=h0&&h0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eGr(e,t,r);return tGr(e,t),e};Object.defineProperty(h0,"__esModule",{value:!0});h0.ChatContentStartEventDeltaMessageContent=void 0;var Sje=rGr(Y());h0.ChatContentStartEventDeltaMessageContent=Sje.serialization.object({text:Sje.serialization.string().optional(),type:Sje.serialization.stringLiteral("text").optional()})});var Oje=x(g0=>{"use strict";var nGr=g0&&g0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oGr=g0&&g0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iGr=g0&&g0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nGr(e,t,r);return oGr(e,t),e};Object.defineProperty(g0,"__esModule",{value:!0});g0.ChatContentStartEventDeltaMessage=void 0;var aGr=iGr(Y()),sGr=Cje();g0.ChatContentStartEventDeltaMessage=aGr.serialization.object({content:sGr.ChatContentStartEventDeltaMessageContent.optional()})});var Eje=x(y0=>{"use strict";var uGr=y0&&y0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lGr=y0&&y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cGr=y0&&y0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uGr(e,t,r);return lGr(e,t),e};Object.defineProperty(y0,"__esModule",{value:!0});y0.ChatContentStartEventDelta=void 0;var dGr=cGr(Y()),fGr=Oje();y0.ChatContentStartEventDelta=dGr.serialization.object({message:fGr.ChatContentStartEventDeltaMessage.optional()})});var Pje=x(b0=>{"use strict";var pGr=b0&&b0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mGr=b0&&b0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hGr=b0&&b0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pGr(e,t,r);return mGr(e,t),e};Object.defineProperty(b0,"__esModule",{value:!0});b0.ChatContentStartEvent=void 0;var _Ft=hGr(Y()),gGr=Eje(),yGr=Xh();b0.ChatContentStartEvent=_Ft.serialization.object({index:_Ft.serialization.number().optional(),delta:gGr.ChatContentStartEventDelta.optional()}).extend(yGr.ChatStreamEventType)});var Tje=x(_0=>{"use strict";var bGr=_0&&_0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Gr=_0&&_0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vGr=_0&&_0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bGr(e,t,r);return _Gr(e,t),e};Object.defineProperty(_0,"__esModule",{value:!0});_0.ChatContentDeltaEventDeltaMessageContent=void 0;var vFt=vGr(Y());_0.ChatContentDeltaEventDeltaMessageContent=vFt.serialization.object({text:vFt.serialization.string().optional()})});var Aje=x(v0=>{"use strict";var wGr=v0&&v0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xGr=v0&&v0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SGr=v0&&v0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wGr(e,t,r);return xGr(e,t),e};Object.defineProperty(v0,"__esModule",{value:!0});v0.ChatContentDeltaEventDeltaMessage=void 0;var CGr=SGr(Y()),OGr=Tje();v0.ChatContentDeltaEventDeltaMessage=CGr.serialization.object({content:OGr.ChatContentDeltaEventDeltaMessageContent.optional()})});var Ije=x(w0=>{"use strict";var EGr=w0&&w0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PGr=w0&&w0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TGr=w0&&w0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EGr(e,t,r);return PGr(e,t),e};Object.defineProperty(w0,"__esModule",{value:!0});w0.ChatContentDeltaEventDelta=void 0;var AGr=TGr(Y()),IGr=Aje();w0.ChatContentDeltaEventDelta=AGr.serialization.object({message:IGr.ChatContentDeltaEventDeltaMessage.optional()})});var Mje=x(x0=>{"use strict";var MGr=x0&&x0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RGr=x0&&x0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NGr=x0&&x0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MGr(e,t,r);return RGr(e,t),e};Object.defineProperty(x0,"__esModule",{value:!0});x0.ChatContentDeltaEvent=void 0;var wFt=NGr(Y()),jGr=Ije(),DGr=Xh();x0.ChatContentDeltaEvent=wFt.serialization.object({index:wFt.serialization.number().optional(),delta:jGr.ChatContentDeltaEventDelta.optional()}).extend(DGr.ChatStreamEventType)});var Rje=x(S0=>{"use strict";var LGr=S0&&S0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FGr=S0&&S0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kGr=S0&&S0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LGr(e,t,r);return FGr(e,t),e};Object.defineProperty(S0,"__esModule",{value:!0});S0.ChatContentEndEvent=void 0;var xFt=kGr(Y()),$Gr=Xh();S0.ChatContentEndEvent=xFt.serialization.object({index:xFt.serialization.number().optional()}).extend($Gr.ChatStreamEventType)});var jje=x(C0=>{"use strict";var BGr=C0&&C0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zGr=C0&&C0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UGr=C0&&C0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BGr(e,t,r);return zGr(e,t),e};Object.defineProperty(C0,"__esModule",{value:!0});C0.ChatToolPlanDeltaEventDelta=void 0;var Nje=UGr(Y());C0.ChatToolPlanDeltaEventDelta=Nje.serialization.object({toolPlan:Nje.serialization.property("tool_plan",Nje.serialization.string().optional())})});var Dje=x(O0=>{"use strict";var qGr=O0&&O0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HGr=O0&&O0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VGr=O0&&O0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qGr(e,t,r);return HGr(e,t),e};Object.defineProperty(O0,"__esModule",{value:!0});O0.ChatToolPlanDeltaEvent=void 0;var WGr=VGr(Y()),KGr=jje(),GGr=Xh();O0.ChatToolPlanDeltaEvent=WGr.serialization.object({delta:KGr.ChatToolPlanDeltaEventDelta.optional()}).extend(GGr.ChatStreamEventType)});var Fje=x(E0=>{"use strict";var JGr=E0&&E0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZGr=E0&&E0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YGr=E0&&E0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JGr(e,t,r);return ZGr(e,t),e};Object.defineProperty(E0,"__esModule",{value:!0});E0.ChatToolCallStartEventDeltaToolCallFunction=void 0;var Lje=YGr(Y());E0.ChatToolCallStartEventDeltaToolCallFunction=Lje.serialization.object({name:Lje.serialization.string().optional(),arguments:Lje.serialization.string().optional()})});var $je=x(P0=>{"use strict";var XGr=P0&&P0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QGr=P0&&P0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eJr=P0&&P0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XGr(e,t,r);return QGr(e,t),e};Object.defineProperty(P0,"__esModule",{value:!0});P0.ChatToolCallStartEventDeltaToolCall=void 0;var kje=eJr(Y()),tJr=Fje();P0.ChatToolCallStartEventDeltaToolCall=kje.serialization.object({id:kje.serialization.string().optional(),type:kje.serialization.stringLiteral("function").optional(),function:tJr.ChatToolCallStartEventDeltaToolCallFunction.optional()})});var Bje=x(T0=>{"use strict";var rJr=T0&&T0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nJr=T0&&T0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oJr=T0&&T0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rJr(e,t,r);return nJr(e,t),e};Object.defineProperty(T0,"__esModule",{value:!0});T0.ChatToolCallStartEventDelta=void 0;var SFt=oJr(Y()),iJr=$je();T0.ChatToolCallStartEventDelta=SFt.serialization.object({toolCall:SFt.serialization.property("tool_call",iJr.ChatToolCallStartEventDeltaToolCall.optional())})});var zje=x(A0=>{"use strict";var aJr=A0&&A0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sJr=A0&&A0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uJr=A0&&A0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aJr(e,t,r);return sJr(e,t),e};Object.defineProperty(A0,"__esModule",{value:!0});A0.ChatToolCallStartEvent=void 0;var CFt=uJr(Y()),lJr=Bje(),cJr=Xh();A0.ChatToolCallStartEvent=CFt.serialization.object({index:CFt.serialization.number().optional(),delta:lJr.ChatToolCallStartEventDelta.optional()}).extend(cJr.ChatStreamEventType)});var Uje=x(I0=>{"use strict";var dJr=I0&&I0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fJr=I0&&I0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pJr=I0&&I0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dJr(e,t,r);return fJr(e,t),e};Object.defineProperty(I0,"__esModule",{value:!0});I0.ChatToolCallDeltaEventDeltaToolCallFunction=void 0;var OFt=pJr(Y());I0.ChatToolCallDeltaEventDeltaToolCallFunction=OFt.serialization.object({arguments:OFt.serialization.string().optional()})});var qje=x(M0=>{"use strict";var mJr=M0&&M0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hJr=M0&&M0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gJr=M0&&M0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mJr(e,t,r);return hJr(e,t),e};Object.defineProperty(M0,"__esModule",{value:!0});M0.ChatToolCallDeltaEventDeltaToolCall=void 0;var yJr=gJr(Y()),bJr=Uje();M0.ChatToolCallDeltaEventDeltaToolCall=yJr.serialization.object({function:bJr.ChatToolCallDeltaEventDeltaToolCallFunction.optional()})});var Hje=x(R0=>{"use strict";var _Jr=R0&&R0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vJr=R0&&R0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wJr=R0&&R0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Jr(e,t,r);return vJr(e,t),e};Object.defineProperty(R0,"__esModule",{value:!0});R0.ChatToolCallDeltaEventDelta=void 0;var EFt=wJr(Y()),xJr=qje();R0.ChatToolCallDeltaEventDelta=EFt.serialization.object({toolCall:EFt.serialization.property("tool_call",xJr.ChatToolCallDeltaEventDeltaToolCall.optional())})});var Vje=x(N0=>{"use strict";var SJr=N0&&N0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CJr=N0&&N0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OJr=N0&&N0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SJr(e,t,r);return CJr(e,t),e};Object.defineProperty(N0,"__esModule",{value:!0});N0.ChatToolCallDeltaEvent=void 0;var PFt=OJr(Y()),EJr=Hje(),PJr=Xh();N0.ChatToolCallDeltaEvent=PFt.serialization.object({index:PFt.serialization.number().optional(),delta:EJr.ChatToolCallDeltaEventDelta.optional()}).extend(PJr.ChatStreamEventType)});var Wje=x(j0=>{"use strict";var TJr=j0&&j0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AJr=j0&&j0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IJr=j0&&j0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TJr(e,t,r);return AJr(e,t),e};Object.defineProperty(j0,"__esModule",{value:!0});j0.ChatToolCallEndEvent=void 0;var TFt=IJr(Y()),MJr=Xh();j0.ChatToolCallEndEvent=TFt.serialization.object({index:TFt.serialization.number().optional()}).extend(MJr.ChatStreamEventType)});var Kje=x(D0=>{"use strict";var RJr=D0&&D0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NJr=D0&&D0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jJr=D0&&D0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RJr(e,t,r);return NJr(e,t),e};Object.defineProperty(D0,"__esModule",{value:!0});D0.ChatMessageEndEventDelta=void 0;var AFt=jJr(Y()),DJr=bue(),LJr=_ue();D0.ChatMessageEndEventDelta=AFt.serialization.object({finishReason:AFt.serialization.property("finish_reason",DJr.ChatFinishReason.optional()),usage:LJr.Usage.optional()})});var Gje=x(L0=>{"use strict";var FJr=L0&&L0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kJr=L0&&L0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Jr=L0&&L0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FJr(e,t,r);return kJr(e,t),e};Object.defineProperty(L0,"__esModule",{value:!0});L0.ChatMessageEndEvent=void 0;var IFt=$Jr(Y()),BJr=Kje(),zJr=Xh();L0.ChatMessageEndEvent=IFt.serialization.object({id:IFt.serialization.string().optional(),delta:BJr.ChatMessageEndEventDelta.optional()}).extend(zJr.ChatStreamEventType)});var Jje=x(F0=>{"use strict";var UJr=F0&&F0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qJr=F0&&F0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HJr=F0&&F0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UJr(e,t,r);return qJr(e,t),e};Object.defineProperty(F0,"__esModule",{value:!0});F0.CitationStartEventDeltaMessage=void 0;var VJr=HJr(Y()),WJr=z9();F0.CitationStartEventDeltaMessage=VJr.serialization.object({citations:WJr.Citation.optional()})});var Zje=x(k0=>{"use strict";var KJr=k0&&k0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GJr=k0&&k0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JJr=k0&&k0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KJr(e,t,r);return GJr(e,t),e};Object.defineProperty(k0,"__esModule",{value:!0});k0.CitationStartEventDelta=void 0;var ZJr=JJr(Y()),YJr=Jje();k0.CitationStartEventDelta=ZJr.serialization.object({message:YJr.CitationStartEventDeltaMessage.optional()})});var Yje=x($0=>{"use strict";var XJr=$0&&$0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QJr=$0&&$0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e7r=$0&&$0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XJr(e,t,r);return QJr(e,t),e};Object.defineProperty($0,"__esModule",{value:!0});$0.CitationStartEvent=void 0;var MFt=e7r(Y()),t7r=Zje(),r7r=Xh();$0.CitationStartEvent=MFt.serialization.object({index:MFt.serialization.number().optional(),delta:t7r.CitationStartEventDelta.optional()}).extend(r7r.ChatStreamEventType)});var Xje=x(B0=>{"use strict";var n7r=B0&&B0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o7r=B0&&B0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i7r=B0&&B0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&n7r(e,t,r);return o7r(e,t),e};Object.defineProperty(B0,"__esModule",{value:!0});B0.CitationEndEvent=void 0;var RFt=i7r(Y()),a7r=Xh();B0.CitationEndEvent=RFt.serialization.object({index:RFt.serialization.number().optional()}).extend(a7r.ChatStreamEventType)});var NFt=x(z0=>{"use strict";var s7r=z0&&z0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u7r=z0&&z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l7r=z0&&z0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&s7r(e,t,r);return u7r(e,t),e};Object.defineProperty(z0,"__esModule",{value:!0});z0.StreamedChatResponse2=void 0;var c7r=l7r(Y()),d7r=xje(),f7r=Pje(),p7r=Mje(),m7r=Rje(),h7r=Dje(),g7r=zje(),y7r=Vje(),b7r=Wje(),_7r=Yje(),v7r=Xje(),w7r=Gje();z0.StreamedChatResponse2=c7r.serialization.union("type",{"message-start":d7r.ChatMessageStartEvent,"content-start":f7r.ChatContentStartEvent,"content-delta":p7r.ChatContentDeltaEvent,"content-end":m7r.ChatContentEndEvent,"tool-plan-delta":h7r.ChatToolPlanDeltaEvent,"tool-call-start":g7r.ChatToolCallStartEvent,"tool-call-delta":y7r.ChatToolCallDeltaEvent,"tool-call-end":b7r.ChatToolCallEndEvent,"citation-start":_7r.CitationStartEvent,"citation-end":v7r.CitationEndEvent,"message-end":w7r.ChatMessageEndEvent}).transform({transform:t=>t,untransform:t=>t})});var Qje=x(Nt=>{"use strict";var x7r=Nt&&Nt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gt=Nt&&Nt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&x7r(e,t,r)};Object.defineProperty(Nt,"__esModule",{value:!0});Gt(HNe(),Nt);Gt(VNe(),Nt);Gt(Lq(),Nt);Gt(WNe(),Nt);Gt(GNe(),Nt);Gt(ZNe(),Nt);Gt(XNe(),Nt);Gt(mue(),Nt);Gt(eje(),Nt);Gt(tje(),Nt);Gt(rje(),Nt);Gt(z9(),Nt);Gt(nje(),Nt);Gt(ije(),Nt);Gt(aje(),Nt);Gt(sje(),Nt);Gt(lje(),Nt);Gt(cje(),Nt);Gt(dje(),Nt);Gt(fje(),Nt);Gt(pje(),Nt);Gt(mje(),Nt);Gt(gue(),Nt);Gt(hje(),Nt);Gt(yue(),Nt);Gt(bue(),Nt);Gt(gje(),Nt);Gt(yje(),Nt);Gt(bje(),Nt);Gt(_je(),Nt);Gt(_ue(),Nt);Gt(gFt(),Nt);Gt(Xh(),Nt);Gt(vje(),Nt);Gt(wje(),Nt);Gt(xje(),Nt);Gt(Cje(),Nt);Gt(Oje(),Nt);Gt(Eje(),Nt);Gt(Pje(),Nt);Gt(Tje(),Nt);Gt(Aje(),Nt);Gt(Ije(),Nt);Gt(Mje(),Nt);Gt(Rje(),Nt);Gt(jje(),Nt);Gt(Dje(),Nt);Gt(Fje(),Nt);Gt($je(),Nt);Gt(Bje(),Nt);Gt(zje(),Nt);Gt(Uje(),Nt);Gt(qje(),Nt);Gt(Hje(),Nt);Gt(Vje(),Nt);Gt(Wje(),Nt);Gt(Kje(),Nt);Gt(Gje(),Nt);Gt(NFt(),Nt)});var wue=x(U0=>{"use strict";var S7r=U0&&U0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C7r=U0&&U0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O7r=U0&&U0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&S7r(e,t,r);return C7r(e,t),e};Object.defineProperty(U0,"__esModule",{value:!0});U0.TextResponseFormat=void 0;var E7r=O7r(Y());U0.TextResponseFormat=E7r.serialization.object({})});var eDe=x(q0=>{"use strict";var P7r=q0&&q0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T7r=q0&&q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A7r=q0&&q0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P7r(e,t,r);return T7r(e,t),e};Object.defineProperty(q0,"__esModule",{value:!0});q0.JsonResponseFormat2=void 0;var H9=A7r(Y());q0.JsonResponseFormat2=H9.serialization.object({jsonSchema:H9.serialization.property("json_schema",H9.serialization.record(H9.serialization.string(),H9.serialization.unknown()).optional())})});var xue=x(H0=>{"use strict";var I7r=H0&&H0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M7r=H0&&H0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R7r=H0&&H0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&I7r(e,t,r);return M7r(e,t),e};Object.defineProperty(H0,"__esModule",{value:!0});H0.ResponseFormat2=void 0;var N7r=R7r(Y()),j7r=wue(),D7r=eDe();H0.ResponseFormat2=N7r.serialization.union("type",{text:j7r.TextResponseFormat,json_object:D7r.JsonResponseFormat2}).transform({transform:t=>t,untransform:t=>t})});var jFt=x(V0=>{"use strict";var L7r=V0&&V0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F7r=V0&&V0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k7r=V0&&V0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L7r(e,t,r);return F7r(e,t),e};Object.defineProperty(V0,"__esModule",{value:!0});V0.V2ChatStreamRequest=void 0;var Pu=k7r(Y()),$7r=gue(),B7r=yue(),z7r=HNe(),U7r=xue();V0.V2ChatStreamRequest=Pu.serialization.object({model:Pu.serialization.string(),messages:$7r.ChatMessages,tools:Pu.serialization.list(B7r.Tool2).optional(),citationMode:Pu.serialization.property("citation_mode",z7r.V2ChatStreamRequestCitationMode.optional()),responseFormat:Pu.serialization.property("response_format",U7r.ResponseFormat2.optional()),maxTokens:Pu.serialization.property("max_tokens",Pu.serialization.number().optional()),stopSequences:Pu.serialization.property("stop_sequences",Pu.serialization.list(Pu.serialization.string()).optional()),temperature:Pu.serialization.number().optional(),seed:Pu.serialization.number().optional(),frequencyPenalty:Pu.serialization.property("frequency_penalty",Pu.serialization.number().optional()),presencePenalty:Pu.serialization.property("presence_penalty",Pu.serialization.number().optional()),k:Pu.serialization.number().optional(),p:Pu.serialization.number().optional(),returnPrompt:Pu.serialization.property("return_prompt",Pu.serialization.boolean().optional())})});var DFt=x(W0=>{"use strict";var q7r=W0&&W0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),H7r=W0&&W0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V7r=W0&&W0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q7r(e,t,r);return H7r(e,t),e};Object.defineProperty(W0,"__esModule",{value:!0});W0.V2ChatRequest=void 0;var Tu=V7r(Y()),W7r=gue(),K7r=yue(),G7r=VNe(),J7r=xue();W0.V2ChatRequest=Tu.serialization.object({model:Tu.serialization.string(),messages:W7r.ChatMessages,tools:Tu.serialization.list(K7r.Tool2).optional(),citationMode:Tu.serialization.property("citation_mode",G7r.V2ChatRequestCitationMode.optional()),responseFormat:Tu.serialization.property("response_format",J7r.ResponseFormat2.optional()),maxTokens:Tu.serialization.property("max_tokens",Tu.serialization.number().optional()),stopSequences:Tu.serialization.property("stop_sequences",Tu.serialization.list(Tu.serialization.string()).optional()),temperature:Tu.serialization.number().optional(),seed:Tu.serialization.number().optional(),frequencyPenalty:Tu.serialization.property("frequency_penalty",Tu.serialization.number().optional()),presencePenalty:Tu.serialization.property("presence_penalty",Tu.serialization.number().optional()),k:Tu.serialization.number().optional(),p:Tu.serialization.number().optional(),returnPrompt:Tu.serialization.property("return_prompt",Tu.serialization.boolean().optional())})});var tDe=x(Bq=>{"use strict";Object.defineProperty(Bq,"__esModule",{value:!0});Bq.V2ChatRequest=Bq.V2ChatStreamRequest=void 0;var Z7r=jFt();Object.defineProperty(Bq,"V2ChatStreamRequest",{enumerable:!0,get:function(){return Z7r.V2ChatStreamRequest}});var Y7r=DFt();Object.defineProperty(Bq,"V2ChatRequest",{enumerable:!0,get:function(){return Y7r.V2ChatRequest}})});var LFt=x(hL=>{"use strict";var X7r=hL&&hL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q7r=hL&&hL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&X7r(e,t,r)};Object.defineProperty(hL,"__esModule",{value:!0});Q7r(tDe(),hL)});var kFt=x(LM=>{"use strict";var eZr=LM&&LM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FFt=LM&&LM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eZr(e,t,r)};Object.defineProperty(LM,"__esModule",{value:!0});FFt(Qje(),LM);FFt(LFt(),LM)});var rDe=x(K0=>{"use strict";var tZr=K0&&K0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rZr=K0&&K0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nZr=K0&&K0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tZr(e,t,r);return rZr(e,t),e};Object.defineProperty(K0,"__esModule",{value:!0});K0.CreateEmbedJobRequestTruncate=void 0;var oZr=nZr(Y());K0.CreateEmbedJobRequestTruncate=oZr.serialization.enum_(["START","END"])});var nDe=x(gL=>{"use strict";var iZr=gL&&gL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aZr=gL&&gL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&iZr(e,t,r)};Object.defineProperty(gL,"__esModule",{value:!0});aZr(rDe(),gL)});var Sue=x(G0=>{"use strict";var sZr=G0&&G0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uZr=G0&&G0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lZr=G0&&G0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sZr(e,t,r);return uZr(e,t),e};Object.defineProperty(G0,"__esModule",{value:!0});G0.EmbedInputType=void 0;var cZr=lZr(Y());G0.EmbedInputType=cZr.serialization.enum_(["search_document","search_query","classification","clustering"])});var Cue=x(J0=>{"use strict";var dZr=J0&&J0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fZr=J0&&J0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pZr=J0&&J0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dZr(e,t,r);return fZr(e,t),e};Object.defineProperty(J0,"__esModule",{value:!0});J0.EmbeddingType=void 0;var mZr=pZr(Y());J0.EmbeddingType=mZr.serialization.enum_(["float","int8","uint8","binary","ubinary"])});var $Ft=x(Z0=>{"use strict";var hZr=Z0&&Z0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gZr=Z0&&Z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yZr=Z0&&Z0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hZr(e,t,r);return gZr(e,t),e};Object.defineProperty(Z0,"__esModule",{value:!0});Z0.CreateEmbedJobRequest=void 0;var FM=yZr(Y()),bZr=Sue(),_Zr=Cue(),vZr=rDe();Z0.CreateEmbedJobRequest=FM.serialization.object({model:FM.serialization.string(),datasetId:FM.serialization.property("dataset_id",FM.serialization.string()),inputType:FM.serialization.property("input_type",bZr.EmbedInputType),name:FM.serialization.string().optional(),embeddingTypes:FM.serialization.property("embedding_types",FM.serialization.list(_Zr.EmbeddingType).optional()),truncate:vZr.CreateEmbedJobRequestTruncate.optional()})});var oDe=x(Oue=>{"use strict";Object.defineProperty(Oue,"__esModule",{value:!0});Oue.CreateEmbedJobRequest=void 0;var wZr=$Ft();Object.defineProperty(Oue,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return wZr.CreateEmbedJobRequest}})});var BFt=x(yL=>{"use strict";var xZr=yL&&yL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SZr=yL&&yL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xZr(e,t,r)};Object.defineProperty(yL,"__esModule",{value:!0});SZr(oDe(),yL)});var UFt=x(kM=>{"use strict";var CZr=kM&&kM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zFt=kM&&kM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&CZr(e,t,r)};Object.defineProperty(kM,"__esModule",{value:!0});zFt(nDe(),kM);zFt(BFt(),kM)});var iDe=x(Y0=>{"use strict";var OZr=Y0&&Y0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EZr=Y0&&Y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PZr=Y0&&Y0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OZr(e,t,r);return EZr(e,t),e};Object.defineProperty(Y0,"__esModule",{value:!0});Y0.DatasetType=void 0;var TZr=PZr(Y());Y0.DatasetType=TZr.serialization.enum_(["embed-input","embed-result","cluster-result","cluster-outliers","reranker-finetune-input","single-label-classification-finetune-input","chat-finetune-input","multi-label-classification-finetune-input"])});var aDe=x(X0=>{"use strict";var AZr=X0&&X0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IZr=X0&&X0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MZr=X0&&X0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&AZr(e,t,r);return IZr(e,t),e};Object.defineProperty(X0,"__esModule",{value:!0});X0.DatasetValidationStatus=void 0;var RZr=MZr(Y());X0.DatasetValidationStatus=RZr.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var sDe=x(Q0=>{"use strict";var NZr=Q0&&Q0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jZr=Q0&&Q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DZr=Q0&&Q0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NZr(e,t,r);return jZr(e,t),e};Object.defineProperty(Q0,"__esModule",{value:!0});Q0.DatasetPart=void 0;var Qh=DZr(Y());Q0.DatasetPart=Qh.serialization.object({id:Qh.serialization.string(),name:Qh.serialization.string(),url:Qh.serialization.string().optional(),index:Qh.serialization.number().optional(),sizeBytes:Qh.serialization.property("size_bytes",Qh.serialization.number().optional()),numRows:Qh.serialization.property("num_rows",Qh.serialization.number().optional()),originalUrl:Qh.serialization.property("original_url",Qh.serialization.string().optional()),samples:Qh.serialization.list(Qh.serialization.string()).optional()})});var Eue=x(ex=>{"use strict";var LZr=ex&&ex.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FZr=ex&&ex.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kZr=ex&&ex.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LZr(e,t,r);return FZr(e,t),e};Object.defineProperty(ex,"__esModule",{value:!0});ex.Dataset=void 0;var _s=kZr(Y()),$Zr=iDe(),BZr=aDe(),zZr=sDe();ex.Dataset=_s.serialization.object({id:_s.serialization.string(),name:_s.serialization.string(),createdAt:_s.serialization.property("created_at",_s.serialization.date()),updatedAt:_s.serialization.property("updated_at",_s.serialization.date()),datasetType:_s.serialization.property("dataset_type",$Zr.DatasetType),validationStatus:_s.serialization.property("validation_status",BZr.DatasetValidationStatus),validationError:_s.serialization.property("validation_error",_s.serialization.string().optional()),schema:_s.serialization.string().optional(),requiredFields:_s.serialization.property("required_fields",_s.serialization.list(_s.serialization.string()).optional()),preserveFields:_s.serialization.property("preserve_fields",_s.serialization.list(_s.serialization.string()).optional()),datasetParts:_s.serialization.property("dataset_parts",_s.serialization.list(zZr.DatasetPart).optional()),validationWarnings:_s.serialization.property("validation_warnings",_s.serialization.list(_s.serialization.string()).optional())})});var HFt=x(tx=>{"use strict";var UZr=tx&&tx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qZr=tx&&tx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HZr=tx&&tx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UZr(e,t,r);return qZr(e,t),e};Object.defineProperty(tx,"__esModule",{value:!0});tx.DatasetsListResponse=void 0;var qFt=HZr(Y()),VZr=Eue();tx.DatasetsListResponse=qFt.serialization.object({datasets:qFt.serialization.list(VZr.Dataset).optional()})});var VFt=x(rx=>{"use strict";var WZr=rx&&rx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KZr=rx&&rx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GZr=rx&&rx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WZr(e,t,r);return KZr(e,t),e};Object.defineProperty(rx,"__esModule",{value:!0});rx.DatasetsCreateResponseDatasetPartsItem=void 0;var $M=GZr(Y());rx.DatasetsCreateResponseDatasetPartsItem=$M.serialization.object({name:$M.serialization.string().optional(),numRows:$M.serialization.property("num_rows",$M.serialization.number().optional()),samples:$M.serialization.list($M.serialization.string()).optional(),partKind:$M.serialization.property("part_kind",$M.serialization.string().optional())})});var KFt=x(nx=>{"use strict";var JZr=nx&&nx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZZr=nx&&nx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YZr=nx&&nx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JZr(e,t,r);return ZZr(e,t),e};Object.defineProperty(nx,"__esModule",{value:!0});nx.DatasetsCreateResponse=void 0;var WFt=YZr(Y());nx.DatasetsCreateResponse=WFt.serialization.object({id:WFt.serialization.string().optional()})});var GFt=x(ox=>{"use strict";var XZr=ox&&ox.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QZr=ox&&ox.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eYr=ox&&ox.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XZr(e,t,r);return QZr(e,t),e};Object.defineProperty(ox,"__esModule",{value:!0});ox.DatasetsGetUsageResponse=void 0;var uDe=eYr(Y());ox.DatasetsGetUsageResponse=uDe.serialization.object({organizationUsage:uDe.serialization.property("organization_usage",uDe.serialization.number().optional())})});var JFt=x(ix=>{"use strict";var tYr=ix&&ix.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rYr=ix&&ix.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nYr=ix&&ix.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tYr(e,t,r);return rYr(e,t),e};Object.defineProperty(ix,"__esModule",{value:!0});ix.DatasetsGetResponse=void 0;var oYr=nYr(Y()),iYr=Eue();ix.DatasetsGetResponse=oYr.serialization.object({dataset:iYr.Dataset})});var lDe=x(s_=>{"use strict";var aYr=s_&&s_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V9=s_&&s_.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&aYr(e,t,r)};Object.defineProperty(s_,"__esModule",{value:!0});V9(HFt(),s_);V9(VFt(),s_);V9(KFt(),s_);V9(GFt(),s_);V9(JFt(),s_)});var ZFt=x(ax=>{"use strict";var sYr=ax&&ax.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uYr=ax&&ax.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lYr=ax&&ax.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sYr(e,t,r);return uYr(e,t),e};Object.defineProperty(ax,"__esModule",{value:!0});ax.Response=void 0;var cDe=lYr(Y());ax.Response=cDe.serialization.record(cDe.serialization.string(),cDe.serialization.unknown())});var YFt=x(sx=>{"use strict";var cYr=sx&&sx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dYr=sx&&sx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fYr=sx&&sx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cYr(e,t,r);return dYr(e,t),e};Object.defineProperty(sx,"__esModule",{value:!0});sx.delete=void 0;sx.delete=fYr(ZFt())});var QFt=x(BM=>{"use strict";var pYr=BM&&BM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XFt=BM&&BM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&pYr(e,t,r)};Object.defineProperty(BM,"__esModule",{value:!0});XFt(lDe(),BM);XFt(YFt(),BM)});var dDe=x(ux=>{"use strict";var mYr=ux&&ux.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hYr=ux&&ux.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gYr=ux&&ux.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mYr(e,t,r);return hYr(e,t),e};Object.defineProperty(ux,"__esModule",{value:!0});ux.BaseType=void 0;var yYr=gYr(Y());ux.BaseType=yYr.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var fDe=x(lx=>{"use strict";var bYr=lx&&lx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Yr=lx&&lx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vYr=lx&&lx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bYr(e,t,r);return _Yr(e,t),e};Object.defineProperty(lx,"__esModule",{value:!0});lx.Strategy=void 0;var wYr=vYr(Y());lx.Strategy=wYr.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var pDe=x(cx=>{"use strict";var xYr=cx&&cx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SYr=cx&&cx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CYr=cx&&cx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xYr(e,t,r);return SYr(e,t),e};Object.defineProperty(cx,"__esModule",{value:!0});cx.BaseModel=void 0;var Pue=CYr(Y()),OYr=dDe(),EYr=fDe();cx.BaseModel=Pue.serialization.object({name:Pue.serialization.string().optional(),version:Pue.serialization.string().optional(),baseType:Pue.serialization.property("base_type",OYr.BaseType),strategy:EYr.Strategy.optional()})});var mDe=x(dx=>{"use strict";var PYr=dx&&dx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TYr=dx&&dx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AYr=dx&&dx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PYr(e,t,r);return TYr(e,t),e};Object.defineProperty(dx,"__esModule",{value:!0});dx.Hyperparameters=void 0;var u_=AYr(Y());dx.Hyperparameters=u_.serialization.object({earlyStoppingPatience:u_.serialization.property("early_stopping_patience",u_.serialization.number().optional()),earlyStoppingThreshold:u_.serialization.property("early_stopping_threshold",u_.serialization.number().optional()),trainBatchSize:u_.serialization.property("train_batch_size",u_.serialization.number().optional()),trainEpochs:u_.serialization.property("train_epochs",u_.serialization.number().optional()),learningRate:u_.serialization.property("learning_rate",u_.serialization.number().optional())})});var hDe=x(fx=>{"use strict";var IYr=fx&&fx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MYr=fx&&fx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RYr=fx&&fx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&IYr(e,t,r);return MYr(e,t),e};Object.defineProperty(fx,"__esModule",{value:!0});fx.WandbConfig=void 0;var W9=RYr(Y());fx.WandbConfig=W9.serialization.object({project:W9.serialization.string(),apiKey:W9.serialization.property("api_key",W9.serialization.string()),entity:W9.serialization.string().optional()})});var Tue=x(px=>{"use strict";var NYr=px&&px.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jYr=px&&px.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DYr=px&&px.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NYr(e,t,r);return jYr(e,t),e};Object.defineProperty(px,"__esModule",{value:!0});px.Settings=void 0;var zq=DYr(Y()),LYr=pDe(),FYr=mDe(),kYr=hDe();px.Settings=zq.serialization.object({baseModel:zq.serialization.property("base_model",LYr.BaseModel),datasetId:zq.serialization.property("dataset_id",zq.serialization.string()),hyperparameters:FYr.Hyperparameters.optional(),multiLabel:zq.serialization.property("multi_label",zq.serialization.boolean().optional()),wandb:kYr.WandbConfig.optional()})});var K9=x(mx=>{"use strict";var $Yr=mx&&mx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BYr=mx&&mx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zYr=mx&&mx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Yr(e,t,r);return BYr(e,t),e};Object.defineProperty(mx,"__esModule",{value:!0});mx.Status=void 0;var UYr=zYr(Y());mx.Status=UYr.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var Uq=x(hx=>{"use strict";var qYr=hx&&hx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HYr=hx&&hx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VYr=hx&&hx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qYr(e,t,r);return HYr(e,t),e};Object.defineProperty(hx,"__esModule",{value:!0});hx.FinetunedModel=void 0;var Vp=VYr(Y()),WYr=Tue(),KYr=K9();hx.FinetunedModel=Vp.serialization.object({id:Vp.serialization.string().optional(),name:Vp.serialization.string(),creatorId:Vp.serialization.property("creator_id",Vp.serialization.string().optional()),organizationId:Vp.serialization.property("organization_id",Vp.serialization.string().optional()),settings:WYr.Settings,status:KYr.Status.optional(),createdAt:Vp.serialization.property("created_at",Vp.serialization.date().optional()),updatedAt:Vp.serialization.property("updated_at",Vp.serialization.date().optional()),completedAt:Vp.serialization.property("completed_at",Vp.serialization.date().optional()),lastUsed:Vp.serialization.property("last_used",Vp.serialization.date().optional())})});var ekt=x(gx=>{"use strict";var GYr=gx&&gx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JYr=gx&&gx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZYr=gx&&gx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GYr(e,t,r);return JYr(e,t),e};Object.defineProperty(gx,"__esModule",{value:!0});gx.ListFinetunedModelsResponse=void 0;var bL=ZYr(Y()),YYr=Uq();gx.ListFinetunedModelsResponse=bL.serialization.object({finetunedModels:bL.serialization.property("finetuned_models",bL.serialization.list(YYr.FinetunedModel).optional()),nextPageToken:bL.serialization.property("next_page_token",bL.serialization.string().optional()),totalSize:bL.serialization.property("total_size",bL.serialization.number().optional())})});var rkt=x(yx=>{"use strict";var XYr=yx&&yx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QYr=yx&&yx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eXr=yx&&yx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XYr(e,t,r);return QYr(e,t),e};Object.defineProperty(yx,"__esModule",{value:!0});yx.CreateFinetunedModelResponse=void 0;var tkt=eXr(Y()),tXr=Uq();yx.CreateFinetunedModelResponse=tkt.serialization.object({finetunedModel:tkt.serialization.property("finetuned_model",tXr.FinetunedModel.optional())})});var okt=x(bx=>{"use strict";var rXr=bx&&bx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nXr=bx&&bx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oXr=bx&&bx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rXr(e,t,r);return nXr(e,t),e};Object.defineProperty(bx,"__esModule",{value:!0});bx.GetFinetunedModelResponse=void 0;var nkt=oXr(Y()),iXr=Uq();bx.GetFinetunedModelResponse=nkt.serialization.object({finetunedModel:nkt.serialization.property("finetuned_model",iXr.FinetunedModel.optional())})});var ikt=x(_x=>{"use strict";var aXr=_x&&_x.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sXr=_x&&_x.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uXr=_x&&_x.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aXr(e,t,r);return sXr(e,t),e};Object.defineProperty(_x,"__esModule",{value:!0});_x.DeleteFinetunedModelResponse=void 0;var gDe=uXr(Y());_x.DeleteFinetunedModelResponse=gDe.serialization.record(gDe.serialization.string(),gDe.serialization.unknown())});var skt=x(vx=>{"use strict";var lXr=vx&&vx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cXr=vx&&vx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dXr=vx&&vx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lXr(e,t,r);return cXr(e,t),e};Object.defineProperty(vx,"__esModule",{value:!0});vx.UpdateFinetunedModelResponse=void 0;var akt=dXr(Y()),fXr=Uq();vx.UpdateFinetunedModelResponse=akt.serialization.object({finetunedModel:akt.serialization.property("finetuned_model",fXr.FinetunedModel.optional())})});var yDe=x(wx=>{"use strict";var pXr=wx&&wx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mXr=wx&&wx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hXr=wx&&wx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pXr(e,t,r);return mXr(e,t),e};Object.defineProperty(wx,"__esModule",{value:!0});wx.Event=void 0;var G9=hXr(Y()),gXr=K9();wx.Event=G9.serialization.object({userId:G9.serialization.property("user_id",G9.serialization.string().optional()),status:gXr.Status.optional(),createdAt:G9.serialization.property("created_at",G9.serialization.date().optional())})});var ukt=x(xx=>{"use strict";var yXr=xx&&xx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bXr=xx&&xx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Xr=xx&&xx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yXr(e,t,r);return bXr(e,t),e};Object.defineProperty(xx,"__esModule",{value:!0});xx.ListEventsResponse=void 0;var qq=_Xr(Y()),vXr=yDe();xx.ListEventsResponse=qq.serialization.object({events:qq.serialization.list(vXr.Event).optional(),nextPageToken:qq.serialization.property("next_page_token",qq.serialization.string().optional()),totalSize:qq.serialization.property("total_size",qq.serialization.number().optional())})});var bDe=x(Sx=>{"use strict";var wXr=Sx&&Sx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xXr=Sx&&Sx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SXr=Sx&&Sx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wXr(e,t,r);return xXr(e,t),e};Object.defineProperty(Sx,"__esModule",{value:!0});Sx.TrainingStepMetrics=void 0;var zM=SXr(Y());Sx.TrainingStepMetrics=zM.serialization.object({createdAt:zM.serialization.property("created_at",zM.serialization.date().optional()),stepNumber:zM.serialization.property("step_number",zM.serialization.number().optional()),metrics:zM.serialization.record(zM.serialization.string(),zM.serialization.number()).optional()})});var lkt=x(Cx=>{"use strict";var CXr=Cx&&Cx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OXr=Cx&&Cx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EXr=Cx&&Cx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CXr(e,t,r);return OXr(e,t),e};Object.defineProperty(Cx,"__esModule",{value:!0});Cx.ListTrainingStepMetricsResponse=void 0;var J9=EXr(Y()),PXr=bDe();Cx.ListTrainingStepMetricsResponse=J9.serialization.object({stepMetrics:J9.serialization.property("step_metrics",J9.serialization.list(PXr.TrainingStepMetrics).optional()),nextPageToken:J9.serialization.property("next_page_token",J9.serialization.string().optional())})});var _De=x(vs=>{"use strict";var TXr=vs&&vs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fd=vs&&vs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&TXr(e,t,r)};Object.defineProperty(vs,"__esModule",{value:!0});Fd(dDe(),vs);Fd(fDe(),vs);Fd(pDe(),vs);Fd(mDe(),vs);Fd(hDe(),vs);Fd(Tue(),vs);Fd(K9(),vs);Fd(Uq(),vs);Fd(ekt(),vs);Fd(rkt(),vs);Fd(okt(),vs);Fd(ikt(),vs);Fd(skt(),vs);Fd(yDe(),vs);Fd(ukt(),vs);Fd(bDe(),vs);Fd(lkt(),vs)});var ckt=x(_L=>{"use strict";var AXr=_L&&_L.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IXr=_L&&_L.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&AXr(e,t,r)};Object.defineProperty(_L,"__esModule",{value:!0});IXr(_De(),_L)});var fkt=x(eg=>{"use strict";var dkt=eg&&eg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MXr=eg&&eg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RXr=eg&&eg.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dkt(e,t,r);return MXr(e,t),e},NXr=eg&&eg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dkt(e,t,r)};Object.defineProperty(eg,"__esModule",{value:!0});eg.finetuning=void 0;eg.finetuning=RXr(ckt());NXr(_De(),eg)});var pkt=x(Ox=>{"use strict";var jXr=Ox&&Ox.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DXr=Ox&&Ox.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LXr=Ox&&Ox.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jXr(e,t,r);return DXr(e,t),e};Object.defineProperty(Ox,"__esModule",{value:!0});Ox.FinetuningUpdateFinetunedModelRequest=void 0;var Km=LXr(Y()),FXr=Tue(),kXr=K9();Ox.FinetuningUpdateFinetunedModelRequest=Km.serialization.object({name:Km.serialization.string(),creatorId:Km.serialization.property("creator_id",Km.serialization.string().optional()),organizationId:Km.serialization.property("organization_id",Km.serialization.string().optional()),settings:FXr.Settings,status:kXr.Status.optional(),createdAt:Km.serialization.property("created_at",Km.serialization.date().optional()),updatedAt:Km.serialization.property("updated_at",Km.serialization.date().optional()),completedAt:Km.serialization.property("completed_at",Km.serialization.date().optional()),lastUsed:Km.serialization.property("last_used",Km.serialization.date().optional())})});var vDe=x(Aue=>{"use strict";Object.defineProperty(Aue,"__esModule",{value:!0});Aue.FinetuningUpdateFinetunedModelRequest=void 0;var $Xr=pkt();Object.defineProperty(Aue,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return $Xr.FinetuningUpdateFinetunedModelRequest}})});var mkt=x(vL=>{"use strict";var BXr=vL&&vL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zXr=vL&&vL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&BXr(e,t,r)};Object.defineProperty(vL,"__esModule",{value:!0});zXr(vDe(),vL)});var gkt=x(UM=>{"use strict";var UXr=UM&&UM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hkt=UM&&UM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UXr(e,t,r)};Object.defineProperty(UM,"__esModule",{value:!0});hkt(fkt(),UM);hkt(mkt(),UM)});var Iue=x(Px=>{"use strict";var qXr=Px&&Px.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HXr=Px&&Px.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VXr=Px&&Px.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qXr(e,t,r);return HXr(e,t),e};Object.defineProperty(Px,"__esModule",{value:!0});Px.CreateConnectorOAuth=void 0;var Ex=VXr(Y());Px.CreateConnectorOAuth=Ex.serialization.object({clientId:Ex.serialization.property("client_id",Ex.serialization.string().optional()),clientSecret:Ex.serialization.property("client_secret",Ex.serialization.string().optional()),authorizeUrl:Ex.serialization.property("authorize_url",Ex.serialization.string().optional()),tokenUrl:Ex.serialization.property("token_url",Ex.serialization.string().optional()),scope:Ex.serialization.string().optional()})});var wDe=x(Tx=>{"use strict";var WXr=Tx&&Tx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KXr=Tx&&Tx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GXr=Tx&&Tx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WXr(e,t,r);return KXr(e,t),e};Object.defineProperty(Tx,"__esModule",{value:!0});Tx.AuthTokenType=void 0;var JXr=GXr(Y());Tx.AuthTokenType=JXr.serialization.enum_(["bearer","basic","noscheme"])});var Mue=x(Ax=>{"use strict";var ZXr=Ax&&Ax.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YXr=Ax&&Ax.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XXr=Ax&&Ax.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZXr(e,t,r);return YXr(e,t),e};Object.defineProperty(Ax,"__esModule",{value:!0});Ax.CreateConnectorServiceAuth=void 0;var ykt=XXr(Y()),QXr=wDe();Ax.CreateConnectorServiceAuth=ykt.serialization.object({type:QXr.AuthTokenType,token:ykt.serialization.string()})});var bkt=x(Mx=>{"use strict";var eQr=Mx&&Mx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tQr=Mx&&Mx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rQr=Mx&&Mx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eQr(e,t,r);return tQr(e,t),e};Object.defineProperty(Mx,"__esModule",{value:!0});Mx.CreateConnectorRequest=void 0;var Ix=rQr(Y()),nQr=Iue(),oQr=Mue();Mx.CreateConnectorRequest=Ix.serialization.object({name:Ix.serialization.string(),description:Ix.serialization.string().optional(),url:Ix.serialization.string(),excludes:Ix.serialization.list(Ix.serialization.string()).optional(),oauth:nQr.CreateConnectorOAuth.optional(),active:Ix.serialization.boolean().optional(),continueOnFailure:Ix.serialization.property("continue_on_failure",Ix.serialization.boolean().optional()),serviceAuth:Ix.serialization.property("service_auth",oQr.CreateConnectorServiceAuth.optional())})});var _kt=x(Rx=>{"use strict";var iQr=Rx&&Rx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aQr=Rx&&Rx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sQr=Rx&&Rx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iQr(e,t,r);return aQr(e,t),e};Object.defineProperty(Rx,"__esModule",{value:!0});Rx.UpdateConnectorRequest=void 0;var CP=sQr(Y()),uQr=Iue(),lQr=Mue();Rx.UpdateConnectorRequest=CP.serialization.object({name:CP.serialization.string().optional(),url:CP.serialization.string().optional(),excludes:CP.serialization.list(CP.serialization.string()).optional(),oauth:uQr.CreateConnectorOAuth.optional(),active:CP.serialization.boolean().optional(),continueOnFailure:CP.serialization.property("continue_on_failure",CP.serialization.boolean().optional()),serviceAuth:CP.serialization.property("service_auth",lQr.CreateConnectorServiceAuth.optional())})});var xDe=x(Hq=>{"use strict";Object.defineProperty(Hq,"__esModule",{value:!0});Hq.UpdateConnectorRequest=Hq.CreateConnectorRequest=void 0;var cQr=bkt();Object.defineProperty(Hq,"CreateConnectorRequest",{enumerable:!0,get:function(){return cQr.CreateConnectorRequest}});var dQr=_kt();Object.defineProperty(Hq,"UpdateConnectorRequest",{enumerable:!0,get:function(){return dQr.UpdateConnectorRequest}})});var vkt=x(wL=>{"use strict";var fQr=wL&&wL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pQr=wL&&wL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&fQr(e,t,r)};Object.defineProperty(wL,"__esModule",{value:!0});pQr(xDe(),wL)});var wkt=x(xL=>{"use strict";var mQr=xL&&xL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hQr=xL&&xL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mQr(e,t,r)};Object.defineProperty(xL,"__esModule",{value:!0});hQr(vkt(),xL)});var Skt=x(ia=>{"use strict";var xkt=ia&&ia.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gQr=ia&&ia.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z9=ia&&ia.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xkt(e,t,r);return gQr(e,t),e},SL=ia&&ia.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xkt(e,t,r)};Object.defineProperty(ia,"__esModule",{value:!0});ia.connectors=ia.finetuning=ia.datasets=ia.embedJobs=ia.v2=void 0;ia.v2=Z9(kFt());SL(Qje(),ia);ia.embedJobs=Z9(UFt());SL(nDe(),ia);ia.datasets=Z9(QFt());SL(lDe(),ia);ia.finetuning=Z9(gkt());SL(tDe(),ia);SL(oDe(),ia);ia.connectors=Z9(wkt());SL(xDe(),ia);SL(vDe(),ia)});var SDe=x(Nx=>{"use strict";var yQr=Nx&&Nx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bQr=Nx&&Nx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Qr=Nx&&Nx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yQr(e,t,r);return bQr(e,t),e};Object.defineProperty(Nx,"__esModule",{value:!0});Nx.ChatStreamRequestPromptTruncation=void 0;var vQr=_Qr(Y());Nx.ChatStreamRequestPromptTruncation=vQr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var CDe=x(jx=>{"use strict";var wQr=jx&&jx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xQr=jx&&jx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SQr=jx&&jx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wQr(e,t,r);return xQr(e,t),e};Object.defineProperty(jx,"__esModule",{value:!0});jx.ChatStreamRequestCitationQuality=void 0;var CQr=SQr(Y());jx.ChatStreamRequestCitationQuality=CQr.serialization.enum_(["fast","accurate","off"])});var Okt=x(Dx=>{"use strict";var OQr=Dx&&Dx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EQr=Dx&&Dx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PQr=Dx&&Dx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OQr(e,t,r);return EQr(e,t),e};Object.defineProperty(Dx,"__esModule",{value:!0});Dx.ChatStreamRequestConnectorsSearchOptions=void 0;var Ckt=PQr(Y());Dx.ChatStreamRequestConnectorsSearchOptions=Ckt.serialization.object({seed:Ckt.serialization.number().optional()})});var ODe=x(Lx=>{"use strict";var TQr=Lx&&Lx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AQr=Lx&&Lx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IQr=Lx&&Lx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TQr(e,t,r);return AQr(e,t),e};Object.defineProperty(Lx,"__esModule",{value:!0});Lx.ChatStreamRequestSafetyMode=void 0;var MQr=IQr(Y());Lx.ChatStreamRequestSafetyMode=MQr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var Pkt=x(Fx=>{"use strict";var RQr=Fx&&Fx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NQr=Fx&&Fx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jQr=Fx&&Fx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RQr(e,t,r);return NQr(e,t),e};Object.defineProperty(Fx,"__esModule",{value:!0});Fx.UnprocessableEntityErrorBody=void 0;var Ekt=jQr(Y());Fx.UnprocessableEntityErrorBody=Ekt.serialization.object({data:Ekt.serialization.string().optional()})});var Akt=x(kx=>{"use strict";var DQr=kx&&kx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LQr=kx&&kx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FQr=kx&&kx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DQr(e,t,r);return LQr(e,t),e};Object.defineProperty(kx,"__esModule",{value:!0});kx.TooManyRequestsErrorBody=void 0;var Tkt=FQr(Y());kx.TooManyRequestsErrorBody=Tkt.serialization.object({data:Tkt.serialization.string().optional()})});var Mkt=x($x=>{"use strict";var kQr=$x&&$x.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Qr=$x&&$x.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BQr=$x&&$x.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kQr(e,t,r);return $Qr(e,t),e};Object.defineProperty($x,"__esModule",{value:!0});$x.ClientClosedRequestErrorBody=void 0;var Ikt=BQr(Y());$x.ClientClosedRequestErrorBody=Ikt.serialization.object({data:Ikt.serialization.string().optional()})});var Nkt=x(Bx=>{"use strict";var zQr=Bx&&Bx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UQr=Bx&&Bx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qQr=Bx&&Bx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zQr(e,t,r);return UQr(e,t),e};Object.defineProperty(Bx,"__esModule",{value:!0});Bx.NotImplementedErrorBody=void 0;var Rkt=qQr(Y());Bx.NotImplementedErrorBody=Rkt.serialization.object({data:Rkt.serialization.string().optional()})});var Dkt=x(zx=>{"use strict";var HQr=zx&&zx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VQr=zx&&zx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WQr=zx&&zx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HQr(e,t,r);return VQr(e,t),e};Object.defineProperty(zx,"__esModule",{value:!0});zx.GatewayTimeoutErrorBody=void 0;var jkt=WQr(Y());zx.GatewayTimeoutErrorBody=jkt.serialization.object({data:jkt.serialization.string().optional()})});var EDe=x(Ux=>{"use strict";var KQr=Ux&&Ux.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GQr=Ux&&Ux.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JQr=Ux&&Ux.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KQr(e,t,r);return GQr(e,t),e};Object.defineProperty(Ux,"__esModule",{value:!0});Ux.ChatRequestPromptTruncation=void 0;var ZQr=JQr(Y());Ux.ChatRequestPromptTruncation=ZQr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var PDe=x(qx=>{"use strict";var YQr=qx&&qx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XQr=qx&&qx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QQr=qx&&qx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YQr(e,t,r);return XQr(e,t),e};Object.defineProperty(qx,"__esModule",{value:!0});qx.ChatRequestCitationQuality=void 0;var een=QQr(Y());qx.ChatRequestCitationQuality=een.serialization.enum_(["fast","accurate","off"])});var Fkt=x(Hx=>{"use strict";var ten=Hx&&Hx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ren=Hx&&Hx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nen=Hx&&Hx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ten(e,t,r);return ren(e,t),e};Object.defineProperty(Hx,"__esModule",{value:!0});Hx.ChatRequestConnectorsSearchOptions=void 0;var Lkt=nen(Y());Hx.ChatRequestConnectorsSearchOptions=Lkt.serialization.object({seed:Lkt.serialization.number().optional()})});var TDe=x(Vx=>{"use strict";var oen=Vx&&Vx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ien=Vx&&Vx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aen=Vx&&Vx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oen(e,t,r);return ien(e,t),e};Object.defineProperty(Vx,"__esModule",{value:!0});Vx.ChatRequestSafetyMode=void 0;var sen=aen(Y());Vx.ChatRequestSafetyMode=sen.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var ADe=x(Wx=>{"use strict";var uen=Wx&&Wx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),len=Wx&&Wx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cen=Wx&&Wx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uen(e,t,r);return len(e,t),e};Object.defineProperty(Wx,"__esModule",{value:!0});Wx.GenerateStreamRequestTruncate=void 0;var den=cen(Y());Wx.GenerateStreamRequestTruncate=den.serialization.enum_(["NONE","START","END"])});var IDe=x(Kx=>{"use strict";var fen=Kx&&Kx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pen=Kx&&Kx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),men=Kx&&Kx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fen(e,t,r);return pen(e,t),e};Object.defineProperty(Kx,"__esModule",{value:!0});Kx.GenerateStreamRequestReturnLikelihoods=void 0;var hen=men(Y());Kx.GenerateStreamRequestReturnLikelihoods=hen.serialization.enum_(["GENERATION","ALL","NONE"])});var MDe=x(Gx=>{"use strict";var gen=Gx&&Gx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yen=Gx&&Gx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ben=Gx&&Gx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gen(e,t,r);return yen(e,t),e};Object.defineProperty(Gx,"__esModule",{value:!0});Gx.GenerateRequestTruncate=void 0;var _en=ben(Y());Gx.GenerateRequestTruncate=_en.serialization.enum_(["NONE","START","END"])});var RDe=x(Jx=>{"use strict";var ven=Jx&&Jx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wen=Jx&&Jx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xen=Jx&&Jx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ven(e,t,r);return wen(e,t),e};Object.defineProperty(Jx,"__esModule",{value:!0});Jx.GenerateRequestReturnLikelihoods=void 0;var Sen=xen(Y());Jx.GenerateRequestReturnLikelihoods=Sen.serialization.enum_(["GENERATION","ALL","NONE"])});var NDe=x(Zx=>{"use strict";var Cen=Zx&&Zx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Oen=Zx&&Zx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Een=Zx&&Zx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Cen(e,t,r);return Oen(e,t),e};Object.defineProperty(Zx,"__esModule",{value:!0});Zx.EmbedRequestTruncate=void 0;var Pen=Een(Y());Zx.EmbedRequestTruncate=Pen.serialization.enum_(["NONE","START","END"])});var jDe=x(Yx=>{"use strict";var Ten=Yx&&Yx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Aen=Yx&&Yx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ien=Yx&&Yx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ten(e,t,r);return Aen(e,t),e};Object.defineProperty(Yx,"__esModule",{value:!0});Yx.ApiMetaApiVersion=void 0;var Vq=Ien(Y());Yx.ApiMetaApiVersion=Vq.serialization.object({version:Vq.serialization.string(),isDeprecated:Vq.serialization.property("is_deprecated",Vq.serialization.boolean().optional()),isExperimental:Vq.serialization.property("is_experimental",Vq.serialization.boolean().optional())})});var DDe=x(Xx=>{"use strict";var Men=Xx&&Xx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ren=Xx&&Xx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nen=Xx&&Xx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Men(e,t,r);return Ren(e,t),e};Object.defineProperty(Xx,"__esModule",{value:!0});Xx.ApiMetaBilledUnits=void 0;var qM=Nen(Y());Xx.ApiMetaBilledUnits=qM.serialization.object({inputTokens:qM.serialization.property("input_tokens",qM.serialization.number().optional()),outputTokens:qM.serialization.property("output_tokens",qM.serialization.number().optional()),searchUnits:qM.serialization.property("search_units",qM.serialization.number().optional()),classifications:qM.serialization.number().optional()})});var LDe=x(Qx=>{"use strict";var jen=Qx&&Qx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Den=Qx&&Qx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Len=Qx&&Qx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jen(e,t,r);return Den(e,t),e};Object.defineProperty(Qx,"__esModule",{value:!0});Qx.ApiMetaTokens=void 0;var Y9=Len(Y());Qx.ApiMetaTokens=Y9.serialization.object({inputTokens:Y9.serialization.property("input_tokens",Y9.serialization.number().optional()),outputTokens:Y9.serialization.property("output_tokens",Y9.serialization.number().optional())})});var tg=x(eS=>{"use strict";var Fen=eS&&eS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ken=eS&&eS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$en=eS&&eS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Fen(e,t,r);return ken(e,t),e};Object.defineProperty(eS,"__esModule",{value:!0});eS.ApiMeta=void 0;var X9=$en(Y()),Ben=jDe(),zen=DDe(),Uen=LDe();eS.ApiMeta=X9.serialization.object({apiVersion:X9.serialization.property("api_version",Ben.ApiMetaApiVersion.optional()),billedUnits:X9.serialization.property("billed_units",zen.ApiMetaBilledUnits.optional()),tokens:Uen.ApiMetaTokens.optional(),warnings:X9.serialization.list(X9.serialization.string()).optional()})});var FDe=x(tS=>{"use strict";var qen=tS&&tS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hen=tS&&tS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ven=tS&&tS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qen(e,t,r);return Hen(e,t),e};Object.defineProperty(tS,"__esModule",{value:!0});tS.EmbedFloatsResponse=void 0;var CL=Ven(Y()),Wen=tg();tS.EmbedFloatsResponse=CL.serialization.object({id:CL.serialization.string(),embeddings:CL.serialization.list(CL.serialization.list(CL.serialization.number())),texts:CL.serialization.list(CL.serialization.string()),meta:Wen.ApiMeta.optional()})});var kDe=x(rS=>{"use strict";var Ken=rS&&rS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gen=rS&&rS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jen=rS&&rS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ken(e,t,r);return Gen(e,t),e};Object.defineProperty(rS,"__esModule",{value:!0});rS.EmbedByTypeResponseEmbeddings=void 0;var Xf=Jen(Y());rS.EmbedByTypeResponseEmbeddings=Xf.serialization.object({float:Xf.serialization.list(Xf.serialization.list(Xf.serialization.number())).optional(),int8:Xf.serialization.list(Xf.serialization.list(Xf.serialization.number())).optional(),uint8:Xf.serialization.list(Xf.serialization.list(Xf.serialization.number())).optional(),binary:Xf.serialization.list(Xf.serialization.list(Xf.serialization.number())).optional(),ubinary:Xf.serialization.list(Xf.serialization.list(Xf.serialization.number())).optional()})});var $De=x(nS=>{"use strict";var Zen=nS&&nS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yen=nS&&nS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xen=nS&&nS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Zen(e,t,r);return Yen(e,t),e};Object.defineProperty(nS,"__esModule",{value:!0});nS.EmbedByTypeResponse=void 0;var Rue=Xen(Y()),Qen=kDe(),etn=tg();nS.EmbedByTypeResponse=Rue.serialization.object({id:Rue.serialization.string(),embeddings:Qen.EmbedByTypeResponseEmbeddings,texts:Rue.serialization.list(Rue.serialization.string()),meta:etn.ApiMeta.optional()})});var $kt=x(oS=>{"use strict";var ttn=oS&&oS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rtn=oS&&oS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ntn=oS&&oS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ttn(e,t,r);return rtn(e,t),e};Object.defineProperty(oS,"__esModule",{value:!0});oS.EmbedResponse=void 0;var kkt=ntn(Y()),otn=FDe(),itn=$De();oS.EmbedResponse=kkt.serialization.union(kkt.serialization.discriminant("responseType","response_type"),{embeddings_floats:otn.EmbedFloatsResponse,embeddings_by_type:itn.EmbedByTypeResponse}).transform({transform:t=>t,untransform:t=>t})});var zDe=x(iS=>{"use strict";var atn=iS&&iS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),stn=iS&&iS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),utn=iS&&iS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&atn(e,t,r);return stn(e,t),e};Object.defineProperty(iS,"__esModule",{value:!0});iS.RerankDocument=void 0;var BDe=utn(Y());iS.RerankDocument=BDe.serialization.record(BDe.serialization.string(),BDe.serialization.string())});var UDe=x(aS=>{"use strict";var ltn=aS&&aS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ctn=aS&&aS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dtn=aS&&aS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ltn(e,t,r);return ctn(e,t),e};Object.defineProperty(aS,"__esModule",{value:!0});aS.RerankRequestDocumentsItem=void 0;var Bkt=dtn(Y()),ftn=zDe();aS.RerankRequestDocumentsItem=Bkt.serialization.undiscriminatedUnion([Bkt.serialization.string(),ftn.RerankDocument])});var qDe=x(sS=>{"use strict";var ptn=sS&&sS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mtn=sS&&sS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),htn=sS&&sS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ptn(e,t,r);return mtn(e,t),e};Object.defineProperty(sS,"__esModule",{value:!0});sS.RerankResponseResultsItemDocument=void 0;var zkt=htn(Y());sS.RerankResponseResultsItemDocument=zkt.serialization.object({text:zkt.serialization.string()})});var HDe=x(uS=>{"use strict";var gtn=uS&&uS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ytn=uS&&uS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),btn=uS&&uS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gtn(e,t,r);return ytn(e,t),e};Object.defineProperty(uS,"__esModule",{value:!0});uS.RerankResponseResultsItem=void 0;var Nue=btn(Y()),_tn=qDe();uS.RerankResponseResultsItem=Nue.serialization.object({document:_tn.RerankResponseResultsItemDocument.optional(),index:Nue.serialization.number(),relevanceScore:Nue.serialization.property("relevance_score",Nue.serialization.number())})});var Ukt=x(lS=>{"use strict";var vtn=lS&&lS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wtn=lS&&lS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xtn=lS&&lS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vtn(e,t,r);return wtn(e,t),e};Object.defineProperty(lS,"__esModule",{value:!0});lS.RerankResponse=void 0;var VDe=xtn(Y()),Stn=HDe(),Ctn=tg();lS.RerankResponse=VDe.serialization.object({id:VDe.serialization.string().optional(),results:VDe.serialization.list(Stn.RerankResponseResultsItem),meta:Ctn.ApiMeta.optional()})});var WDe=x(cS=>{"use strict";var Otn=cS&&cS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Etn=cS&&cS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ptn=cS&&cS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Otn(e,t,r);return Etn(e,t),e};Object.defineProperty(cS,"__esModule",{value:!0});cS.ClassifyRequestTruncate=void 0;var Ttn=Ptn(Y());cS.ClassifyRequestTruncate=Ttn.serialization.enum_(["NONE","START","END"])});var KDe=x(dS=>{"use strict";var Atn=dS&&dS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Itn=dS&&dS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mtn=dS&&dS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Atn(e,t,r);return Itn(e,t),e};Object.defineProperty(dS,"__esModule",{value:!0});dS.ClassifyResponseClassificationsItemLabelsValue=void 0;var qkt=Mtn(Y());dS.ClassifyResponseClassificationsItemLabelsValue=qkt.serialization.object({confidence:qkt.serialization.number().optional()})});var GDe=x(fS=>{"use strict";var Rtn=fS&&fS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ntn=fS&&fS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jtn=fS&&fS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rtn(e,t,r);return Ntn(e,t),e};Object.defineProperty(fS,"__esModule",{value:!0});fS.ClassifyResponseClassificationsItemClassificationType=void 0;var Dtn=jtn(Y());fS.ClassifyResponseClassificationsItemClassificationType=Dtn.serialization.enum_(["single-label","multi-label"])});var JDe=x(pS=>{"use strict";var Ltn=pS&&pS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ftn=pS&&pS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ktn=pS&&pS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ltn(e,t,r);return Ftn(e,t),e};Object.defineProperty(pS,"__esModule",{value:!0});pS.ClassifyResponseClassificationsItem=void 0;var Iy=ktn(Y()),$tn=KDe(),Btn=GDe();pS.ClassifyResponseClassificationsItem=Iy.serialization.object({id:Iy.serialization.string(),input:Iy.serialization.string().optional(),prediction:Iy.serialization.string().optional(),predictions:Iy.serialization.list(Iy.serialization.string()),confidence:Iy.serialization.number().optional(),confidences:Iy.serialization.list(Iy.serialization.number()),labels:Iy.serialization.record(Iy.serialization.string(),$tn.ClassifyResponseClassificationsItemLabelsValue),classificationType:Iy.serialization.property("classification_type",Btn.ClassifyResponseClassificationsItemClassificationType)})});var Hkt=x(mS=>{"use strict";var ztn=mS&&mS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Utn=mS&&mS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qtn=mS&&mS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ztn(e,t,r);return Utn(e,t),e};Object.defineProperty(mS,"__esModule",{value:!0});mS.ClassifyResponse=void 0;var ZDe=qtn(Y()),Htn=JDe(),Vtn=tg();mS.ClassifyResponse=ZDe.serialization.object({id:ZDe.serialization.string(),classifications:ZDe.serialization.list(Htn.ClassifyResponseClassificationsItem),meta:Vtn.ApiMeta.optional()})});var YDe=x(hS=>{"use strict";var Wtn=hS&&hS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ktn=hS&&hS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gtn=hS&&hS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Wtn(e,t,r);return Ktn(e,t),e};Object.defineProperty(hS,"__esModule",{value:!0});hS.SummarizeRequestLength=void 0;var Jtn=Gtn(Y());hS.SummarizeRequestLength=Jtn.serialization.enum_(["short","medium","long"])});var XDe=x(gS=>{"use strict";var Ztn=gS&&gS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ytn=gS&&gS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xtn=gS&&gS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ztn(e,t,r);return Ytn(e,t),e};Object.defineProperty(gS,"__esModule",{value:!0});gS.SummarizeRequestFormat=void 0;var Qtn=Xtn(Y());gS.SummarizeRequestFormat=Qtn.serialization.enum_(["paragraph","bullets"])});var QDe=x(yS=>{"use strict";var ern=yS&&yS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),trn=yS&&yS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rrn=yS&&yS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ern(e,t,r);return trn(e,t),e};Object.defineProperty(yS,"__esModule",{value:!0});yS.SummarizeRequestExtractiveness=void 0;var nrn=rrn(Y());yS.SummarizeRequestExtractiveness=nrn.serialization.enum_(["low","medium","high"])});var Vkt=x(bS=>{"use strict";var orn=bS&&bS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),irn=bS&&bS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),arn=bS&&bS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&orn(e,t,r);return irn(e,t),e};Object.defineProperty(bS,"__esModule",{value:!0});bS.SummarizeResponse=void 0;var eLe=arn(Y()),srn=tg();bS.SummarizeResponse=eLe.serialization.object({id:eLe.serialization.string().optional(),summary:eLe.serialization.string().optional(),meta:srn.ApiMeta.optional()})});var Wkt=x(_S=>{"use strict";var urn=_S&&_S.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lrn=_S&&_S.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),crn=_S&&_S.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&urn(e,t,r);return lrn(e,t),e};Object.defineProperty(_S,"__esModule",{value:!0});_S.TokenizeResponse=void 0;var Wq=crn(Y()),drn=tg();_S.TokenizeResponse=Wq.serialization.object({tokens:Wq.serialization.list(Wq.serialization.number()),tokenStrings:Wq.serialization.property("token_strings",Wq.serialization.list(Wq.serialization.string())),meta:drn.ApiMeta.optional()})});var Gkt=x(vS=>{"use strict";var frn=vS&&vS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),prn=vS&&vS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mrn=vS&&vS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&frn(e,t,r);return prn(e,t),e};Object.defineProperty(vS,"__esModule",{value:!0});vS.DetokenizeResponse=void 0;var Kkt=mrn(Y()),hrn=tg();vS.DetokenizeResponse=Kkt.serialization.object({text:Kkt.serialization.string(),meta:hrn.ApiMeta.optional()})});var Jkt=x(wS=>{"use strict";var grn=wS&&wS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yrn=wS&&wS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),brn=wS&&wS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&grn(e,t,r);return yrn(e,t),e};Object.defineProperty(wS,"__esModule",{value:!0});wS.CheckApiKeyResponse=void 0;var Kq=brn(Y());wS.CheckApiKeyResponse=Kq.serialization.object({valid:Kq.serialization.boolean(),organizationId:Kq.serialization.property("organization_id",Kq.serialization.string().optional()),ownerId:Kq.serialization.property("owner_id",Kq.serialization.string().optional())})});var Gq=x(xS=>{"use strict";var _rn=xS&&xS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vrn=xS&&xS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wrn=xS&&xS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_rn(e,t,r);return vrn(e,t),e};Object.defineProperty(xS,"__esModule",{value:!0});xS.ToolCall=void 0;var Q9=wrn(Y());xS.ToolCall=Q9.serialization.object({name:Q9.serialization.string(),parameters:Q9.serialization.record(Q9.serialization.string(),Q9.serialization.unknown())})});var tLe=x(SS=>{"use strict";var xrn=SS&&SS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Srn=SS&&SS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Crn=SS&&SS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xrn(e,t,r);return Srn(e,t),e};Object.defineProperty(SS,"__esModule",{value:!0});SS.ChatMessage=void 0;var jue=Crn(Y()),Orn=Gq();SS.ChatMessage=jue.serialization.object({message:jue.serialization.string(),toolCalls:jue.serialization.property("tool_calls",jue.serialization.list(Orn.ToolCall).optional())})});var tK=x(CS=>{"use strict";var Ern=CS&&CS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Prn=CS&&CS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Trn=CS&&CS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ern(e,t,r);return Prn(e,t),e};Object.defineProperty(CS,"__esModule",{value:!0});CS.ToolResult=void 0;var eK=Trn(Y()),Arn=Gq();CS.ToolResult=eK.serialization.object({call:Arn.ToolCall,outputs:eK.serialization.list(eK.serialization.record(eK.serialization.string(),eK.serialization.unknown()))})});var nLe=x(OS=>{"use strict";var Irn=OS&&OS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mrn=OS&&OS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rrn=OS&&OS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Irn(e,t,r);return Mrn(e,t),e};Object.defineProperty(OS,"__esModule",{value:!0});OS.ToolMessage=void 0;var rLe=Rrn(Y()),Nrn=tK();OS.ToolMessage=rLe.serialization.object({toolResults:rLe.serialization.property("tool_results",rLe.serialization.list(Nrn.ToolResult).optional())})});var rK=x(ES=>{"use strict";var jrn=ES&&ES.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Drn=ES&&ES.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lrn=ES&&ES.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jrn(e,t,r);return Drn(e,t),e};Object.defineProperty(ES,"__esModule",{value:!0});ES.Message=void 0;var Frn=Lrn(Y()),oLe=tLe(),krn=nLe();ES.Message=Frn.serialization.union("role",{CHATBOT:oLe.ChatMessage,SYSTEM:oLe.ChatMessage,USER:oLe.ChatMessage,TOOL:krn.ToolMessage}).transform({transform:t=>t,untransform:t=>t})});var Due=x(PS=>{"use strict";var $rn=PS&&PS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Brn=PS&&PS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zrn=PS&&PS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$rn(e,t,r);return Brn(e,t),e};Object.defineProperty(PS,"__esModule",{value:!0});PS.ChatConnector=void 0;var OP=zrn(Y());PS.ChatConnector=OP.serialization.object({id:OP.serialization.string(),userAccessToken:OP.serialization.property("user_access_token",OP.serialization.string().optional()),continueOnFailure:OP.serialization.property("continue_on_failure",OP.serialization.boolean().optional()),options:OP.serialization.record(OP.serialization.string(),OP.serialization.unknown()).optional()})});var iLe=x(TS=>{"use strict";var Urn=TS&&TS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qrn=TS&&TS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hrn=TS&&TS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Urn(e,t,r);return qrn(e,t),e};Object.defineProperty(TS,"__esModule",{value:!0});TS.ToolParameterDefinitionsValue=void 0;var Lue=Hrn(Y());TS.ToolParameterDefinitionsValue=Lue.serialization.object({description:Lue.serialization.string().optional(),type:Lue.serialization.string(),required:Lue.serialization.boolean().optional()})});var Fue=x(AS=>{"use strict";var Vrn=AS&&AS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wrn=AS&&AS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Krn=AS&&AS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vrn(e,t,r);return Wrn(e,t),e};Object.defineProperty(AS,"__esModule",{value:!0});AS.Tool=void 0;var Jq=Krn(Y()),Grn=iLe();AS.Tool=Jq.serialization.object({name:Jq.serialization.string(),description:Jq.serialization.string(),parameterDefinitions:Jq.serialization.property("parameter_definitions",Jq.serialization.record(Jq.serialization.string(),Grn.ToolParameterDefinitionsValue).optional())})});var aLe=x(IS=>{"use strict";var Jrn=IS&&IS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zrn=IS&&IS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yrn=IS&&IS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Jrn(e,t,r);return Zrn(e,t),e};Object.defineProperty(IS,"__esModule",{value:!0});IS.JsonResponseFormat=void 0;var kue=Yrn(Y());IS.JsonResponseFormat=kue.serialization.object({schema:kue.serialization.record(kue.serialization.string(),kue.serialization.unknown()).optional()})});var $ue=x(MS=>{"use strict";var Xrn=MS&&MS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qrn=MS&&MS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),enn=MS&&MS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xrn(e,t,r);return Qrn(e,t),e};Object.defineProperty(MS,"__esModule",{value:!0});MS.ResponseFormat=void 0;var tnn=enn(Y()),rnn=wue(),nnn=aLe();MS.ResponseFormat=tnn.serialization.union("type",{text:rnn.TextResponseFormat,json_object:nnn.JsonResponseFormat}).transform({transform:t=>t,untransform:t=>t})});var Bue=x(RS=>{"use strict";var onn=RS&&RS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),inn=RS&&RS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ann=RS&&RS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&onn(e,t,r);return inn(e,t),e};Object.defineProperty(RS,"__esModule",{value:!0});RS.ChatCitation=void 0;var OL=ann(Y());RS.ChatCitation=OL.serialization.object({start:OL.serialization.number(),end:OL.serialization.number(),text:OL.serialization.string(),documentIds:OL.serialization.property("document_ids",OL.serialization.list(OL.serialization.string()))})});var nK=x(NS=>{"use strict";var snn=NS&&NS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),unn=NS&&NS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lnn=NS&&NS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&snn(e,t,r);return unn(e,t),e};Object.defineProperty(NS,"__esModule",{value:!0});NS.ChatSearchQuery=void 0;var zue=lnn(Y());NS.ChatSearchQuery=zue.serialization.object({text:zue.serialization.string(),generationId:zue.serialization.property("generation_id",zue.serialization.string())})});var sLe=x(jS=>{"use strict";var cnn=jS&&jS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dnn=jS&&jS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fnn=jS&&jS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cnn(e,t,r);return dnn(e,t),e};Object.defineProperty(jS,"__esModule",{value:!0});jS.ChatSearchResultConnector=void 0;var Zkt=fnn(Y());jS.ChatSearchResultConnector=Zkt.serialization.object({id:Zkt.serialization.string()})});var Uue=x(DS=>{"use strict";var pnn=DS&&DS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mnn=DS&&DS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hnn=DS&&DS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pnn(e,t,r);return mnn(e,t),e};Object.defineProperty(DS,"__esModule",{value:!0});DS.ChatSearchResult=void 0;var EP=hnn(Y()),gnn=nK(),ynn=sLe();DS.ChatSearchResult=EP.serialization.object({searchQuery:EP.serialization.property("search_query",gnn.ChatSearchQuery.optional()),connector:ynn.ChatSearchResultConnector,documentIds:EP.serialization.property("document_ids",EP.serialization.list(EP.serialization.string())),errorMessage:EP.serialization.property("error_message",EP.serialization.string().optional()),continueOnFailure:EP.serialization.property("continue_on_failure",EP.serialization.boolean().optional())})});var Zq=x(LS=>{"use strict";var bnn=LS&&LS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_nn=LS&&LS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vnn=LS&&LS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bnn(e,t,r);return _nn(e,t),e};Object.defineProperty(LS,"__esModule",{value:!0});LS.FinishReason=void 0;var wnn=vnn(Y());LS.FinishReason=wnn.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var uLe=x(FS=>{"use strict";var xnn=FS&&FS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Snn=FS&&FS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cnn=FS&&FS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xnn(e,t,r);return Snn(e,t),e};Object.defineProperty(FS,"__esModule",{value:!0});FS.NonStreamedChatResponse=void 0;var Hc=Cnn(Y()),Onn=Bue(),Enn=mL(),Pnn=nK(),Tnn=Uue(),Ann=Zq(),Inn=Gq(),Mnn=rK(),Rnn=tg();FS.NonStreamedChatResponse=Hc.serialization.object({text:Hc.serialization.string(),generationId:Hc.serialization.property("generation_id",Hc.serialization.string().optional()),citations:Hc.serialization.list(Onn.ChatCitation).optional(),documents:Hc.serialization.list(Enn.ChatDocument).optional(),isSearchRequired:Hc.serialization.property("is_search_required",Hc.serialization.boolean().optional()),searchQueries:Hc.serialization.property("search_queries",Hc.serialization.list(Pnn.ChatSearchQuery).optional()),searchResults:Hc.serialization.property("search_results",Hc.serialization.list(Tnn.ChatSearchResult).optional()),finishReason:Hc.serialization.property("finish_reason",Ann.FinishReason.optional()),toolCalls:Hc.serialization.property("tool_calls",Hc.serialization.list(Inn.ToolCall).optional()),chatHistory:Hc.serialization.property("chat_history",Hc.serialization.list(Mnn.Message).optional()),prompt:Hc.serialization.string().optional(),meta:Rnn.ApiMeta.optional()})});var $S=x(kS=>{"use strict";var Nnn=kS&&kS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jnn=kS&&kS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dnn=kS&&kS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Nnn(e,t,r);return jnn(e,t),e};Object.defineProperty(kS,"__esModule",{value:!0});kS.ChatStreamEvent=void 0;var Lnn=Dnn(Y());kS.ChatStreamEvent=Lnn.serialization.object({})});var cLe=x(BS=>{"use strict";var Fnn=BS&&BS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),knn=BS&&BS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$nn=BS&&BS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Fnn(e,t,r);return knn(e,t),e};Object.defineProperty(BS,"__esModule",{value:!0});BS.ChatStreamStartEvent=void 0;var lLe=$nn(Y()),Bnn=$S();BS.ChatStreamStartEvent=lLe.serialization.object({generationId:lLe.serialization.property("generation_id",lLe.serialization.string())}).extend(Bnn.ChatStreamEvent)});var fLe=x(zS=>{"use strict";var znn=zS&&zS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Unn=zS&&zS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qnn=zS&&zS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&znn(e,t,r);return Unn(e,t),e};Object.defineProperty(zS,"__esModule",{value:!0});zS.ChatSearchQueriesGenerationEvent=void 0;var dLe=qnn(Y()),Hnn=nK(),Vnn=$S();zS.ChatSearchQueriesGenerationEvent=dLe.serialization.object({searchQueries:dLe.serialization.property("search_queries",dLe.serialization.list(Hnn.ChatSearchQuery))}).extend(Vnn.ChatStreamEvent)});var pLe=x(US=>{"use strict";var Wnn=US&&US.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Knn=US&&US.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gnn=US&&US.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Wnn(e,t,r);return Knn(e,t),e};Object.defineProperty(US,"__esModule",{value:!0});US.ChatSearchResultsEvent=void 0;var que=Gnn(Y()),Jnn=Uue(),Znn=mL(),Ynn=$S();US.ChatSearchResultsEvent=que.serialization.object({searchResults:que.serialization.property("search_results",que.serialization.list(Jnn.ChatSearchResult).optional()),documents:que.serialization.list(Znn.ChatDocument).optional()}).extend(Ynn.ChatStreamEvent)});var mLe=x(qS=>{"use strict";var Xnn=qS&&qS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qnn=qS&&qS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eon=qS&&qS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xnn(e,t,r);return Qnn(e,t),e};Object.defineProperty(qS,"__esModule",{value:!0});qS.ChatTextGenerationEvent=void 0;var Ykt=eon(Y()),ton=$S();qS.ChatTextGenerationEvent=Ykt.serialization.object({text:Ykt.serialization.string()}).extend(ton.ChatStreamEvent)});var hLe=x(HS=>{"use strict";var ron=HS&&HS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),non=HS&&HS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oon=HS&&HS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ron(e,t,r);return non(e,t),e};Object.defineProperty(HS,"__esModule",{value:!0});HS.ChatCitationGenerationEvent=void 0;var Xkt=oon(Y()),ion=Bue(),aon=$S();HS.ChatCitationGenerationEvent=Xkt.serialization.object({citations:Xkt.serialization.list(ion.ChatCitation)}).extend(aon.ChatStreamEvent)});var gLe=x(VS=>{"use strict";var son=VS&&VS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uon=VS&&VS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lon=VS&&VS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&son(e,t,r);return uon(e,t),e};Object.defineProperty(VS,"__esModule",{value:!0});VS.ChatToolCallsGenerationEvent=void 0;var Hue=lon(Y()),con=Gq(),don=$S();VS.ChatToolCallsGenerationEvent=Hue.serialization.object({text:Hue.serialization.string().optional(),toolCalls:Hue.serialization.property("tool_calls",Hue.serialization.list(con.ToolCall))}).extend(don.ChatStreamEvent)});var yLe=x(WS=>{"use strict";var fon=WS&&WS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pon=WS&&WS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mon=WS&&WS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fon(e,t,r);return pon(e,t),e};Object.defineProperty(WS,"__esModule",{value:!0});WS.ChatStreamEndEventFinishReason=void 0;var hon=mon(Y());WS.ChatStreamEndEventFinishReason=hon.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var bLe=x(KS=>{"use strict";var gon=KS&&KS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yon=KS&&KS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bon=KS&&KS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gon(e,t,r);return yon(e,t),e};Object.defineProperty(KS,"__esModule",{value:!0});KS.ChatStreamEndEvent=void 0;var Qkt=bon(Y()),_on=yLe(),von=uLe(),won=$S();KS.ChatStreamEndEvent=Qkt.serialization.object({finishReason:Qkt.serialization.property("finish_reason",_on.ChatStreamEndEventFinishReason),response:von.NonStreamedChatResponse}).extend(won.ChatStreamEvent)});var _Le=x(GS=>{"use strict";var xon=GS&&GS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Son=GS&&GS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Con=GS&&GS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xon(e,t,r);return Son(e,t),e};Object.defineProperty(GS,"__esModule",{value:!0});GS.ToolCallDelta=void 0;var oK=Con(Y());GS.ToolCallDelta=oK.serialization.object({name:oK.serialization.string().optional(),index:oK.serialization.number().optional(),parameters:oK.serialization.string().optional(),text:oK.serialization.string().optional()})});var vLe=x(JS=>{"use strict";var Oon=JS&&JS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Eon=JS&&JS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pon=JS&&JS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Oon(e,t,r);return Eon(e,t),e};Object.defineProperty(JS,"__esModule",{value:!0});JS.ChatToolCallsChunkEvent=void 0;var e$t=Pon(Y()),Ton=_Le(),Aon=$S();JS.ChatToolCallsChunkEvent=e$t.serialization.object({toolCallDelta:e$t.serialization.property("tool_call_delta",Ton.ToolCallDelta)}).extend(Aon.ChatStreamEvent)});var r$t=x(ZS=>{"use strict";var Ion=ZS&&ZS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mon=ZS&&ZS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ron=ZS&&ZS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ion(e,t,r);return Mon(e,t),e};Object.defineProperty(ZS,"__esModule",{value:!0});ZS.StreamedChatResponse=void 0;var t$t=Ron(Y()),Non=cLe(),jon=fLe(),Don=pLe(),Lon=mLe(),Fon=hLe(),kon=gLe(),$on=bLe(),Bon=vLe();ZS.StreamedChatResponse=t$t.serialization.union(t$t.serialization.discriminant("eventType","event_type"),{"stream-start":Non.ChatStreamStartEvent,"search-queries-generation":jon.ChatSearchQueriesGenerationEvent,"search-results":Don.ChatSearchResultsEvent,"text-generation":Lon.ChatTextGenerationEvent,"citation-generation":Fon.ChatCitationGenerationEvent,"tool-calls-generation":kon.ChatToolCallsGenerationEvent,"stream-end":$on.ChatStreamEndEvent,"tool-calls-chunk":Bon.ChatToolCallsChunkEvent}).transform({transform:t=>t,untransform:t=>t})});var xLe=x(YS=>{"use strict";var zon=YS&&YS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Uon=YS&&YS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qon=YS&&YS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zon(e,t,r);return Uon(e,t),e};Object.defineProperty(YS,"__esModule",{value:!0});YS.SingleGenerationTokenLikelihoodsItem=void 0;var wLe=qon(Y());YS.SingleGenerationTokenLikelihoodsItem=wLe.serialization.object({token:wLe.serialization.string(),likelihood:wLe.serialization.number()})});var SLe=x(XS=>{"use strict";var Hon=XS&&XS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Von=XS&&XS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Won=XS&&XS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Hon(e,t,r);return Von(e,t),e};Object.defineProperty(XS,"__esModule",{value:!0});XS.SingleGeneration=void 0;var EL=Won(Y()),Kon=xLe();XS.SingleGeneration=EL.serialization.object({id:EL.serialization.string(),text:EL.serialization.string(),index:EL.serialization.number().optional(),likelihood:EL.serialization.number().optional(),tokenLikelihoods:EL.serialization.property("token_likelihoods",EL.serialization.list(Kon.SingleGenerationTokenLikelihoodsItem).optional())})});var n$t=x(QS=>{"use strict";var Gon=QS&&QS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jon=QS&&QS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zon=QS&&QS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Gon(e,t,r);return Jon(e,t),e};Object.defineProperty(QS,"__esModule",{value:!0});QS.Generation=void 0;var Vue=Zon(Y()),Yon=SLe(),Xon=tg();QS.Generation=Vue.serialization.object({id:Vue.serialization.string(),prompt:Vue.serialization.string().optional(),generations:Vue.serialization.list(Yon.SingleGeneration),meta:Xon.ApiMeta.optional()})});var iK=x(eC=>{"use strict";var Qon=eC&&eC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ein=eC&&eC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tin=eC&&eC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Qon(e,t,r);return ein(e,t),e};Object.defineProperty(eC,"__esModule",{value:!0});eC.GenerateStreamEvent=void 0;var rin=tin(Y());eC.GenerateStreamEvent=rin.serialization.object({})});var CLe=x(tC=>{"use strict";var nin=tC&&tC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oin=tC&&tC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iin=tC&&tC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nin(e,t,r);return oin(e,t),e};Object.defineProperty(tC,"__esModule",{value:!0});tC.GenerateStreamText=void 0;var aK=iin(Y()),ain=iK();tC.GenerateStreamText=aK.serialization.object({text:aK.serialization.string(),index:aK.serialization.number().optional(),isFinished:aK.serialization.property("is_finished",aK.serialization.boolean())}).extend(ain.GenerateStreamEvent)});var OLe=x(rC=>{"use strict";var sin=rC&&rC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uin=rC&&rC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lin=rC&&rC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sin(e,t,r);return uin(e,t),e};Object.defineProperty(rC,"__esModule",{value:!0});rC.SingleGenerationInStream=void 0;var sK=lin(Y()),cin=Zq();rC.SingleGenerationInStream=sK.serialization.object({id:sK.serialization.string(),text:sK.serialization.string(),index:sK.serialization.number().optional(),finishReason:sK.serialization.property("finish_reason",cin.FinishReason)})});var ELe=x(nC=>{"use strict";var din=nC&&nC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fin=nC&&nC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pin=nC&&nC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&din(e,t,r);return fin(e,t),e};Object.defineProperty(nC,"__esModule",{value:!0});nC.GenerateStreamEndResponse=void 0;var Wue=pin(Y()),min=OLe();nC.GenerateStreamEndResponse=Wue.serialization.object({id:Wue.serialization.string(),prompt:Wue.serialization.string().optional(),generations:Wue.serialization.list(min.SingleGenerationInStream).optional()})});var PLe=x(oC=>{"use strict";var hin=oC&&oC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gin=oC&&oC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yin=oC&&oC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hin(e,t,r);return gin(e,t),e};Object.defineProperty(oC,"__esModule",{value:!0});oC.GenerateStreamEnd=void 0;var Kue=yin(Y()),bin=Zq(),_in=ELe(),vin=iK();oC.GenerateStreamEnd=Kue.serialization.object({isFinished:Kue.serialization.property("is_finished",Kue.serialization.boolean()),finishReason:Kue.serialization.property("finish_reason",bin.FinishReason.optional()),response:_in.GenerateStreamEndResponse}).extend(vin.GenerateStreamEvent)});var TLe=x(iC=>{"use strict";var win=iC&&iC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xin=iC&&iC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sin=iC&&iC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&win(e,t,r);return xin(e,t),e};Object.defineProperty(iC,"__esModule",{value:!0});iC.GenerateStreamError=void 0;var Yq=Sin(Y()),Cin=Zq(),Oin=iK();iC.GenerateStreamError=Yq.serialization.object({index:Yq.serialization.number().optional(),isFinished:Yq.serialization.property("is_finished",Yq.serialization.boolean()),finishReason:Yq.serialization.property("finish_reason",Cin.FinishReason),err:Yq.serialization.string()}).extend(Oin.GenerateStreamEvent)});var i$t=x(aC=>{"use strict";var Ein=aC&&aC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pin=aC&&aC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tin=aC&&aC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ein(e,t,r);return Pin(e,t),e};Object.defineProperty(aC,"__esModule",{value:!0});aC.GenerateStreamedResponse=void 0;var o$t=Tin(Y()),Ain=CLe(),Iin=PLe(),Min=TLe();aC.GenerateStreamedResponse=o$t.serialization.union(o$t.serialization.discriminant("eventType","event_type"),{"text-generation":Ain.GenerateStreamText,"stream-end":Iin.GenerateStreamEnd,"stream-error":Min.GenerateStreamError}).transform({transform:t=>t,untransform:t=>t})});var ALe=x(sC=>{"use strict";var Rin=sC&&sC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Nin=sC&&sC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jin=sC&&sC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rin(e,t,r);return Nin(e,t),e};Object.defineProperty(sC,"__esModule",{value:!0});sC.EmbedJobStatus=void 0;var Din=jin(Y());sC.EmbedJobStatus=Din.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var ILe=x(uC=>{"use strict";var Lin=uC&&uC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fin=uC&&uC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kin=uC&&uC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lin(e,t,r);return Fin(e,t),e};Object.defineProperty(uC,"__esModule",{value:!0});uC.EmbedJobTruncate=void 0;var $in=kin(Y());uC.EmbedJobTruncate=$in.serialization.enum_(["START","END"])});var MLe=x(lC=>{"use strict";var Bin=lC&&lC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zin=lC&&lC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uin=lC&&lC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Bin(e,t,r);return zin(e,t),e};Object.defineProperty(lC,"__esModule",{value:!0});lC.EmbedJob=void 0;var l_=Uin(Y()),qin=ALe(),Hin=ILe(),Vin=tg();lC.EmbedJob=l_.serialization.object({jobId:l_.serialization.property("job_id",l_.serialization.string()),name:l_.serialization.string().optional(),status:qin.EmbedJobStatus,createdAt:l_.serialization.property("created_at",l_.serialization.date()),inputDatasetId:l_.serialization.property("input_dataset_id",l_.serialization.string()),outputDatasetId:l_.serialization.property("output_dataset_id",l_.serialization.string().optional()),model:l_.serialization.string(),truncate:Hin.EmbedJobTruncate,meta:Vin.ApiMeta.optional()})});var a$t=x(cC=>{"use strict";var Win=cC&&cC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kin=cC&&cC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gin=cC&&cC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Win(e,t,r);return Kin(e,t),e};Object.defineProperty(cC,"__esModule",{value:!0});cC.ListEmbedJobResponse=void 0;var RLe=Gin(Y()),Jin=MLe();cC.ListEmbedJobResponse=RLe.serialization.object({embedJobs:RLe.serialization.property("embed_jobs",RLe.serialization.list(Jin.EmbedJob).optional())})});var s$t=x(dC=>{"use strict";var Zin=dC&&dC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yin=dC&&dC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xin=dC&&dC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Zin(e,t,r);return Yin(e,t),e};Object.defineProperty(dC,"__esModule",{value:!0});dC.CreateEmbedJobResponse=void 0;var NLe=Xin(Y()),Qin=tg();dC.CreateEmbedJobResponse=NLe.serialization.object({jobId:NLe.serialization.property("job_id",NLe.serialization.string()),meta:Qin.ApiMeta.optional()})});var DLe=x(fC=>{"use strict";var ean=fC&&fC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tan=fC&&fC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ran=fC&&fC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ean(e,t,r);return tan(e,t),e};Object.defineProperty(fC,"__esModule",{value:!0});fC.ClassifyExample=void 0;var jLe=ran(Y());fC.ClassifyExample=jLe.serialization.object({text:jLe.serialization.string().optional(),label:jLe.serialization.string().optional()})});var u$t=x(pC=>{"use strict";var nan=pC&&pC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oan=pC&&pC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ian=pC&&pC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nan(e,t,r);return oan(e,t),e};Object.defineProperty(pC,"__esModule",{value:!0});pC.ParseInfo=void 0;var LLe=ian(Y());pC.ParseInfo=LLe.serialization.object({separator:LLe.serialization.string().optional(),delimiter:LLe.serialization.string().optional()})});var l$t=x(mC=>{"use strict";var aan=mC&&mC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),san=mC&&mC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uan=mC&&mC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aan(e,t,r);return san(e,t),e};Object.defineProperty(mC,"__esModule",{value:!0});mC.RerankerDataMetrics=void 0;var rg=uan(Y());mC.RerankerDataMetrics=rg.serialization.object({numTrainQueries:rg.serialization.property("num_train_queries",rg.serialization.number().optional()),numTrainRelevantPassages:rg.serialization.property("num_train_relevant_passages",rg.serialization.number().optional()),numTrainHardNegatives:rg.serialization.property("num_train_hard_negatives",rg.serialization.number().optional()),numEvalQueries:rg.serialization.property("num_eval_queries",rg.serialization.number().optional()),numEvalRelevantPassages:rg.serialization.property("num_eval_relevant_passages",rg.serialization.number().optional()),numEvalHardNegatives:rg.serialization.property("num_eval_hard_negatives",rg.serialization.number().optional())})});var c$t=x(hC=>{"use strict";var lan=hC&&hC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),can=hC&&hC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dan=hC&&hC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lan(e,t,r);return can(e,t),e};Object.defineProperty(hC,"__esModule",{value:!0});hC.ChatDataMetrics=void 0;var Xq=dan(Y());hC.ChatDataMetrics=Xq.serialization.object({numTrainTurns:Xq.serialization.property("num_train_turns",Xq.serialization.number().optional()),numEvalTurns:Xq.serialization.property("num_eval_turns",Xq.serialization.number().optional()),preamble:Xq.serialization.string().optional()})});var FLe=x(gC=>{"use strict";var fan=gC&&gC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pan=gC&&gC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),man=gC&&gC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fan(e,t,r);return pan(e,t),e};Object.defineProperty(gC,"__esModule",{value:!0});gC.LabelMetric=void 0;var Qq=man(Y());gC.LabelMetric=Qq.serialization.object({totalExamples:Qq.serialization.property("total_examples",Qq.serialization.number().optional()),label:Qq.serialization.string().optional(),samples:Qq.serialization.list(Qq.serialization.string()).optional()})});var d$t=x(yC=>{"use strict";var han=yC&&yC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gan=yC&&yC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yan=yC&&yC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&han(e,t,r);return gan(e,t),e};Object.defineProperty(yC,"__esModule",{value:!0});yC.ClassifyDataMetrics=void 0;var kLe=yan(Y()),ban=FLe();yC.ClassifyDataMetrics=kLe.serialization.object({labelMetrics:kLe.serialization.property("label_metrics",kLe.serialization.list(ban.LabelMetric).optional())})});var $Le=x(bC=>{"use strict";var _an=bC&&bC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),van=bC&&bC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wan=bC&&bC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_an(e,t,r);return van(e,t),e};Object.defineProperty(bC,"__esModule",{value:!0});bC.FinetuneDatasetMetrics=void 0;var ng=wan(Y());bC.FinetuneDatasetMetrics=ng.serialization.object({trainableTokenCount:ng.serialization.property("trainable_token_count",ng.serialization.number().optional()),totalExamples:ng.serialization.property("total_examples",ng.serialization.number().optional()),trainExamples:ng.serialization.property("train_examples",ng.serialization.number().optional()),trainSizeBytes:ng.serialization.property("train_size_bytes",ng.serialization.number().optional()),evalExamples:ng.serialization.property("eval_examples",ng.serialization.number().optional()),evalSizeBytes:ng.serialization.property("eval_size_bytes",ng.serialization.number().optional())})});var zLe=x(_C=>{"use strict";var xan=_C&&_C.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),San=_C&&_C.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Can=_C&&_C.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xan(e,t,r);return San(e,t),e};Object.defineProperty(_C,"__esModule",{value:!0});_C.MetricsEmbedDataFieldsItem=void 0;var BLe=Can(Y());_C.MetricsEmbedDataFieldsItem=BLe.serialization.object({name:BLe.serialization.string().optional(),count:BLe.serialization.number().optional()})});var ULe=x(vC=>{"use strict";var Oan=vC&&vC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ean=vC&&vC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pan=vC&&vC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Oan(e,t,r);return Ean(e,t),e};Object.defineProperty(vC,"__esModule",{value:!0});vC.MetricsEmbedData=void 0;var f$t=Pan(Y()),Tan=zLe();vC.MetricsEmbedData=f$t.serialization.object({fields:f$t.serialization.list(Tan.MetricsEmbedDataFieldsItem).optional()})});var p$t=x(wC=>{"use strict";var Aan=wC&&wC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ian=wC&&wC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Man=wC&&wC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Aan(e,t,r);return Ian(e,t),e};Object.defineProperty(wC,"__esModule",{value:!0});wC.Metrics=void 0;var qLe=Man(Y()),Ran=$Le(),Nan=ULe();wC.Metrics=qLe.serialization.object({finetuneDatasetMetrics:qLe.serialization.property("finetune_dataset_metrics",Ran.FinetuneDatasetMetrics.optional()),embedData:qLe.serialization.property("embed_data",Nan.MetricsEmbedData.optional())})});var HLe=x(SC=>{"use strict";var jan=SC&&SC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Dan=SC&&SC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lan=SC&&SC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jan(e,t,r);return Dan(e,t),e};Object.defineProperty(SC,"__esModule",{value:!0});SC.ConnectorOAuth=void 0;var xC=Lan(Y());SC.ConnectorOAuth=xC.serialization.object({clientId:xC.serialization.property("client_id",xC.serialization.string().optional()),clientSecret:xC.serialization.property("client_secret",xC.serialization.string().optional()),authorizeUrl:xC.serialization.property("authorize_url",xC.serialization.string()),tokenUrl:xC.serialization.property("token_url",xC.serialization.string()),scope:xC.serialization.string().optional()})});var VLe=x(CC=>{"use strict";var Fan=CC&&CC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kan=CC&&CC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$an=CC&&CC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Fan(e,t,r);return kan(e,t),e};Object.defineProperty(CC,"__esModule",{value:!0});CC.ConnectorAuthStatus=void 0;var Ban=$an(Y());CC.ConnectorAuthStatus=Ban.serialization.enum_(["valid","expired"])});var e2=x(OC=>{"use strict";var zan=OC&&OC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Uan=OC&&OC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qan=OC&&OC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zan(e,t,r);return Uan(e,t),e};Object.defineProperty(OC,"__esModule",{value:!0});OC.Connector=void 0;var yc=qan(Y()),Han=HLe(),Van=VLe();OC.Connector=yc.serialization.object({id:yc.serialization.string(),organizationId:yc.serialization.property("organization_id",yc.serialization.string().optional()),name:yc.serialization.string(),description:yc.serialization.string().optional(),url:yc.serialization.string().optional(),createdAt:yc.serialization.property("created_at",yc.serialization.date()),updatedAt:yc.serialization.property("updated_at",yc.serialization.date()),excludes:yc.serialization.list(yc.serialization.string()).optional(),authType:yc.serialization.property("auth_type",yc.serialization.string().optional()),oauth:Han.ConnectorOAuth.optional(),authStatus:yc.serialization.property("auth_status",Van.ConnectorAuthStatus.optional()),active:yc.serialization.boolean().optional(),continueOnFailure:yc.serialization.property("continue_on_failure",yc.serialization.boolean().optional())})});var m$t=x(EC=>{"use strict";var Wan=EC&&EC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kan=EC&&EC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gan=EC&&EC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Wan(e,t,r);return Kan(e,t),e};Object.defineProperty(EC,"__esModule",{value:!0});EC.ListConnectorsResponse=void 0;var Gue=Gan(Y()),Jan=e2();EC.ListConnectorsResponse=Gue.serialization.object({connectors:Gue.serialization.list(Jan.Connector),totalCount:Gue.serialization.property("total_count",Gue.serialization.number().optional())})});var h$t=x(PC=>{"use strict";var Zan=PC&&PC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yan=PC&&PC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xan=PC&&PC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Zan(e,t,r);return Yan(e,t),e};Object.defineProperty(PC,"__esModule",{value:!0});PC.CreateConnectorResponse=void 0;var Qan=Xan(Y()),esn=e2();PC.CreateConnectorResponse=Qan.serialization.object({connector:esn.Connector})});var g$t=x(TC=>{"use strict";var tsn=TC&&TC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rsn=TC&&TC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nsn=TC&&TC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tsn(e,t,r);return rsn(e,t),e};Object.defineProperty(TC,"__esModule",{value:!0});TC.GetConnectorResponse=void 0;var osn=nsn(Y()),isn=e2();TC.GetConnectorResponse=osn.serialization.object({connector:isn.Connector})});var y$t=x(AC=>{"use strict";var asn=AC&&AC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ssn=AC&&AC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),usn=AC&&AC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&asn(e,t,r);return ssn(e,t),e};Object.defineProperty(AC,"__esModule",{value:!0});AC.DeleteConnectorResponse=void 0;var WLe=usn(Y());AC.DeleteConnectorResponse=WLe.serialization.record(WLe.serialization.string(),WLe.serialization.unknown())});var b$t=x(IC=>{"use strict";var lsn=IC&&IC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),csn=IC&&IC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dsn=IC&&IC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lsn(e,t,r);return csn(e,t),e};Object.defineProperty(IC,"__esModule",{value:!0});IC.UpdateConnectorResponse=void 0;var fsn=dsn(Y()),psn=e2();IC.UpdateConnectorResponse=fsn.serialization.object({connector:psn.Connector})});var _$t=x(MC=>{"use strict";var msn=MC&&MC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hsn=MC&&MC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gsn=MC&&MC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&msn(e,t,r);return hsn(e,t),e};Object.defineProperty(MC,"__esModule",{value:!0});MC.OAuthAuthorizeResponse=void 0;var KLe=gsn(Y());MC.OAuthAuthorizeResponse=KLe.serialization.object({redirectUrl:KLe.serialization.property("redirect_url",KLe.serialization.string().optional())})});var GLe=x(RC=>{"use strict";var ysn=RC&&RC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bsn=RC&&RC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_sn=RC&&RC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ysn(e,t,r);return bsn(e,t),e};Object.defineProperty(RC,"__esModule",{value:!0});RC.CompatibleEndpoint=void 0;var vsn=_sn(Y());RC.CompatibleEndpoint=vsn.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var JLe=x(jC=>{"use strict";var wsn=jC&&jC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xsn=jC&&jC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ssn=jC&&jC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wsn(e,t,r);return xsn(e,t),e};Object.defineProperty(jC,"__esModule",{value:!0});jC.GetModelResponse=void 0;var NC=Ssn(Y()),v$t=GLe();jC.GetModelResponse=NC.serialization.object({name:NC.serialization.string().optional(),endpoints:NC.serialization.list(v$t.CompatibleEndpoint).optional(),finetuned:NC.serialization.boolean().optional(),contextLength:NC.serialization.property("context_length",NC.serialization.number().optional()),tokenizerUrl:NC.serialization.property("tokenizer_url",NC.serialization.string().optional()),defaultEndpoints:NC.serialization.property("default_endpoints",NC.serialization.list(v$t.CompatibleEndpoint).optional())})});var w$t=x(DC=>{"use strict";var Csn=DC&&DC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Osn=DC&&DC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Esn=DC&&DC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Csn(e,t,r);return Osn(e,t),e};Object.defineProperty(DC,"__esModule",{value:!0});DC.ListModelsResponse=void 0;var Jue=Esn(Y()),Psn=JLe();DC.ListModelsResponse=Jue.serialization.object({models:Jue.serialization.list(Psn.GetModelResponse),nextPageToken:Jue.serialization.property("next_page_token",Jue.serialization.string().optional())})});var x$t=x(we=>{"use strict";var Tsn=we&&we.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pe=we&&we.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Tsn(e,t,r)};Object.defineProperty(we,"__esModule",{value:!0});Pe(SDe(),we);Pe(CDe(),we);Pe(Okt(),we);Pe(ODe(),we);Pe(Pkt(),we);Pe(Akt(),we);Pe(Mkt(),we);Pe(Nkt(),we);Pe(Dkt(),we);Pe(EDe(),we);Pe(PDe(),we);Pe(Fkt(),we);Pe(TDe(),we);Pe(ADe(),we);Pe(IDe(),we);Pe(MDe(),we);Pe(RDe(),we);Pe(NDe(),we);Pe($kt(),we);Pe(UDe(),we);Pe(qDe(),we);Pe(HDe(),we);Pe(Ukt(),we);Pe(WDe(),we);Pe(KDe(),we);Pe(GDe(),we);Pe(JDe(),we);Pe(Hkt(),we);Pe(YDe(),we);Pe(XDe(),we);Pe(QDe(),we);Pe(Vkt(),we);Pe(Wkt(),we);Pe(Gkt(),we);Pe(Jkt(),we);Pe(Gq(),we);Pe(tLe(),we);Pe(tK(),we);Pe(nLe(),we);Pe(rK(),we);Pe(Due(),we);Pe(mL(),we);Pe(iLe(),we);Pe(Fue(),we);Pe(wue(),we);Pe(aLe(),we);Pe($ue(),we);Pe(Bue(),we);Pe(nK(),we);Pe(sLe(),we);Pe(Uue(),we);Pe(Zq(),we);Pe(jDe(),we);Pe(DDe(),we);Pe(LDe(),we);Pe(tg(),we);Pe(uLe(),we);Pe($S(),we);Pe(cLe(),we);Pe(fLe(),we);Pe(pLe(),we);Pe(mLe(),we);Pe(hLe(),we);Pe(gLe(),we);Pe(yLe(),we);Pe(bLe(),we);Pe(_Le(),we);Pe(vLe(),we);Pe(r$t(),we);Pe(eDe(),we);Pe(xue(),we);Pe(Jje(),we);Pe(Zje(),we);Pe(Yje(),we);Pe(Xje(),we);Pe(xLe(),we);Pe(SLe(),we);Pe(n$t(),we);Pe(iK(),we);Pe(CLe(),we);Pe(OLe(),we);Pe(ELe(),we);Pe(PLe(),we);Pe(TLe(),we);Pe(i$t(),we);Pe(Sue(),we);Pe(Cue(),we);Pe(FDe(),we);Pe(kDe(),we);Pe($De(),we);Pe(ALe(),we);Pe(ILe(),we);Pe(MLe(),we);Pe(a$t(),we);Pe(s$t(),we);Pe(zDe(),we);Pe(DLe(),we);Pe(aDe(),we);Pe(iDe(),we);Pe(sDe(),we);Pe(u$t(),we);Pe(l$t(),we);Pe(c$t(),we);Pe(FLe(),we);Pe(d$t(),we);Pe($Le(),we);Pe(zLe(),we);Pe(ULe(),we);Pe(p$t(),we);Pe(Eue(),we);Pe(HLe(),we);Pe(VLe(),we);Pe(e2(),we);Pe(m$t(),we);Pe(Iue(),we);Pe(wDe(),we);Pe(Mue(),we);Pe(h$t(),we);Pe(g$t(),we);Pe(y$t(),we);Pe(b$t(),we);Pe(_$t(),we);Pe(GLe(),we);Pe(JLe(),we);Pe(w$t(),we)});var S$t=x(LC=>{"use strict";var Asn=LC&&LC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Isn=LC&&LC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Msn=LC&&LC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Asn(e,t,r);return Isn(e,t),e};Object.defineProperty(LC,"__esModule",{value:!0});LC.ChatStreamRequest=void 0;var Mn=Msn(Y()),Rsn=rK(),Nsn=SDe(),jsn=Due(),Dsn=mL(),Lsn=CDe(),Fsn=Fue(),ksn=tK(),$sn=$ue(),Bsn=ODe();LC.ChatStreamRequest=Mn.serialization.object({message:Mn.serialization.string(),model:Mn.serialization.string().optional(),preamble:Mn.serialization.string().optional(),chatHistory:Mn.serialization.property("chat_history",Mn.serialization.list(Rsn.Message).optional()),conversationId:Mn.serialization.property("conversation_id",Mn.serialization.string().optional()),promptTruncation:Mn.serialization.property("prompt_truncation",Nsn.ChatStreamRequestPromptTruncation.optional()),connectors:Mn.serialization.list(jsn.ChatConnector).optional(),searchQueriesOnly:Mn.serialization.property("search_queries_only",Mn.serialization.boolean().optional()),documents:Mn.serialization.list(Dsn.ChatDocument).optional(),citationQuality:Mn.serialization.property("citation_quality",Lsn.ChatStreamRequestCitationQuality.optional()),temperature:Mn.serialization.number().optional(),maxTokens:Mn.serialization.property("max_tokens",Mn.serialization.number().optional()),maxInputTokens:Mn.serialization.property("max_input_tokens",Mn.serialization.number().optional()),k:Mn.serialization.number().optional(),p:Mn.serialization.number().optional(),seed:Mn.serialization.number().optional(),stopSequences:Mn.serialization.property("stop_sequences",Mn.serialization.list(Mn.serialization.string()).optional()),frequencyPenalty:Mn.serialization.property("frequency_penalty",Mn.serialization.number().optional()),presencePenalty:Mn.serialization.property("presence_penalty",Mn.serialization.number().optional()),rawPrompting:Mn.serialization.property("raw_prompting",Mn.serialization.boolean().optional()),returnPrompt:Mn.serialization.property("return_prompt",Mn.serialization.boolean().optional()),tools:Mn.serialization.list(Fsn.Tool).optional(),toolResults:Mn.serialization.property("tool_results",Mn.serialization.list(ksn.ToolResult).optional()),forceSingleStep:Mn.serialization.property("force_single_step",Mn.serialization.boolean().optional()),responseFormat:Mn.serialization.property("response_format",$sn.ResponseFormat.optional()),safetyMode:Mn.serialization.property("safety_mode",Bsn.ChatStreamRequestSafetyMode.optional())})});var C$t=x(FC=>{"use strict";var zsn=FC&&FC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Usn=FC&&FC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qsn=FC&&FC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zsn(e,t,r);return Usn(e,t),e};Object.defineProperty(FC,"__esModule",{value:!0});FC.ChatRequest=void 0;var Rn=qsn(Y()),Hsn=rK(),Vsn=EDe(),Wsn=Due(),Ksn=mL(),Gsn=PDe(),Jsn=Fue(),Zsn=tK(),Ysn=$ue(),Xsn=TDe();FC.ChatRequest=Rn.serialization.object({message:Rn.serialization.string(),model:Rn.serialization.string().optional(),preamble:Rn.serialization.string().optional(),chatHistory:Rn.serialization.property("chat_history",Rn.serialization.list(Hsn.Message).optional()),conversationId:Rn.serialization.property("conversation_id",Rn.serialization.string().optional()),promptTruncation:Rn.serialization.property("prompt_truncation",Vsn.ChatRequestPromptTruncation.optional()),connectors:Rn.serialization.list(Wsn.ChatConnector).optional(),searchQueriesOnly:Rn.serialization.property("search_queries_only",Rn.serialization.boolean().optional()),documents:Rn.serialization.list(Ksn.ChatDocument).optional(),citationQuality:Rn.serialization.property("citation_quality",Gsn.ChatRequestCitationQuality.optional()),temperature:Rn.serialization.number().optional(),maxTokens:Rn.serialization.property("max_tokens",Rn.serialization.number().optional()),maxInputTokens:Rn.serialization.property("max_input_tokens",Rn.serialization.number().optional()),k:Rn.serialization.number().optional(),p:Rn.serialization.number().optional(),seed:Rn.serialization.number().optional(),stopSequences:Rn.serialization.property("stop_sequences",Rn.serialization.list(Rn.serialization.string()).optional()),frequencyPenalty:Rn.serialization.property("frequency_penalty",Rn.serialization.number().optional()),presencePenalty:Rn.serialization.property("presence_penalty",Rn.serialization.number().optional()),rawPrompting:Rn.serialization.property("raw_prompting",Rn.serialization.boolean().optional()),returnPrompt:Rn.serialization.property("return_prompt",Rn.serialization.boolean().optional()),tools:Rn.serialization.list(Jsn.Tool).optional(),toolResults:Rn.serialization.property("tool_results",Rn.serialization.list(Zsn.ToolResult).optional()),forceSingleStep:Rn.serialization.property("force_single_step",Rn.serialization.boolean().optional()),responseFormat:Rn.serialization.property("response_format",Ysn.ResponseFormat.optional()),safetyMode:Rn.serialization.property("safety_mode",Xsn.ChatRequestSafetyMode.optional())})});var O$t=x(kC=>{"use strict";var Qsn=kC&&kC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eun=kC&&kC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tun=kC&&kC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Qsn(e,t,r);return eun(e,t),e};Object.defineProperty(kC,"__esModule",{value:!0});kC.GenerateStreamRequest=void 0;var Pa=tun(Y()),run=ADe(),nun=IDe();kC.GenerateStreamRequest=Pa.serialization.object({prompt:Pa.serialization.string(),model:Pa.serialization.string().optional(),numGenerations:Pa.serialization.property("num_generations",Pa.serialization.number().optional()),maxTokens:Pa.serialization.property("max_tokens",Pa.serialization.number().optional()),truncate:run.GenerateStreamRequestTruncate.optional(),temperature:Pa.serialization.number().optional(),seed:Pa.serialization.number().optional(),preset:Pa.serialization.string().optional(),endSequences:Pa.serialization.property("end_sequences",Pa.serialization.list(Pa.serialization.string()).optional()),stopSequences:Pa.serialization.property("stop_sequences",Pa.serialization.list(Pa.serialization.string()).optional()),k:Pa.serialization.number().optional(),p:Pa.serialization.number().optional(),frequencyPenalty:Pa.serialization.property("frequency_penalty",Pa.serialization.number().optional()),presencePenalty:Pa.serialization.property("presence_penalty",Pa.serialization.number().optional()),returnLikelihoods:Pa.serialization.property("return_likelihoods",nun.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:Pa.serialization.property("raw_prompting",Pa.serialization.boolean().optional())})});var E$t=x($C=>{"use strict";var oun=$C&&$C.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iun=$C&&$C.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aun=$C&&$C.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oun(e,t,r);return iun(e,t),e};Object.defineProperty($C,"__esModule",{value:!0});$C.GenerateRequest=void 0;var Ta=aun(Y()),sun=MDe(),uun=RDe();$C.GenerateRequest=Ta.serialization.object({prompt:Ta.serialization.string(),model:Ta.serialization.string().optional(),numGenerations:Ta.serialization.property("num_generations",Ta.serialization.number().optional()),maxTokens:Ta.serialization.property("max_tokens",Ta.serialization.number().optional()),truncate:sun.GenerateRequestTruncate.optional(),temperature:Ta.serialization.number().optional(),seed:Ta.serialization.number().optional(),preset:Ta.serialization.string().optional(),endSequences:Ta.serialization.property("end_sequences",Ta.serialization.list(Ta.serialization.string()).optional()),stopSequences:Ta.serialization.property("stop_sequences",Ta.serialization.list(Ta.serialization.string()).optional()),k:Ta.serialization.number().optional(),p:Ta.serialization.number().optional(),frequencyPenalty:Ta.serialization.property("frequency_penalty",Ta.serialization.number().optional()),presencePenalty:Ta.serialization.property("presence_penalty",Ta.serialization.number().optional()),returnLikelihoods:Ta.serialization.property("return_likelihoods",uun.GenerateRequestReturnLikelihoods.optional()),rawPrompting:Ta.serialization.property("raw_prompting",Ta.serialization.boolean().optional())})});var P$t=x(BC=>{"use strict";var lun=BC&&BC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cun=BC&&BC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dun=BC&&BC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lun(e,t,r);return cun(e,t),e};Object.defineProperty(BC,"__esModule",{value:!0});BC.EmbedRequest=void 0;var PL=dun(Y()),fun=Sue(),pun=Cue(),mun=NDe();BC.EmbedRequest=PL.serialization.object({texts:PL.serialization.list(PL.serialization.string()),model:PL.serialization.string().optional(),inputType:PL.serialization.property("input_type",fun.EmbedInputType.optional()),embeddingTypes:PL.serialization.property("embedding_types",PL.serialization.list(pun.EmbeddingType).optional()),truncate:mun.EmbedRequestTruncate.optional()})});var T$t=x(zC=>{"use strict";var hun=zC&&zC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gun=zC&&zC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yun=zC&&zC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hun(e,t,r);return gun(e,t),e};Object.defineProperty(zC,"__esModule",{value:!0});zC.RerankRequest=void 0;var og=yun(Y()),bun=UDe();zC.RerankRequest=og.serialization.object({model:og.serialization.string().optional(),query:og.serialization.string(),documents:og.serialization.list(bun.RerankRequestDocumentsItem),topN:og.serialization.property("top_n",og.serialization.number().optional()),rankFields:og.serialization.property("rank_fields",og.serialization.list(og.serialization.string()).optional()),returnDocuments:og.serialization.property("return_documents",og.serialization.boolean().optional()),maxChunksPerDoc:og.serialization.property("max_chunks_per_doc",og.serialization.number().optional())})});var A$t=x(UC=>{"use strict";var _un=UC&&UC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vun=UC&&UC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wun=UC&&UC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_un(e,t,r);return vun(e,t),e};Object.defineProperty(UC,"__esModule",{value:!0});UC.ClassifyRequest=void 0;var t2=wun(Y()),xun=DLe(),Sun=WDe();UC.ClassifyRequest=t2.serialization.object({inputs:t2.serialization.list(t2.serialization.string()),examples:t2.serialization.list(xun.ClassifyExample).optional(),model:t2.serialization.string().optional(),preset:t2.serialization.string().optional(),truncate:Sun.ClassifyRequestTruncate.optional()})});var I$t=x(qC=>{"use strict";var Cun=qC&&qC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Oun=qC&&qC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Eun=qC&&qC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Cun(e,t,r);return Oun(e,t),e};Object.defineProperty(qC,"__esModule",{value:!0});qC.SummarizeRequest=void 0;var r2=Eun(Y()),Pun=YDe(),Tun=XDe(),Aun=QDe();qC.SummarizeRequest=r2.serialization.object({text:r2.serialization.string(),length:Pun.SummarizeRequestLength.optional(),format:Tun.SummarizeRequestFormat.optional(),model:r2.serialization.string().optional(),extractiveness:Aun.SummarizeRequestExtractiveness.optional(),temperature:r2.serialization.number().optional(),additionalCommand:r2.serialization.property("additional_command",r2.serialization.string().optional())})});var M$t=x(HC=>{"use strict";var Iun=HC&&HC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mun=HC&&HC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Run=HC&&HC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Iun(e,t,r);return Mun(e,t),e};Object.defineProperty(HC,"__esModule",{value:!0});HC.TokenizeRequest=void 0;var ZLe=Run(Y());HC.TokenizeRequest=ZLe.serialization.object({text:ZLe.serialization.string(),model:ZLe.serialization.string()})});var R$t=x(VC=>{"use strict";var Nun=VC&&VC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jun=VC&&VC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dun=VC&&VC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Nun(e,t,r);return jun(e,t),e};Object.defineProperty(VC,"__esModule",{value:!0});VC.DetokenizeRequest=void 0;var Zue=Dun(Y());VC.DetokenizeRequest=Zue.serialization.object({tokens:Zue.serialization.list(Zue.serialization.number()),model:Zue.serialization.string()})});var N$t=x(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.DetokenizeRequest=Fs.TokenizeRequest=Fs.SummarizeRequest=Fs.ClassifyRequest=Fs.RerankRequest=Fs.EmbedRequest=Fs.GenerateRequest=Fs.GenerateStreamRequest=Fs.ChatRequest=Fs.ChatStreamRequest=void 0;var Lun=S$t();Object.defineProperty(Fs,"ChatStreamRequest",{enumerable:!0,get:function(){return Lun.ChatStreamRequest}});var Fun=C$t();Object.defineProperty(Fs,"ChatRequest",{enumerable:!0,get:function(){return Fun.ChatRequest}});var kun=O$t();Object.defineProperty(Fs,"GenerateStreamRequest",{enumerable:!0,get:function(){return kun.GenerateStreamRequest}});var $un=E$t();Object.defineProperty(Fs,"GenerateRequest",{enumerable:!0,get:function(){return $un.GenerateRequest}});var zun=P$t();Object.defineProperty(Fs,"EmbedRequest",{enumerable:!0,get:function(){return zun.EmbedRequest}});var Uun=T$t();Object.defineProperty(Fs,"RerankRequest",{enumerable:!0,get:function(){return Uun.RerankRequest}});var qun=A$t();Object.defineProperty(Fs,"ClassifyRequest",{enumerable:!0,get:function(){return qun.ClassifyRequest}});var Hun=I$t();Object.defineProperty(Fs,"SummarizeRequest",{enumerable:!0,get:function(){return Hun.SummarizeRequest}});var Vun=M$t();Object.defineProperty(Fs,"TokenizeRequest",{enumerable:!0,get:function(){return Vun.TokenizeRequest}});var Wun=R$t();Object.defineProperty(Fs,"DetokenizeRequest",{enumerable:!0,get:function(){return Wun.DetokenizeRequest}})});var j$t=x(TL=>{"use strict";var Kun=TL&&TL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gun=TL&&TL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Kun(e,t,r)};Object.defineProperty(TL,"__esModule",{value:!0});Gun(N$t(),TL)});var TP=x(PP=>{"use strict";var Jun=PP&&PP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YLe=PP&&PP.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Jun(e,t,r)};Object.defineProperty(PP,"__esModule",{value:!0});YLe(Skt(),PP);YLe(x$t(),PP);YLe(j$t(),PP)});var XLe=x(wi=>{"use strict";var Zun=wi&&wi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yun=wi&&wi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xun=wi&&wi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Zun(e,t,r);return Yun(e,t),e},Yue=wi&&wi.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},Qun=wi&&wi.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}};Object.defineProperty(wi,"__esModule",{value:!0});wi.fetchOverride=wi.parseAWSEvent=wi.getEndpointFromUrl=wi.getAuthHeaders=wi.getUrl=wi.mapResponseFromBedrock=void 0;var eln=kPe(),tln=(EPt(),jc(OPt)),rln=RAt(),nln=KIt(),oln=m9(),iln=Y(),aln=pNe(),sln=dFt(),uK=Xun(TP()),uln=(t,e)=>Yue(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return t(),yield e()}finally{process.env=r}}),lln={chat:uK.StreamedChatResponse,generate:uK.GenerateStreamedResponse},cln={chat:uK.NonStreamedChatResponse,embed:uK.EmbedResponse,generate:uK.Generation},dln=(t,e,r)=>Yue(void 0,void 0,void 0,function*(){let n=t?lln[e]:cln[e],o={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},i=yield n.parseOrThrow(r,o);return n.jsonOrThrow(i,o)});wi.mapResponseFromBedrock=dln;var fln=(t,e,r,n)=>{let o={bedrock:n?"invoke-with-response-stream":"invoke",sagemaker:n?"invocations-response-stream":"invocations"}[t];return{bedrock:`https://${t}-runtime.${e}.amazonaws.com/model/${r}/${o}`,sagemaker:`https://runtime.sagemaker.${e}.amazonaws.com/endpoints/${r}/${o}`}[t]};wi.getUrl=fln;var pln=(t,e,r,n,o,i)=>Yue(void 0,void 0,void 0,function*(){let a=(0,tln.fromNodeProviderChain)(),s=yield uln(()=>{i.awsAccessKey&&(process.env.AWS_ACCESS_KEY_ID=i.awsAccessKey),i.awsSecretKey&&(process.env.AWS_SECRET_ACCESS_KEY=i.awsSecretKey),i.awsSessionToken&&(process.env.AWS_SESSION_TOKEN=i.awsSessionToken)},()=>a()),u=new nln.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:eln.Sha256});delete r.connection,r.host=t.hostname;let l=new rln.HttpRequest({method:e.toUpperCase(),protocol:t.protocol,path:t.pathname,headers:r,body:n});return(yield u.sign(l)).headers});wi.getAuthHeaders=pln;var mln=(t,e,r,n)=>{if(e&&t.includes(e))return"chat";if(r&&t.includes(r))return"embed";if(n&&t.includes(n))return"generate";throw new Error(`Unknown endpoint in url: ${t}`)};wi.getEndpointFromUrl=mln;var hln=t=>{let e=/{[^\}]*}/,r=t.match(e);if(r?.[0]){let n=JSON.parse(r[0]);if(n.bytes){let o=Buffer.from(n.bytes,"base64").toString("utf-8"),i=JSON.parse(o);if(i.event_type)return i}}};wi.parseAWSEvent=hln;var gln=(t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>Yue(void 0,void 0,void 0,function*(){var a,s;let u=i.url.split("/").pop(),l=i.body;console.assert(l.model,"model is required");let c=!!l.stream,d=(0,wi.getUrl)(t,e,l.model,c);delete l.stream,delete l.model,delete i.headers.Authorization,i.headers.Host=new URL(d).hostname;let f=yield(0,wi.getAuthHeaders)(new URL(d),i.method,i.headers,JSON.stringify(l),t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o});i.url=d,i.headers=f;let p=yield(0,iln.fetcher)(i);if(!p.ok)return p;try{if(c){let y=(0,aln.readableStreamAsyncIterable)(p.body),g=new sln.LineDecoder,_=new oln.PassThrough;try{for(var m=Qun(y),h;h=yield m.next(),!h.done;){let w=h.value;for(let S of g.decode(w)){let C=(0,wi.parseAWSEvent)(S);if(C){let E=yield(0,wi.mapResponseFromBedrock)(c,u,C);_.push(JSON.stringify(E)+`
`)}}}}catch(w){a={error:w}}finally{try{h&&!h.done&&(s=m.return)&&(yield s.call(m))}finally{if(a)throw a.error}}for(let w of g.flush()){let S=(0,wi.parseAWSEvent)(w);if(S){let C=yield(0,wi.mapResponseFromBedrock)(c,u,S);_.push(JSON.stringify(C)+`
`)}}return _.end(),{ok:!0,body:_}}else{let y=yield p.body;return{ok:!0,body:yield(0,wi.mapResponseFromBedrock)(c,u,y)}}}catch(y){throw y}});wi.fetchOverride=gln});var AP=x(Xue=>{"use strict";Object.defineProperty(Xue,"__esModule",{value:!0});Xue.CohereEnvironment=void 0;Xue.CohereEnvironment={Production:"https://api.cohere.com"}});var HM=x((D$t,Que)=>{(function(t,e,r){typeof Que<"u"&&Que.exports?Que.exports=r():typeof define=="function"&&define.amd?define(r):e[t]=r()})("urljoin",D$t,function(){function t(e){var r=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var n=e.shift();e[0]=n+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var o=0;o<e.length;o++){var i=e[o];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(o>0&&(i=i.replace(/^[\/]+/,"")),o<e.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),r.push(i))}var a=r.join("/");a=a.replace(/\/(\?|&|#[^!])/g,"$1");var s=a.split("?");return a=s.shift()+(s.length>0?"?":"")+s.join("&"),a}return function(){var e;return typeof arguments[0]=="object"?e=arguments[0]:e=[].slice.call(arguments),t(e)}})});var eFe=x(Zm=>{"use strict";var yln=Zm&&Zm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bln=Zm&&Zm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lK=Zm&&Zm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yln(e,t,r);return bln(e,t),e},ele=Zm&&Zm.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},_ln=Zm&&Zm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Zm,"__esModule",{value:!0});Zm.V2=void 0;var L$t=lK(AP()),Gm=lK(Y()),ks=lK(QE()),Jm=lK(TP()),F$t=_ln(HM()),IP=lK(au()),QLe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return ele(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Gm.fetcher)({url:(0,F$t.default)((o=yield Gm.Supplier.get(this._options.environment))!==null&&o!==void 0?o:L$t.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Gm.Supplier.get(this._options.clientName))!=null?yield Gm.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Gm.RUNTIME.type,"X-Fern-Runtime-Version":Gm.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Jm.V2ChatStreamRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!0}),responseType:"sse",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return new Gm.Stream({stream:i.body,parse:a=>ele(this,void 0,void 0,function*(){return Jm.StreamedChatResponse2.parseOrThrow(a,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]})}),signal:r?.abortSignal,eventShape:{type:"sse",streamTerminator:"[DONE]"}});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new ks.BadRequestError(i.error.body);case 401:throw new ks.UnauthorizedError(i.error.body);case 403:throw new ks.ForbiddenError(i.error.body);case 404:throw new ks.NotFoundError(i.error.body);case 422:throw new ks.UnprocessableEntityError(Jm.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ks.TooManyRequestsError(Jm.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ks.ClientClosedRequestError(Jm.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ks.InternalServerError(i.error.body);case 501:throw new ks.NotImplementedError(Jm.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ks.ServiceUnavailableError(i.error.body);case 504:throw new ks.GatewayTimeoutError(Jm.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new IP.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new IP.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new IP.CohereTimeoutError;case"unknown":throw new IP.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return ele(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Gm.fetcher)({url:(0,F$t.default)((o=yield Gm.Supplier.get(this._options.environment))!==null&&o!==void 0?o:L$t.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Gm.Supplier.get(this._options.clientName))!=null?yield Gm.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Gm.RUNTIME.type,"X-Fern-Runtime-Version":Gm.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Jm.V2ChatRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!1}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Jm.NonStreamedChatResponse2.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new ks.BadRequestError(i.error.body);case 401:throw new ks.UnauthorizedError(i.error.body);case 403:throw new ks.ForbiddenError(i.error.body);case 404:throw new ks.NotFoundError(i.error.body);case 422:throw new ks.UnprocessableEntityError(Jm.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ks.TooManyRequestsError(Jm.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ks.ClientClosedRequestError(Jm.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ks.InternalServerError(i.error.body);case 501:throw new ks.NotImplementedError(Jm.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ks.ServiceUnavailableError(i.error.body);case 504:throw new ks.GatewayTimeoutError(Jm.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new IP.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new IP.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new IP.CohereTimeoutError;case"unknown":throw new IP.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return ele(this,void 0,void 0,function*(){let r=(e=yield Gm.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new IP.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Zm.V2=QLe});var k$t=x(Ym=>{"use strict";var vln=Ym&&Ym.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wln=Ym&&Ym.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dK=Ym&&Ym.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vln(e,t,r);return wln(e,t),e},cK=Ym&&Ym.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},xln=Ym&&Ym.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ym,"__esModule",{value:!0});Ym.EmbedJobs=void 0;var tle=dK(AP()),Aa=dK(Y()),tn=dK(QE()),rle=xln(HM()),Ga=dK(TP()),kd=dK(au()),tFe=class{constructor(e={}){this._options=e}list(e){var r,n;return cK(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Aa.fetcher)({url:(0,rle.default)((n=yield Aa.Supplier.get(this._options.environment))!==null&&n!==void 0?n:tle.CohereEnvironment.Production,"v1/embed-jobs"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Aa.Supplier.get(this._options.clientName))!=null?yield Aa.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Aa.RUNTIME.type,"X-Fern-Runtime-Version":Aa.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return Ga.ListEmbedJobResponse.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new tn.BadRequestError(o.error.body);case 401:throw new tn.UnauthorizedError(o.error.body);case 403:throw new tn.ForbiddenError(o.error.body);case 404:throw new tn.NotFoundError(o.error.body);case 422:throw new tn.UnprocessableEntityError(Ga.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new tn.TooManyRequestsError(Ga.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new tn.ClientClosedRequestError(Ga.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new tn.InternalServerError(o.error.body);case 501:throw new tn.NotImplementedError(Ga.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new tn.ServiceUnavailableError(o.error.body);case 504:throw new tn.GatewayTimeoutError(Ga.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new kd.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new kd.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new kd.CohereTimeoutError;case"unknown":throw new kd.CohereError({message:o.error.errorMessage})}})}create(e,r){var n,o;return cK(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Aa.fetcher)({url:(0,rle.default)((o=yield Aa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:tle.CohereEnvironment.Production,"v1/embed-jobs"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Aa.Supplier.get(this._options.clientName))!=null?yield Aa.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Aa.RUNTIME.type,"X-Fern-Runtime-Version":Aa.RUNTIME.version},contentType:"application/json",requestType:"json",body:Ga.CreateEmbedJobRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Ga.CreateEmbedJobResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new tn.BadRequestError(i.error.body);case 401:throw new tn.UnauthorizedError(i.error.body);case 403:throw new tn.ForbiddenError(i.error.body);case 404:throw new tn.NotFoundError(i.error.body);case 422:throw new tn.UnprocessableEntityError(Ga.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new tn.TooManyRequestsError(Ga.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new tn.ClientClosedRequestError(Ga.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new tn.InternalServerError(i.error.body);case 501:throw new tn.NotImplementedError(Ga.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new tn.ServiceUnavailableError(i.error.body);case 504:throw new tn.GatewayTimeoutError(Ga.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new kd.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new kd.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new kd.CohereTimeoutError;case"unknown":throw new kd.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return cK(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Aa.fetcher)({url:(0,rle.default)((o=yield Aa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:tle.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Aa.Supplier.get(this._options.clientName))!=null?yield Aa.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Aa.RUNTIME.type,"X-Fern-Runtime-Version":Aa.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Ga.EmbedJob.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new tn.BadRequestError(i.error.body);case 401:throw new tn.UnauthorizedError(i.error.body);case 403:throw new tn.ForbiddenError(i.error.body);case 404:throw new tn.NotFoundError(i.error.body);case 422:throw new tn.UnprocessableEntityError(Ga.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new tn.TooManyRequestsError(Ga.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new tn.ClientClosedRequestError(Ga.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new tn.InternalServerError(i.error.body);case 501:throw new tn.NotImplementedError(Ga.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new tn.ServiceUnavailableError(i.error.body);case 504:throw new tn.GatewayTimeoutError(Ga.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new kd.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new kd.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new kd.CohereTimeoutError;case"unknown":throw new kd.CohereError({message:i.error.errorMessage})}})}cancel(e,r){var n,o;return cK(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Aa.fetcher)({url:(0,rle.default)((o=yield Aa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:tle.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}/cancel`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Aa.Supplier.get(this._options.clientName))!=null?yield Aa.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Aa.RUNTIME.type,"X-Fern-Runtime-Version":Aa.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(!i.ok){if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new tn.BadRequestError(i.error.body);case 401:throw new tn.UnauthorizedError(i.error.body);case 403:throw new tn.ForbiddenError(i.error.body);case 404:throw new tn.NotFoundError(i.error.body);case 422:throw new tn.UnprocessableEntityError(Ga.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new tn.TooManyRequestsError(Ga.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new tn.ClientClosedRequestError(Ga.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new tn.InternalServerError(i.error.body);case 501:throw new tn.NotImplementedError(Ga.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new tn.ServiceUnavailableError(i.error.body);case 504:throw new tn.GatewayTimeoutError(Ga.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new kd.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new kd.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new kd.CohereTimeoutError;case"unknown":throw new kd.CohereError({message:i.error.errorMessage})}}})}_getAuthorizationHeader(){var e;return cK(this,void 0,void 0,function*(){let r=(e=yield Aa.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new kd.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Ym.EmbedJobs=tFe});var $$t=x(Xm=>{"use strict";var Sln=Xm&&Xm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cln=Xm&&Xm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mK=Xm&&Xm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Sln(e,t,r);return Cln(e,t),e},n2=Xm&&Xm.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},Oln=Xm&&Xm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Xm,"__esModule",{value:!0});Xm.Datasets=void 0;var fK=mK(AP()),qo=mK(Y()),cr=mK(QE()),pK=Oln(HM()),Mi=mK(TP()),du=mK(au()),rFe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return n2(this,void 0,void 0,function*(){let{datasetType:i,before:a,after:s,limit:u,offset:l,validationStatus:c}=e,d={};i!=null&&(d.datasetType=i),a!=null&&(d.before=a.toISOString()),s!=null&&(d.after=s.toISOString()),u!=null&&(d.limit=u.toString()),l!=null&&(d.offset=l.toString()),c!=null&&(d.validationStatus=c);let f=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qo.fetcher)({url:(0,pK.default)((o=yield qo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:fK.CohereEnvironment.Production,"v1/datasets"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qo.Supplier.get(this._options.clientName))!=null?yield qo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.12.0","X-Fern-Runtime":qo.RUNTIME.type,"X-Fern-Runtime-Version":qo.RUNTIME.version},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(f.ok)return Mi.DatasetsListResponse.parseOrThrow(f.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new cr.BadRequestError(f.error.body);case 401:throw new cr.UnauthorizedError(f.error.body);case 403:throw new cr.ForbiddenError(f.error.body);case 404:throw new cr.NotFoundError(f.error.body);case 422:throw new cr.UnprocessableEntityError(Mi.UnprocessableEntityErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new cr.TooManyRequestsError(Mi.TooManyRequestsErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new cr.ClientClosedRequestError(Mi.ClientClosedRequestErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new cr.InternalServerError(f.error.body);case 501:throw new cr.NotImplementedError(Mi.NotImplementedErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new cr.ServiceUnavailableError(f.error.body);case 504:throw new cr.GatewayTimeoutError(Mi.GatewayTimeoutErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new du.CohereError({statusCode:f.error.statusCode,body:f.error.body})}switch(f.error.reason){case"non-json":throw new du.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody});case"timeout":throw new du.CohereTimeoutError;case"unknown":throw new du.CohereError({message:f.error.errorMessage})}})}create(e,r,n,o){var i,a;return n2(this,void 0,void 0,function*(){let s={};s.name=n.name,s.type=n.type,n.keepOriginalFile!=null&&(s.keep_original_file=n.keepOriginalFile.toString()),n.skipMalformedInput!=null&&(s.skip_malformed_input=n.skipMalformedInput.toString()),n.keepFields!=null&&(Array.isArray(n.keepFields)?s.keep_fields=n.keepFields.map(d=>d):s.keep_fields=n.keepFields),n.optionalFields!=null&&(Array.isArray(n.optionalFields)?s.optional_fields=n.optionalFields.map(d=>d):s.optional_fields=n.optionalFields),n.textSeparator!=null&&(s.text_separator=n.textSeparator),n.csvDelimiter!=null&&(s.csv_delimiter=n.csvDelimiter),n.dryRun!=null&&(s.dry_run=n.dryRun.toString());let u=yield qo.newFormData();yield u.appendFile("data",e,e?.name),r!=null&&(yield u.appendFile("eval_data",r,r?.name));let l=yield u.getRequest(),c=yield((i=this._options.fetcher)!==null&&i!==void 0?i:qo.fetcher)({url:(0,pK.default)((a=yield qo.Supplier.get(this._options.environment))!==null&&a!==void 0?a:fK.CohereEnvironment.Production,"v1/datasets"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qo.Supplier.get(this._options.clientName))!=null?yield qo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.12.0","X-Fern-Runtime":qo.RUNTIME.type,"X-Fern-Runtime-Version":qo.RUNTIME.version},l.headers),queryParameters:s,requestType:"file",duplex:l.duplex,body:l.body,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:3e5,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(c.ok)return Mi.DatasetsCreateResponse.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new cr.BadRequestError(c.error.body);case 401:throw new cr.UnauthorizedError(c.error.body);case 403:throw new cr.ForbiddenError(c.error.body);case 404:throw new cr.NotFoundError(c.error.body);case 422:throw new cr.UnprocessableEntityError(Mi.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new cr.TooManyRequestsError(Mi.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new cr.ClientClosedRequestError(Mi.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new cr.InternalServerError(c.error.body);case 501:throw new cr.NotImplementedError(Mi.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new cr.ServiceUnavailableError(c.error.body);case 504:throw new cr.GatewayTimeoutError(Mi.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new du.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new du.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new du.CohereTimeoutError;case"unknown":throw new du.CohereError({message:c.error.errorMessage})}})}getUsage(e){var r,n;return n2(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:qo.fetcher)({url:(0,pK.default)((n=yield qo.Supplier.get(this._options.environment))!==null&&n!==void 0?n:fK.CohereEnvironment.Production,"v1/datasets/usage"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qo.Supplier.get(this._options.clientName))!=null?yield qo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.12.0","X-Fern-Runtime":qo.RUNTIME.type,"X-Fern-Runtime-Version":qo.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return Mi.DatasetsGetUsageResponse.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new cr.BadRequestError(o.error.body);case 401:throw new cr.UnauthorizedError(o.error.body);case 403:throw new cr.ForbiddenError(o.error.body);case 404:throw new cr.NotFoundError(o.error.body);case 422:throw new cr.UnprocessableEntityError(Mi.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new cr.TooManyRequestsError(Mi.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new cr.ClientClosedRequestError(Mi.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new cr.InternalServerError(o.error.body);case 501:throw new cr.NotImplementedError(Mi.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new cr.ServiceUnavailableError(o.error.body);case 504:throw new cr.GatewayTimeoutError(Mi.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new du.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new du.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new du.CohereTimeoutError;case"unknown":throw new du.CohereError({message:o.error.errorMessage})}})}get(e,r){var n,o;return n2(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qo.fetcher)({url:(0,pK.default)((o=yield qo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:fK.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qo.Supplier.get(this._options.clientName))!=null?yield qo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.12.0","X-Fern-Runtime":qo.RUNTIME.type,"X-Fern-Runtime-Version":qo.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Mi.DatasetsGetResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new cr.BadRequestError(i.error.body);case 401:throw new cr.UnauthorizedError(i.error.body);case 403:throw new cr.ForbiddenError(i.error.body);case 404:throw new cr.NotFoundError(i.error.body);case 422:throw new cr.UnprocessableEntityError(Mi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new cr.TooManyRequestsError(Mi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new cr.ClientClosedRequestError(Mi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new cr.InternalServerError(i.error.body);case 501:throw new cr.NotImplementedError(Mi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new cr.ServiceUnavailableError(i.error.body);case 504:throw new cr.GatewayTimeoutError(Mi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new du.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new du.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new du.CohereTimeoutError;case"unknown":throw new du.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return n2(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qo.fetcher)({url:(0,pK.default)((o=yield qo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:fK.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qo.Supplier.get(this._options.clientName))!=null?yield qo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.12.0","X-Fern-Runtime":qo.RUNTIME.type,"X-Fern-Runtime-Version":qo.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Mi.datasets.delete.Response.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new cr.BadRequestError(i.error.body);case 401:throw new cr.UnauthorizedError(i.error.body);case 403:throw new cr.ForbiddenError(i.error.body);case 404:throw new cr.NotFoundError(i.error.body);case 422:throw new cr.UnprocessableEntityError(Mi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new cr.TooManyRequestsError(Mi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new cr.ClientClosedRequestError(Mi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new cr.InternalServerError(i.error.body);case 501:throw new cr.NotImplementedError(Mi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new cr.ServiceUnavailableError(i.error.body);case 504:throw new cr.GatewayTimeoutError(Mi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new du.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new du.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new du.CohereTimeoutError;case"unknown":throw new du.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return n2(this,void 0,void 0,function*(){let r=(e=yield qo.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new du.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Xm.Datasets=rFe});var B$t=x(Qm=>{"use strict";var Eln=Qm&&Qm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pln=Qm&&Qm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hK=Qm&&Qm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Eln(e,t,r);return Pln(e,t),e},AL=Qm&&Qm.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},Tln=Qm&&Qm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qm,"__esModule",{value:!0});Qm.Connectors=void 0;var o2=hK(AP()),Jn=hK(Y()),It=hK(QE()),i2=Tln(HM()),qn=hK(TP()),Ia=hK(au()),nFe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return AL(this,void 0,void 0,function*(){let{limit:i,offset:a}=e,s={};i!=null&&(s.limit=i.toString()),a!=null&&(s.offset=a.toString());let u=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Jn.fetcher)({url:(0,i2.default)((o=yield Jn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:o2.CohereEnvironment.Production,"v1/connectors"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Jn.Supplier.get(this._options.clientName))!=null?yield Jn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Jn.RUNTIME.type,"X-Fern-Runtime-Version":Jn.RUNTIME.version},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(u.ok)return qn.ListConnectorsResponse.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new It.BadRequestError(u.error.body);case 401:throw new It.UnauthorizedError(u.error.body);case 403:throw new It.ForbiddenError(u.error.body);case 404:throw new It.NotFoundError(u.error.body);case 422:throw new It.UnprocessableEntityError(qn.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new It.TooManyRequestsError(qn.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new It.ClientClosedRequestError(qn.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new It.InternalServerError(u.error.body);case 501:throw new It.NotImplementedError(qn.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new It.ServiceUnavailableError(u.error.body);case 504:throw new It.GatewayTimeoutError(qn.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ia.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new Ia.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new Ia.CohereTimeoutError;case"unknown":throw new Ia.CohereError({message:u.error.errorMessage})}})}create(e,r){var n,o;return AL(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Jn.fetcher)({url:(0,i2.default)((o=yield Jn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:o2.CohereEnvironment.Production,"v1/connectors"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Jn.Supplier.get(this._options.clientName))!=null?yield Jn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Jn.RUNTIME.type,"X-Fern-Runtime-Version":Jn.RUNTIME.version},contentType:"application/json",requestType:"json",body:qn.CreateConnectorRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return qn.CreateConnectorResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new It.BadRequestError(i.error.body);case 401:throw new It.UnauthorizedError(i.error.body);case 403:throw new It.ForbiddenError(i.error.body);case 404:throw new It.NotFoundError(i.error.body);case 422:throw new It.UnprocessableEntityError(qn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new It.TooManyRequestsError(qn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new It.ClientClosedRequestError(qn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new It.InternalServerError(i.error.body);case 501:throw new It.NotImplementedError(qn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new It.ServiceUnavailableError(i.error.body);case 504:throw new It.GatewayTimeoutError(qn.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ia.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ia.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ia.CohereTimeoutError;case"unknown":throw new Ia.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return AL(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Jn.fetcher)({url:(0,i2.default)((o=yield Jn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:o2.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Jn.Supplier.get(this._options.clientName))!=null?yield Jn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Jn.RUNTIME.type,"X-Fern-Runtime-Version":Jn.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return qn.GetConnectorResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new It.BadRequestError(i.error.body);case 401:throw new It.UnauthorizedError(i.error.body);case 403:throw new It.ForbiddenError(i.error.body);case 404:throw new It.NotFoundError(i.error.body);case 422:throw new It.UnprocessableEntityError(qn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new It.TooManyRequestsError(qn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new It.ClientClosedRequestError(qn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new It.InternalServerError(i.error.body);case 501:throw new It.NotImplementedError(qn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new It.ServiceUnavailableError(i.error.body);case 504:throw new It.GatewayTimeoutError(qn.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ia.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ia.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ia.CohereTimeoutError;case"unknown":throw new Ia.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return AL(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Jn.fetcher)({url:(0,i2.default)((o=yield Jn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:o2.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Jn.Supplier.get(this._options.clientName))!=null?yield Jn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Jn.RUNTIME.type,"X-Fern-Runtime-Version":Jn.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return qn.DeleteConnectorResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new It.BadRequestError(i.error.body);case 401:throw new It.UnauthorizedError(i.error.body);case 403:throw new It.ForbiddenError(i.error.body);case 404:throw new It.NotFoundError(i.error.body);case 422:throw new It.UnprocessableEntityError(qn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new It.TooManyRequestsError(qn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new It.ClientClosedRequestError(qn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new It.InternalServerError(i.error.body);case 501:throw new It.NotImplementedError(qn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new It.ServiceUnavailableError(i.error.body);case 504:throw new It.GatewayTimeoutError(qn.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ia.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ia.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ia.CohereTimeoutError;case"unknown":throw new Ia.CohereError({message:i.error.errorMessage})}})}update(e,r={},n){var o,i;return AL(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:Jn.fetcher)({url:(0,i2.default)((i=yield Jn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:o2.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Jn.Supplier.get(this._options.clientName))!=null?yield Jn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Jn.RUNTIME.type,"X-Fern-Runtime-Version":Jn.RUNTIME.version},contentType:"application/json",requestType:"json",body:qn.UpdateConnectorRequest.jsonOrThrow(r,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(a.ok)return qn.UpdateConnectorResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new It.BadRequestError(a.error.body);case 401:throw new It.UnauthorizedError(a.error.body);case 403:throw new It.ForbiddenError(a.error.body);case 404:throw new It.NotFoundError(a.error.body);case 422:throw new It.UnprocessableEntityError(qn.UnprocessableEntityErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new It.TooManyRequestsError(qn.TooManyRequestsErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new It.ClientClosedRequestError(qn.ClientClosedRequestErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new It.InternalServerError(a.error.body);case 501:throw new It.NotImplementedError(qn.NotImplementedErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new It.ServiceUnavailableError(a.error.body);case 504:throw new It.GatewayTimeoutError(qn.GatewayTimeoutErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ia.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new Ia.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new Ia.CohereTimeoutError;case"unknown":throw new Ia.CohereError({message:a.error.errorMessage})}})}oAuthAuthorize(e,r={},n){var o,i;return AL(this,void 0,void 0,function*(){let{afterTokenRedirect:a}=r,s={};a!=null&&(s.after_token_redirect=a);let u=yield((o=this._options.fetcher)!==null&&o!==void 0?o:Jn.fetcher)({url:(0,i2.default)((i=yield Jn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:o2.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}/oauth/authorize`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Jn.Supplier.get(this._options.clientName))!=null?yield Jn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Jn.RUNTIME.type,"X-Fern-Runtime-Version":Jn.RUNTIME.version},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(u.ok)return qn.OAuthAuthorizeResponse.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new It.BadRequestError(u.error.body);case 401:throw new It.UnauthorizedError(u.error.body);case 403:throw new It.ForbiddenError(u.error.body);case 404:throw new It.NotFoundError(u.error.body);case 422:throw new It.UnprocessableEntityError(qn.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new It.TooManyRequestsError(qn.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new It.ClientClosedRequestError(qn.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new It.InternalServerError(u.error.body);case 501:throw new It.NotImplementedError(qn.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new It.ServiceUnavailableError(u.error.body);case 504:throw new It.GatewayTimeoutError(qn.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ia.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new Ia.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new Ia.CohereTimeoutError;case"unknown":throw new Ia.CohereError({message:u.error.errorMessage})}})}_getAuthorizationHeader(){var e;return AL(this,void 0,void 0,function*(){let r=(e=yield Jn.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Ia.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Qm.Connectors=nFe});var q$t=x(eh=>{"use strict";var Aln=eh&&eh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Iln=eh&&eh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gK=eh&&eh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Aln(e,t,r);return Iln(e,t),e},oFe=eh&&eh.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},Mln=eh&&eh.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(eh,"__esModule",{value:!0});eh.Models=void 0;var z$t=gK(AP()),ig=gK(Y()),$s=gK(QE()),U$t=Mln(HM()),My=gK(TP()),MP=gK(au()),iFe=class{constructor(e={}){this._options=e}get(e,r){var n,o;return oFe(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ig.fetcher)({url:(0,U$t.default)((o=yield ig.Supplier.get(this._options.environment))!==null&&o!==void 0?o:z$t.CohereEnvironment.Production,`v1/models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ig.Supplier.get(this._options.clientName))!=null?yield ig.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":ig.RUNTIME.type,"X-Fern-Runtime-Version":ig.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return My.GetModelResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new $s.BadRequestError(i.error.body);case 401:throw new $s.UnauthorizedError(i.error.body);case 403:throw new $s.ForbiddenError(i.error.body);case 404:throw new $s.NotFoundError(i.error.body);case 422:throw new $s.UnprocessableEntityError(My.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new $s.TooManyRequestsError(My.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new $s.ClientClosedRequestError(My.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new $s.InternalServerError(i.error.body);case 501:throw new $s.NotImplementedError(My.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new $s.ServiceUnavailableError(i.error.body);case 504:throw new $s.GatewayTimeoutError(My.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new MP.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new MP.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new MP.CohereTimeoutError;case"unknown":throw new MP.CohereError({message:i.error.errorMessage})}})}list(e={},r){var n,o;return oFe(this,void 0,void 0,function*(){let{pageSize:i,pageToken:a,endpoint:s,defaultOnly:u}=e,l={};i!=null&&(l.page_size=i.toString()),a!=null&&(l.page_token=a),s!=null&&(l.endpoint=s),u!=null&&(l.default_only=u.toString());let c=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ig.fetcher)({url:(0,U$t.default)((o=yield ig.Supplier.get(this._options.environment))!==null&&o!==void 0?o:z$t.CohereEnvironment.Production,"v1/models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ig.Supplier.get(this._options.clientName))!=null?yield ig.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":ig.RUNTIME.type,"X-Fern-Runtime-Version":ig.RUNTIME.version},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(c.ok)return My.ListModelsResponse.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new $s.BadRequestError(c.error.body);case 401:throw new $s.UnauthorizedError(c.error.body);case 403:throw new $s.ForbiddenError(c.error.body);case 404:throw new $s.NotFoundError(c.error.body);case 422:throw new $s.UnprocessableEntityError(My.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new $s.TooManyRequestsError(My.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new $s.ClientClosedRequestError(My.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new $s.InternalServerError(c.error.body);case 501:throw new $s.NotImplementedError(My.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new $s.ServiceUnavailableError(c.error.body);case 504:throw new $s.GatewayTimeoutError(My.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new MP.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new MP.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new MP.CohereTimeoutError;case"unknown":throw new MP.CohereError({message:c.error.errorMessage})}})}_getAuthorizationHeader(){var e;return oFe(this,void 0,void 0,function*(){let r=(e=yield ig.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new MP.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};eh.Models=iFe});var H$t=x(th=>{"use strict";var Rln=th&&th.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Nln=th&&th.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yK=th&&th.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rln(e,t,r);return Nln(e,t),e},VM=th&&th.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},jln=th&&th.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(th,"__esModule",{value:!0});th.Finetuning=void 0;var IL=yK(AP()),sn=yK(Y()),fn=yK(QE()),ML=jln(HM()),RP=yK(TP()),Bi=yK(au()),aFe=class{constructor(e={}){this._options=e}listFinetunedModels(e={},r){var n,o;return VM(this,void 0,void 0,function*(){let{pageSize:i,pageToken:a,orderBy:s}=e,u={};i!=null&&(u.page_size=i.toString()),a!=null&&(u.page_token=a),s!=null&&(u.order_by=s);let l=yield((n=this._options.fetcher)!==null&&n!==void 0?n:sn.fetcher)({url:(0,ML.default)((o=yield sn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:IL.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield sn.Supplier.get(this._options.clientName))!=null?yield sn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":sn.RUNTIME.type,"X-Fern-Runtime-Version":sn.RUNTIME.version},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(l.ok)return RP.finetuning.ListFinetunedModelsResponse.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new fn.BadRequestError(l.error.body);case 401:throw new fn.UnauthorizedError(l.error.body);case 403:throw new fn.ForbiddenError(l.error.body);case 404:throw new fn.NotFoundError(l.error.body);case 500:throw new fn.InternalServerError(l.error.body);case 503:throw new fn.ServiceUnavailableError(l.error.body);default:throw new Bi.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new Bi.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new Bi.CohereTimeoutError;case"unknown":throw new Bi.CohereError({message:l.error.errorMessage})}})}createFinetunedModel(e,r){var n,o;return VM(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:sn.fetcher)({url:(0,ML.default)((o=yield sn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:IL.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield sn.Supplier.get(this._options.clientName))!=null?yield sn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":sn.RUNTIME.type,"X-Fern-Runtime-Version":sn.RUNTIME.version},contentType:"application/json",requestType:"json",body:RP.finetuning.FinetunedModel.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return RP.finetuning.CreateFinetunedModelResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new fn.BadRequestError(i.error.body);case 401:throw new fn.UnauthorizedError(i.error.body);case 403:throw new fn.ForbiddenError(i.error.body);case 404:throw new fn.NotFoundError(i.error.body);case 500:throw new fn.InternalServerError(i.error.body);case 503:throw new fn.ServiceUnavailableError(i.error.body);default:throw new Bi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Bi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Bi.CohereTimeoutError;case"unknown":throw new Bi.CohereError({message:i.error.errorMessage})}})}getFinetunedModel(e,r){var n,o;return VM(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:sn.fetcher)({url:(0,ML.default)((o=yield sn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:IL.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield sn.Supplier.get(this._options.clientName))!=null?yield sn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":sn.RUNTIME.type,"X-Fern-Runtime-Version":sn.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return RP.finetuning.GetFinetunedModelResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new fn.BadRequestError(i.error.body);case 401:throw new fn.UnauthorizedError(i.error.body);case 403:throw new fn.ForbiddenError(i.error.body);case 404:throw new fn.NotFoundError(i.error.body);case 500:throw new fn.InternalServerError(i.error.body);case 503:throw new fn.ServiceUnavailableError(i.error.body);default:throw new Bi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Bi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Bi.CohereTimeoutError;case"unknown":throw new Bi.CohereError({message:i.error.errorMessage})}})}deleteFinetunedModel(e,r){var n,o;return VM(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:sn.fetcher)({url:(0,ML.default)((o=yield sn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:IL.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield sn.Supplier.get(this._options.clientName))!=null?yield sn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":sn.RUNTIME.type,"X-Fern-Runtime-Version":sn.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return RP.finetuning.DeleteFinetunedModelResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new fn.BadRequestError(i.error.body);case 401:throw new fn.UnauthorizedError(i.error.body);case 403:throw new fn.ForbiddenError(i.error.body);case 404:throw new fn.NotFoundError(i.error.body);case 500:throw new fn.InternalServerError(i.error.body);case 503:throw new fn.ServiceUnavailableError(i.error.body);default:throw new Bi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Bi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Bi.CohereTimeoutError;case"unknown":throw new Bi.CohereError({message:i.error.errorMessage})}})}updateFinetunedModel(e,r,n){var o,i;return VM(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:sn.fetcher)({url:(0,ML.default)((i=yield sn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:IL.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield sn.Supplier.get(this._options.clientName))!=null?yield sn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":sn.RUNTIME.type,"X-Fern-Runtime-Version":sn.RUNTIME.version},contentType:"application/json",requestType:"json",body:RP.FinetuningUpdateFinetunedModelRequest.jsonOrThrow(r,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(a.ok)return RP.finetuning.UpdateFinetunedModelResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new fn.BadRequestError(a.error.body);case 401:throw new fn.UnauthorizedError(a.error.body);case 403:throw new fn.ForbiddenError(a.error.body);case 404:throw new fn.NotFoundError(a.error.body);case 500:throw new fn.InternalServerError(a.error.body);case 503:throw new fn.ServiceUnavailableError(a.error.body);default:throw new Bi.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new Bi.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new Bi.CohereTimeoutError;case"unknown":throw new Bi.CohereError({message:a.error.errorMessage})}})}listEvents(e,r={},n){var o,i;return VM(this,void 0,void 0,function*(){let{pageSize:a,pageToken:s,orderBy:u}=r,l={};a!=null&&(l.page_size=a.toString()),s!=null&&(l.page_token=s),u!=null&&(l.order_by=u);let c=yield((o=this._options.fetcher)!==null&&o!==void 0?o:sn.fetcher)({url:(0,ML.default)((i=yield sn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:IL.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/events`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield sn.Supplier.get(this._options.clientName))!=null?yield sn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":sn.RUNTIME.type,"X-Fern-Runtime-Version":sn.RUNTIME.version},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(c.ok)return RP.finetuning.ListEventsResponse.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new fn.BadRequestError(c.error.body);case 401:throw new fn.UnauthorizedError(c.error.body);case 403:throw new fn.ForbiddenError(c.error.body);case 404:throw new fn.NotFoundError(c.error.body);case 500:throw new fn.InternalServerError(c.error.body);case 503:throw new fn.ServiceUnavailableError(c.error.body);default:throw new Bi.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new Bi.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new Bi.CohereTimeoutError;case"unknown":throw new Bi.CohereError({message:c.error.errorMessage})}})}listTrainingStepMetrics(e,r={},n){var o,i;return VM(this,void 0,void 0,function*(){let{pageSize:a,pageToken:s}=r,u={};a!=null&&(u.page_size=a.toString()),s!=null&&(u.page_token=s);let l=yield((o=this._options.fetcher)!==null&&o!==void 0?o:sn.fetcher)({url:(0,ML.default)((i=yield sn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:IL.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/training-step-metrics`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield sn.Supplier.get(this._options.clientName))!=null?yield sn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":sn.RUNTIME.type,"X-Fern-Runtime-Version":sn.RUNTIME.version},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(l.ok)return RP.finetuning.ListTrainingStepMetricsResponse.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new fn.BadRequestError(l.error.body);case 401:throw new fn.UnauthorizedError(l.error.body);case 403:throw new fn.ForbiddenError(l.error.body);case 404:throw new fn.NotFoundError(l.error.body);case 500:throw new fn.InternalServerError(l.error.body);case 503:throw new fn.ServiceUnavailableError(l.error.body);default:throw new Bi.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new Bi.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new Bi.CohereTimeoutError;case"unknown":throw new Bi.CohereError({message:l.error.errorMessage})}})}_getAuthorizationHeader(){var e;return VM(this,void 0,void 0,function*(){let r=(e=yield sn.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Bi.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};th.Finetuning=aFe});var nle=x(nh=>{"use strict";var Dln=nh&&nh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lln=nh&&nh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bK=nh&&nh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Dln(e,t,r);return Lln(e,t),e},rh=nh&&nh.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},Fln=nh&&nh.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(nh,"__esModule",{value:!0});nh.CohereClient=void 0;var c_=bK(AP()),xt=bK(Y()),Te=bK(QE()),ct=bK(TP()),d_=Fln(HM()),Yr=bK(au()),kln=eFe(),$ln=k$t(),Bln=$$t(),zln=B$t(),Uln=q$t(),qln=H$t(),sFe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return rh(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,d_.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:c_.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},ct.ChatStreamRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!0}),responseType:"sse",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return new xt.Stream({stream:i.body,parse:a=>rh(this,void 0,void 0,function*(){return ct.StreamedChatResponse.parseOrThrow(a,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]})}),signal:r?.abortSignal,eventShape:{type:"json",messageTerminator:`
`}});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Te.BadRequestError(i.error.body);case 401:throw new Te.UnauthorizedError(i.error.body);case 403:throw new Te.ForbiddenError(i.error.body);case 404:throw new Te.NotFoundError(i.error.body);case 422:throw new Te.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Te.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Te.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Te.InternalServerError(i.error.body);case 501:throw new Te.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Te.ServiceUnavailableError(i.error.body);case 504:throw new Te.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Yr.CohereTimeoutError;case"unknown":throw new Yr.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return rh(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,d_.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:c_.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},ct.ChatRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!1}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return ct.NonStreamedChatResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Te.BadRequestError(i.error.body);case 401:throw new Te.UnauthorizedError(i.error.body);case 403:throw new Te.ForbiddenError(i.error.body);case 404:throw new Te.NotFoundError(i.error.body);case 422:throw new Te.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Te.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Te.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Te.InternalServerError(i.error.body);case 501:throw new Te.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Te.ServiceUnavailableError(i.error.body);case 504:throw new Te.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Yr.CohereTimeoutError;case"unknown":throw new Yr.CohereError({message:i.error.errorMessage})}})}generateStream(e,r){var n,o;return rh(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,d_.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:c_.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},ct.GenerateStreamRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!0}),responseType:"sse",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return new xt.Stream({stream:i.body,parse:a=>rh(this,void 0,void 0,function*(){return ct.GenerateStreamedResponse.parseOrThrow(a,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]})}),signal:r?.abortSignal,eventShape:{type:"json",messageTerminator:`
`}});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Te.BadRequestError(i.error.body);case 401:throw new Te.UnauthorizedError(i.error.body);case 403:throw new Te.ForbiddenError(i.error.body);case 404:throw new Te.NotFoundError(i.error.body);case 422:throw new Te.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Te.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Te.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Te.InternalServerError(i.error.body);case 501:throw new Te.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Te.ServiceUnavailableError(i.error.body);case 504:throw new Te.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Yr.CohereTimeoutError;case"unknown":throw new Yr.CohereError({message:i.error.errorMessage})}})}generate(e,r){var n,o;return rh(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,d_.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:c_.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},ct.GenerateRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!1}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return ct.Generation.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Te.BadRequestError(i.error.body);case 401:throw new Te.UnauthorizedError(i.error.body);case 403:throw new Te.ForbiddenError(i.error.body);case 404:throw new Te.NotFoundError(i.error.body);case 422:throw new Te.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Te.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Te.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Te.InternalServerError(i.error.body);case 501:throw new Te.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Te.ServiceUnavailableError(i.error.body);case 504:throw new Te.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Yr.CohereTimeoutError;case"unknown":throw new Yr.CohereError({message:i.error.errorMessage})}})}embed(e,r){var n,o;return rh(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,d_.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:c_.CohereEnvironment.Production,"v1/embed"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:ct.EmbedRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return ct.EmbedResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Te.BadRequestError(i.error.body);case 401:throw new Te.UnauthorizedError(i.error.body);case 403:throw new Te.ForbiddenError(i.error.body);case 404:throw new Te.NotFoundError(i.error.body);case 422:throw new Te.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Te.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Te.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Te.InternalServerError(i.error.body);case 501:throw new Te.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Te.ServiceUnavailableError(i.error.body);case 504:throw new Te.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Yr.CohereTimeoutError;case"unknown":throw new Yr.CohereError({message:i.error.errorMessage})}})}rerank(e,r){var n,o;return rh(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,d_.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:c_.CohereEnvironment.Production,"v1/rerank"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:ct.RerankRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return ct.RerankResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Te.BadRequestError(i.error.body);case 401:throw new Te.UnauthorizedError(i.error.body);case 403:throw new Te.ForbiddenError(i.error.body);case 404:throw new Te.NotFoundError(i.error.body);case 422:throw new Te.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Te.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Te.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Te.InternalServerError(i.error.body);case 501:throw new Te.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Te.ServiceUnavailableError(i.error.body);case 504:throw new Te.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Yr.CohereTimeoutError;case"unknown":throw new Yr.CohereError({message:i.error.errorMessage})}})}classify(e,r){var n,o;return rh(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,d_.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:c_.CohereEnvironment.Production,"v1/classify"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:ct.ClassifyRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return ct.ClassifyResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Te.BadRequestError(i.error.body);case 401:throw new Te.UnauthorizedError(i.error.body);case 403:throw new Te.ForbiddenError(i.error.body);case 404:throw new Te.NotFoundError(i.error.body);case 422:throw new Te.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Te.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Te.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Te.InternalServerError(i.error.body);case 501:throw new Te.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Te.ServiceUnavailableError(i.error.body);case 504:throw new Te.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Yr.CohereTimeoutError;case"unknown":throw new Yr.CohereError({message:i.error.errorMessage})}})}summarize(e,r){var n,o;return rh(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,d_.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:c_.CohereEnvironment.Production,"v1/summarize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:ct.SummarizeRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return ct.SummarizeResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Te.BadRequestError(i.error.body);case 401:throw new Te.UnauthorizedError(i.error.body);case 403:throw new Te.ForbiddenError(i.error.body);case 404:throw new Te.NotFoundError(i.error.body);case 422:throw new Te.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Te.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Te.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Te.InternalServerError(i.error.body);case 501:throw new Te.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Te.ServiceUnavailableError(i.error.body);case 504:throw new Te.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Yr.CohereTimeoutError;case"unknown":throw new Yr.CohereError({message:i.error.errorMessage})}})}tokenize(e,r){var n,o;return rh(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,d_.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:c_.CohereEnvironment.Production,"v1/tokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:ct.TokenizeRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return ct.TokenizeResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Te.BadRequestError(i.error.body);case 401:throw new Te.UnauthorizedError(i.error.body);case 403:throw new Te.ForbiddenError(i.error.body);case 404:throw new Te.NotFoundError(i.error.body);case 422:throw new Te.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Te.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Te.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Te.InternalServerError(i.error.body);case 501:throw new Te.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Te.ServiceUnavailableError(i.error.body);case 504:throw new Te.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Yr.CohereTimeoutError;case"unknown":throw new Yr.CohereError({message:i.error.errorMessage})}})}detokenize(e,r){var n,o;return rh(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,d_.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:c_.CohereEnvironment.Production,"v1/detokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:ct.DetokenizeRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return ct.DetokenizeResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Te.BadRequestError(i.error.body);case 401:throw new Te.UnauthorizedError(i.error.body);case 403:throw new Te.ForbiddenError(i.error.body);case 404:throw new Te.NotFoundError(i.error.body);case 422:throw new Te.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Te.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Te.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Te.InternalServerError(i.error.body);case 501:throw new Te.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Te.ServiceUnavailableError(i.error.body);case 504:throw new Te.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Yr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Yr.CohereTimeoutError;case"unknown":throw new Yr.CohereError({message:i.error.errorMessage})}})}checkApiKey(e){var r,n;return rh(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:xt.fetcher)({url:(0,d_.default)((n=yield xt.Supplier.get(this._options.environment))!==null&&n!==void 0?n:c_.CohereEnvironment.Production,"v1/check-api-key"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return ct.CheckApiKeyResponse.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new Te.BadRequestError(o.error.body);case 401:throw new Te.UnauthorizedError(o.error.body);case 403:throw new Te.ForbiddenError(o.error.body);case 404:throw new Te.NotFoundError(o.error.body);case 422:throw new Te.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Te.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Te.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Te.InternalServerError(o.error.body);case 501:throw new Te.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Te.ServiceUnavailableError(o.error.body);case 504:throw new Te.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Yr.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Yr.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Yr.CohereTimeoutError;case"unknown":throw new Yr.CohereError({message:o.error.errorMessage})}})}get v2(){var e;return(e=this._v2)!==null&&e!==void 0?e:this._v2=new kln.V2(this._options)}get embedJobs(){var e;return(e=this._embedJobs)!==null&&e!==void 0?e:this._embedJobs=new $ln.EmbedJobs(this._options)}get datasets(){var e;return(e=this._datasets)!==null&&e!==void 0?e:this._datasets=new Bln.Datasets(this._options)}get connectors(){var e;return(e=this._connectors)!==null&&e!==void 0?e:this._connectors=new zln.Connectors(this._options)}get models(){var e;return(e=this._models)!==null&&e!==void 0?e:this._models=new Uln.Models(this._options)}get finetuning(){var e;return(e=this._finetuning)!==null&&e!==void 0?e:this._finetuning=new qln.Finetuning(this._options)}_getAuthorizationHeader(){var e;return rh(this,void 0,void 0,function*(){let r=(e=yield xt.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Yr.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};nh.CohereClient=sFe});var lFe=x(ole=>{"use strict";Object.defineProperty(ole,"__esModule",{value:!0});ole.AwsClient=void 0;var Hln=nle(),uFe=class extends Hln.CohereClient{constructor(e){e.token="n/a",super(e)}};ole.AwsClient=uFe});var V$t=x(ile=>{"use strict";Object.defineProperty(ile,"__esModule",{value:!0});ile.BedrockClient=void 0;var Vln=XLe(),Wln=lFe(),cFe=class extends Wln.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,Vln.fetchOverride)("bedrock",e)}))}};ile.BedrockClient=cFe});var W$t=x(ale=>{"use strict";Object.defineProperty(ale,"__esModule",{value:!0});ale.CohereClientV2=void 0;var Kln=eFe(),Gln=nle(),dFe=class{constructor(e){this._options=e,this.client=new Gln.CohereClient(this._options),this.clientV2=new Kln.V2(this._options),this.chat=this.clientV2.chat.bind(this.clientV2),this.chatStream=this.clientV2.chatStream.bind(this.clientV2),this.generateStream=this.client.generateStream.bind(this.clientV2),this.generate=this.client.generate.bind(this.clientV2),this.embed=this.client.embed.bind(this.clientV2),this.rerank=this.client.rerank.bind(this.clientV2),this.classify=this.client.classify.bind(this.clientV2),this.summarize=this.client.summarize.bind(this.clientV2),this.tokenize=this.client.tokenize.bind(this.clientV2),this.detokenize=this.client.detokenize.bind(this.clientV2),this.checkApiKey=this.client.checkApiKey.bind(this.clientV2),this.embedJobs=this.client.embedJobs,this.datasets=this.client.datasets,this.connectors=this.client.connectors,this.models=this.client.models,this.finetuning=this.client.finetuning}};ale.CohereClientV2=dFe});var K$t=x(sle=>{"use strict";Object.defineProperty(sle,"__esModule",{value:!0});sle.CustomClient=void 0;var Jln=nle(),fFe=class extends Jln.CohereClient{constructor(e={}){var r,n;try{let o=/\/v1\/?$/,i=(r=e.environment)===null||r===void 0?void 0:r.toString().replace(o,"");i!==((n=e.environment)===null||n===void 0?void 0:n.toString())&&(e.environment=i)}catch{}super(e),this._options=e}};sle.CustomClient=fFe});var G$t=x(ule=>{"use strict";Object.defineProperty(ule,"__esModule",{value:!0});ule.SagemakerClient=void 0;var Zln=lFe(),Yln=XLe(),pFe=class extends Zln.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,Yln.fetchOverride)("sagemaker",e)}))}};ule.SagemakerClient=pFe});var _K=x(Ja=>{"use strict";var Xln=Ja&&Ja.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qln=Ja&&Ja.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ecn=Ja&&Ja.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xln(e,t,r);return Qln(e,t),e};Object.defineProperty(Ja,"__esModule",{value:!0});Ja.SagemakerClient=Ja.CohereTimeoutError=Ja.CohereError=Ja.CohereEnvironment=Ja.CohereClient=Ja.CohereClientV2=Ja.BedrockClient=Ja.Cohere=void 0;Ja.Cohere=ecn(QE());var tcn=V$t();Object.defineProperty(Ja,"BedrockClient",{enumerable:!0,get:function(){return tcn.BedrockClient}});var rcn=W$t();Object.defineProperty(Ja,"CohereClientV2",{enumerable:!0,get:function(){return rcn.CohereClientV2}});var ncn=K$t();Object.defineProperty(Ja,"CohereClient",{enumerable:!0,get:function(){return ncn.CustomClient}});var ocn=AP();Object.defineProperty(Ja,"CohereEnvironment",{enumerable:!0,get:function(){return ocn.CohereEnvironment}});var J$t=au();Object.defineProperty(Ja,"CohereError",{enumerable:!0,get:function(){return J$t.CohereError}});Object.defineProperty(Ja,"CohereTimeoutError",{enumerable:!0,get:function(){return J$t.CohereTimeoutError}});var icn=G$t();Object.defineProperty(Ja,"SagemakerClient",{enumerable:!0,get:function(){return icn.SagemakerClient}})});var Bs=b(()=>{Aj()});function p_(t){t?(Vc[0]=Vc[16]=Vc[1]=Vc[2]=Vc[3]=Vc[4]=Vc[5]=Vc[6]=Vc[7]=Vc[8]=Vc[9]=Vc[10]=Vc[11]=Vc[12]=Vc[13]=Vc[14]=Vc[15]=0,this.blocks=Vc):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}var acn,Nn,scn,f_,Vc,Z$t,mFe,Y$t=b(()=>{"use strict";acn=typeof window=="object"?window:{},Nn="0123456789abcdef".split(""),scn=[-2147483648,8388608,32768,128],f_=[24,16,8,0],Vc=[];p_.prototype.update=function(t){if(!this.finalized){var e=typeof t!="string";e&&t.constructor===acn.ArrayBuffer&&(t=new Uint8Array(t));for(var r,n=0,o,i=t.length||0,a=this.blocks;n<i;){if(this.hashed&&(this.hashed=!1,a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),e)for(o=this.start;n<i&&o<64;++n)a[o>>2]|=t[n]<<f_[o++&3];else for(o=this.start;n<i&&o<64;++n)r=t.charCodeAt(n),r<128?a[o>>2]|=r<<f_[o++&3]:r<2048?(a[o>>2]|=(192|r>>6)<<f_[o++&3],a[o>>2]|=(128|r&63)<<f_[o++&3]):r<55296||r>=57344?(a[o>>2]|=(224|r>>12)<<f_[o++&3],a[o>>2]|=(128|r>>6&63)<<f_[o++&3],a[o>>2]|=(128|r&63)<<f_[o++&3]):(r=65536+((r&1023)<<10|t.charCodeAt(++n)&1023),a[o>>2]|=(240|r>>18)<<f_[o++&3],a[o>>2]|=(128|r>>12&63)<<f_[o++&3],a[o>>2]|=(128|r>>6&63)<<f_[o++&3],a[o>>2]|=(128|r&63)<<f_[o++&3]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=a[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};p_.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=scn[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}};p_.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i,a,s,u=this.blocks;for(a=16;a<80;++a)s=u[a-3]^u[a-8]^u[a-14]^u[a-16],u[a]=s<<1|s>>>31;for(a=0;a<20;a+=5)i=e&r|~e&n,s=t<<5|t>>>27,o=s+i+o+1518500249+u[a]<<0,e=e<<30|e>>>2,i=t&e|~t&r,s=o<<5|o>>>27,n=s+i+n+1518500249+u[a+1]<<0,t=t<<30|t>>>2,i=o&t|~o&e,s=n<<5|n>>>27,r=s+i+r+1518500249+u[a+2]<<0,o=o<<30|o>>>2,i=n&o|~n&t,s=r<<5|r>>>27,e=s+i+e+1518500249+u[a+3]<<0,n=n<<30|n>>>2,i=r&n|~r&o,s=e<<5|e>>>27,t=s+i+t+1518500249+u[a+4]<<0,r=r<<30|r>>>2;for(;a<40;a+=5)i=e^r^n,s=t<<5|t>>>27,o=s+i+o+1859775393+u[a]<<0,e=e<<30|e>>>2,i=t^e^r,s=o<<5|o>>>27,n=s+i+n+1859775393+u[a+1]<<0,t=t<<30|t>>>2,i=o^t^e,s=n<<5|n>>>27,r=s+i+r+1859775393+u[a+2]<<0,o=o<<30|o>>>2,i=n^o^t,s=r<<5|r>>>27,e=s+i+e+1859775393+u[a+3]<<0,n=n<<30|n>>>2,i=r^n^o,s=e<<5|e>>>27,t=s+i+t+1859775393+u[a+4]<<0,r=r<<30|r>>>2;for(;a<60;a+=5)i=e&r|e&n|r&n,s=t<<5|t>>>27,o=s+i+o-1894007588+u[a]<<0,e=e<<30|e>>>2,i=t&e|t&r|e&r,s=o<<5|o>>>27,n=s+i+n-1894007588+u[a+1]<<0,t=t<<30|t>>>2,i=o&t|o&e|t&e,s=n<<5|n>>>27,r=s+i+r-1894007588+u[a+2]<<0,o=o<<30|o>>>2,i=n&o|n&t|o&t,s=r<<5|r>>>27,e=s+i+e-1894007588+u[a+3]<<0,n=n<<30|n>>>2,i=r&n|r&o|n&o,s=e<<5|e>>>27,t=s+i+t-1894007588+u[a+4]<<0,r=r<<30|r>>>2;for(;a<80;a+=5)i=e^r^n,s=t<<5|t>>>27,o=s+i+o-899497514+u[a]<<0,e=e<<30|e>>>2,i=t^e^r,s=o<<5|o>>>27,n=s+i+n-899497514+u[a+1]<<0,t=t<<30|t>>>2,i=o^t^e,s=n<<5|n>>>27,r=s+i+r-899497514+u[a+2]<<0,o=o<<30|o>>>2,i=n^o^t,s=r<<5|r>>>27,e=s+i+e-899497514+u[a+3]<<0,n=n<<30|n>>>2,i=r^n^o,s=e<<5|e>>>27,t=s+i+t-899497514+u[a+4]<<0,r=r<<30|r>>>2;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+o<<0};p_.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4;return Nn[t>>28&15]+Nn[t>>24&15]+Nn[t>>20&15]+Nn[t>>16&15]+Nn[t>>12&15]+Nn[t>>8&15]+Nn[t>>4&15]+Nn[t&15]+Nn[e>>28&15]+Nn[e>>24&15]+Nn[e>>20&15]+Nn[e>>16&15]+Nn[e>>12&15]+Nn[e>>8&15]+Nn[e>>4&15]+Nn[e&15]+Nn[r>>28&15]+Nn[r>>24&15]+Nn[r>>20&15]+Nn[r>>16&15]+Nn[r>>12&15]+Nn[r>>8&15]+Nn[r>>4&15]+Nn[r&15]+Nn[n>>28&15]+Nn[n>>24&15]+Nn[n>>20&15]+Nn[n>>16&15]+Nn[n>>12&15]+Nn[n>>8&15]+Nn[n>>4&15]+Nn[n&15]+Nn[o>>28&15]+Nn[o>>24&15]+Nn[o>>20&15]+Nn[o>>16&15]+Nn[o>>12&15]+Nn[o>>8&15]+Nn[o>>4&15]+Nn[o&15]};p_.prototype.toString=p_.prototype.hex;p_.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4;return[t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,r>>24&255,r>>16&255,r>>8&255,r&255,n>>24&255,n>>16&255,n>>8&255,n&255,o>>24&255,o>>16&255,o>>8&255,o&255]};p_.prototype.array=p_.prototype.digest;p_.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(20),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),t};Z$t=!1,mFe=t=>(Z$t||(console.warn(["The default method for hashing keys is insecure and will be replaced in a future version,","but hasn't been replaced yet as to not break existing caches. It's recommended that you use","a more secure hashing algorithm to avoid cache poisoning.","","See this page for more information:","|","\u2514> https://js.langchain.com/docs/troubleshooting/warnings/insecure-cache-algorithm"].join(`
`)),Z$t=!0),new p_(!0).update(t).hex())});function WC(t,e){e?(Wc[0]=Wc[16]=Wc[1]=Wc[2]=Wc[3]=Wc[4]=Wc[5]=Wc[6]=Wc[7]=Wc[8]=Wc[9]=Wc[10]=Wc[11]=Wc[12]=Wc[13]=Wc[14]=Wc[15]=0,this.blocks=Wc):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}var Dt,ucn,m_,lle,Wc,X$t=b(()=>{"use strict";Dt="0123456789abcdef".split(""),ucn=[-2147483648,8388608,32768,128],m_=[24,16,8,0],lle=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Wc=[];WC.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if(r!=="string"){if(r==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);e=!0}for(var n,o=0,i,a=t.length,s=this.blocks;o<a;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,this.block=s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),e)for(i=this.start;o<a&&i<64;++o)s[i>>>2]|=t[o]<<m_[i++&3];else for(i=this.start;o<a&&i<64;++o)n=t.charCodeAt(o),n<128?s[i>>>2]|=n<<m_[i++&3]:n<2048?(s[i>>>2]|=(192|n>>>6)<<m_[i++&3],s[i>>>2]|=(128|n&63)<<m_[i++&3]):n<55296||n>=57344?(s[i>>>2]|=(224|n>>>12)<<m_[i++&3],s[i>>>2]|=(128|n>>>6&63)<<m_[i++&3],s[i>>>2]|=(128|n&63)<<m_[i++&3]):(n=65536+((n&1023)<<10|t.charCodeAt(++o)&1023),s[i>>>2]|=(240|n>>>18)<<m_[i++&3],s[i>>>2]|=(128|n>>>12&63)<<m_[i++&3],s[i>>>2]|=(128|n>>>6&63)<<m_[i++&3],s[i>>>2]|=(128|n&63)<<m_[i++&3]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=s[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};WC.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=ucn[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}};WC.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,u=this.blocks,l,c,d,f,p,m,h,y,g,_,w;for(l=16;l<64;++l)p=u[l-15],c=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,p=u[l-2],d=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,u[l]=u[l-16]+c+u[l-7]+d<<0;for(w=e&r,l=0;l<64;l+=4)this.first?(this.is224?(y=300032,p=u[0]-1413257819,s=p-150054599<<0,n=p+24177077<<0):(y=704751109,p=u[0]-210244248,s=p-1521486534<<0,n=p+143694565<<0),this.first=!1):(c=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),y=t&e,f=y^t&r^w,h=o&i^~o&a,p=s+d+h+lle[l]+u[l],m=c+f,s=n+p<<0,n=p+m<<0),c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),g=n&t,f=g^n&e^y,h=a&s^~a&o,p=i+d+h+lle[l+1]+u[l+1],m=c+f,a=r+p<<0,r=p+m<<0,c=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),_=r&n,f=_^r&t^g,h=i&a^~i&s,p=o+d+h+lle[l+2]+u[l+2],m=c+f,i=e+p<<0,e=p+m<<0,c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),w=e&r,f=w^e&n^_,h=i&a^~i&s,p=o+d+h+lle[l+3]+u[l+3],m=c+f,o=t+p<<0,t=p+m<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+o<<0,this.h5=this.h5+i<<0,this.h6=this.h6+a<<0,this.h7=this.h7+s<<0};WC.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,u=Dt[t>>>28&15]+Dt[t>>>24&15]+Dt[t>>>20&15]+Dt[t>>>16&15]+Dt[t>>>12&15]+Dt[t>>>8&15]+Dt[t>>>4&15]+Dt[t&15]+Dt[e>>>28&15]+Dt[e>>>24&15]+Dt[e>>>20&15]+Dt[e>>>16&15]+Dt[e>>>12&15]+Dt[e>>>8&15]+Dt[e>>>4&15]+Dt[e&15]+Dt[r>>>28&15]+Dt[r>>>24&15]+Dt[r>>>20&15]+Dt[r>>>16&15]+Dt[r>>>12&15]+Dt[r>>>8&15]+Dt[r>>>4&15]+Dt[r&15]+Dt[n>>>28&15]+Dt[n>>>24&15]+Dt[n>>>20&15]+Dt[n>>>16&15]+Dt[n>>>12&15]+Dt[n>>>8&15]+Dt[n>>>4&15]+Dt[n&15]+Dt[o>>>28&15]+Dt[o>>>24&15]+Dt[o>>>20&15]+Dt[o>>>16&15]+Dt[o>>>12&15]+Dt[o>>>8&15]+Dt[o>>>4&15]+Dt[o&15]+Dt[i>>>28&15]+Dt[i>>>24&15]+Dt[i>>>20&15]+Dt[i>>>16&15]+Dt[i>>>12&15]+Dt[i>>>8&15]+Dt[i>>>4&15]+Dt[i&15]+Dt[a>>>28&15]+Dt[a>>>24&15]+Dt[a>>>20&15]+Dt[a>>>16&15]+Dt[a>>>12&15]+Dt[a>>>8&15]+Dt[a>>>4&15]+Dt[a&15];return this.is224||(u+=Dt[s>>>28&15]+Dt[s>>>24&15]+Dt[s>>>20&15]+Dt[s>>>16&15]+Dt[s>>>12&15]+Dt[s>>>8&15]+Dt[s>>>4&15]+Dt[s&15]),u};WC.prototype.toString=WC.prototype.hex;WC.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,u=[t>>>24&255,t>>>16&255,t>>>8&255,t&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255];return this.is224||u.push(s>>>24&255,s>>>16&255,s>>>8&255,s&255),u};WC.prototype.array=WC.prototype.digest;WC.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t}});var Q$t=b(()=>{Y$t();X$t()});var lcn,hFe,ccn,cle,eBt=b(()=>{Q$t();VA();lcn=(...t)=>mFe(t.join("_")),hFe=class{constructor(){Object.defineProperty(this,"keyEncoder",{enumerable:!0,configurable:!0,writable:!0,value:lcn})}makeDefaultKeyEncoder(e){this.keyEncoder=e}},ccn=new Map,cle=class t extends hFe{constructor(e){super(),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cache=e??new Map}lookup(e,r){return Promise.resolve(this.cache.get(this.keyEncoder(e,r))??null)}async update(e,r,n){this.cache.set(this.keyEncoder(e,r),n)}static global(){return new t(ccn)}}});function mcn(t,e){let r=Array.from({length:t.length},(n,o)=>({start:o,end:o+1}));for(;r.length>1;){let n=null;for(let o=0;o<r.length-1;o++){let i=t.slice(r[o].start,r[o+1].end),a=e.get(i.join(","));a!=null&&(n==null||a<n[0])&&(n=[a,o])}if(n!=null){let o=n[1];r[o]={start:r[o].start,end:r[o+1].end},r.splice(o+1,1)}else break}return r}function hcn(t,e){return t.length===1?[e.get(t.join(","))]:mcn(t,e).map(r=>e.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function gcn(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function yFe(t){switch(t){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":return"o200k_base";default:throw new Error("Unknown model")}}var tBt,dcn,fcn,pcn,gFe,dle,rBt=b(()=>{tBt=j(xCe(),1),dcn=Object.defineProperty,fcn=(t,e,r)=>e in t?dcn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pcn=(t,e,r)=>(fcn(t,typeof e!="symbol"?e+"":e,r),r);gFe=class{constructor(t,e){bd(this,"specialTokens");bd(this,"inverseSpecialTokens");bd(this,"patStr");bd(this,"textEncoder",new TextEncoder);bd(this,"textDecoder",new TextDecoder("utf-8"));bd(this,"rankMap",new Map);bd(this,"textMap",new Map);this.patStr=t.pat_str;let r=t.bpe_ranks.split(`
`).filter(Boolean).reduce((n,o)=>{let[i,a,...s]=o.split(" "),u=Number.parseInt(a,10);return s.forEach((l,c)=>n[l]=u+c),n},{});for(let[n,o]of Object.entries(r)){let i=tBt.default.toByteArray(n);this.rankMap.set(i.join(","),o),this.textMap.set(o,i)}this.specialTokens={...t.special_tokens,...e},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((n,[o,i])=>(n[i]=this.textEncoder.encode(o),n),{})}encode(t,e=[],r="all"){let n=new RegExp(this.patStr,"ug"),o=gFe.specialTokenRegex(Object.keys(this.specialTokens)),i=[],a=new Set(e==="all"?Object.keys(this.specialTokens):e),s=new Set(r==="all"?Object.keys(this.specialTokens).filter(l=>!a.has(l)):r);if(s.size>0){let l=gFe.specialTokenRegex([...s]),c=t.match(l);if(c!=null)throw new Error(`The text contains a special token that is not allowed: ${c[0]}`)}let u=0;for(;;){let l=null,c=u;for(;o.lastIndex=c,l=o.exec(t),!(l==null||a.has(l[0]));)c=l.index+1;let d=l?.index??t.length;for(let p of t.substring(u,d).matchAll(n)){let m=this.textEncoder.encode(p[0]),h=this.rankMap.get(m.join(","));if(h!=null){i.push(h);continue}i.push(...hcn(m,this.rankMap))}if(l==null)break;let f=this.specialTokens[l[0]];i.push(f),u=l.index+l[0].length}return i}decode(t){let e=[],r=0;for(let i=0;i<t.length;++i){let a=t[i],s=this.textMap.get(a)??this.inverseSpecialTokens[a];s!=null&&(e.push(s),r+=s.length)}let n=new Uint8Array(r),o=0;for(let i of e)n.set(i,o),o+=i.length;return this.textDecoder.decode(n)}},dle=gFe;pcn(dle,"specialTokenRegex",t=>new RegExp(t.map(e=>gcn(e)).join("|"),"g"))});var nBt=b(()=>{rBt()});async function oBt(t){return t in fle||(fle[t]=ycn.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new dle(e)).catch(e=>{throw delete fle[t],e})),await fle[t]}async function iBt(t){return oBt(yFe(t))}var fle,ycn,bFe=b(()=>{nBt();RB();fle={},ycn=new Mh({})});function $d(t){return typeof t!="object"||!t?!1:!!("type"in t&&t.type==="function"&&"function"in t&&typeof t.function=="object"&&t.function&&"name"in t.function&&"parameters"in t.function)}var bcn,_cn,a2,s2,vK=b(()=>{eBt();o8();VA();RB();bFe();Af();bcn=t=>t.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":t.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":t.startsWith("gpt-4-32k")?"gpt-4-32k":t.startsWith("gpt-4-")?"gpt-4":t.startsWith("gpt-4o")?"gpt-4o":t;_cn=()=>!1,a2=class extends zn{get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(e){super(e),Object.defineProperty(this,"verbose",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"callbacks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.verbose=e.verbose??_cn(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{}}},s2=class extends a2{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}constructor({callbacks:e,callbackManager:r,...n}){let{cache:o,...i}=n;super({callbacks:e??r,...i}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_encoding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),typeof o=="object"?this.cache=o:o?this.cache=cle.global():this.cache=void 0,this.caller=new Mh(n??{})}async getNumTokens(e){let r;typeof e=="string"?r=e:r=e.map(o=>typeof o=="string"?o:o.type==="text"&&"text"in o?o.text:"").join("");let n=Math.ceil(r.length/4);if(!this._encoding)try{this._encoding=await iBt("modelName"in this?bcn(this.modelName):"gpt2")}catch(o){console.warn("Failed to calculate number of tokens, falling back to approximate count",o)}if(this._encoding)try{n=this._encoding.encode(r).length}catch(o){console.warn("Failed to calculate number of tokens, falling back to approximate count",o)}return n}static _convertInputToPromptValue(e){return typeof e=="string"?new qB(e):Array.isArray(e)?new HB(e.map(Db)):e}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:e,...r}){let n={...this._identifyingParams(),...r,_type:this._llmType(),_model:this._modelType()};return Object.entries(n).filter(([a,s])=>s!==void 0).map(([a,s])=>`${a}:${JSON.stringify(s)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(e){throw new Error("Use .toJSON() instead")}}});var ag=b(()=>{vK()});function _Fe(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function vFe(t){return t!==void 0&&zn.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function wFe(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(jh(t.schema)||t.schema!=null&&typeof t.schema=="object"&&"type"in t.schema&&typeof t.schema.type=="string"&&["null","boolean","object","array","number","string"].includes(t.schema.type))}function Kc(t){return wFe(t)||vFe(t)||_Fe(t)}var ple=b(()=>{Af();OE()});function WM(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:Pm(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function KC(t,e){let r=typeof e=="number"?void 0:e,n;return Kc(t)?n={type:"function",function:WM(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var aBt=b(()=>{ple();Tj();ple()});var sg=b(()=>{aBt()});function xFe(t){let e=[];for(let r of t){let n=r;if(Array.isArray(r.content))for(let o=0;o<r.content.length;o++){let i=r.content[o];(tXe(i)||rXe(i))&&n===r&&(n=new r.constructor({...n,content:[...r.content.slice(0,o),nXe(i),...r.content.slice(o+1)]}))}e.push(n)}return e}var Au,sBt=b(()=>{Aj();MB();vK();KA();Af();Pv();yee();OE();N6();Tj();Au=class t extends s2{constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models",this._llmType()]}),Object.defineProperty(this,"disableStreaming",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async invoke(e,r){let n=t._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].message}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}async*_streamIterator(e,r){if(this._streamResponseChunks===t.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(e,r);else{let o=t._convertInputToPromptValue(e).toChatMessages(),[i,a]=this._separateRunnableConfigFromCallOptionsCompat(r),s={...i.metadata,...this.getLsParams(a)},u=await _u.configure(i.callbacks,this.callbacks,i.tags,this.tags,s,this.metadata,{verbose:this.verbose}),l={options:a,invocation_params:this?.invocationParams(a),batch_size:1},c=await u?.handleChatModelStart(this.toJSON(),[xFe(o)],i.runId,void 0,l,void 0,void 0,i.runName),d,f;try{for await(let p of this._streamResponseChunks(o,a,c?.[0])){if(p.message.id==null){let m=c?.at(0)?.runId;m!=null&&p.message._updateId(`run-${m}`)}p.message.response_metadata={...p.generationInfo,...p.message.response_metadata},yield p.message,d?d=d.concat(p):d=p,cxe(p.message)&&p.message.usage_metadata!==void 0&&(f={tokenUsage:{promptTokens:p.message.usage_metadata.input_tokens,completionTokens:p.message.usage_metadata.output_tokens,totalTokens:p.message.usage_metadata.total_tokens}})}}catch(p){throw await Promise.all((c??[]).map(m=>m?.handleLLMError(p))),p}await Promise.all((c??[]).map(p=>p?.handleLLMEnd({generations:[[d]],llmOutput:f})))}}getLsParams(e){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:r}}async _generateUncached(e,r,n,o){let i=e.map(d=>d.map(Db)),a;if(o!==void 0&&o.length===i.length)a=o;else{let d={...n.metadata,...this.getLsParams(r)},f=await _u.configure(n.callbacks,this.callbacks,n.tags,this.tags,d,this.metadata,{verbose:this.verbose}),p={options:r,invocation_params:this?.invocationParams(r),batch_size:1};a=await f?.handleChatModelStart(this.toJSON(),i.map(xFe),n.runId,void 0,p,void 0,void 0,n.runName)}let s=[],u=[];if(!!a?.[0].handlers.find(txe)&&!this.disableStreaming&&i.length===1&&this._streamResponseChunks!==t.prototype._streamResponseChunks)try{let d=await this._streamResponseChunks(i[0],r,a?.[0]),f,p;for await(let m of d){if(m.message.id==null){let h=a?.at(0)?.runId;h!=null&&m.message._updateId(`run-${h}`)}f===void 0?f=m:f=Dc(f,m),cxe(m.message)&&m.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:m.message.usage_metadata.input_tokens,completionTokens:m.message.usage_metadata.output_tokens,totalTokens:m.message.usage_metadata.total_tokens}})}if(f===void 0)throw new Error("Received empty response from chat model call.");s.push([f]),await a?.[0].handleLLMEnd({generations:s,llmOutput:p})}catch(d){throw await a?.[0].handleLLMError(d),d}else{let d=await Promise.allSettled(i.map((f,p)=>this._generate(f,{...r,promptIndex:p},a?.[p])));await Promise.all(d.map(async(f,p)=>{if(f.status==="fulfilled"){let m=f.value;for(let h of m.generations){if(h.message.id==null){let y=a?.at(0)?.runId;y!=null&&h.message._updateId(`run-${y}`)}h.message.response_metadata={...h.generationInfo,...h.message.response_metadata}}return m.generations.length===1&&(m.generations[0].message.response_metadata={...m.llmOutput,...m.generations[0].message.response_metadata}),s[p]=m.generations,u[p]=m.llmOutput,a?.[p]?.handleLLMEnd({generations:[m.generations],llmOutput:m.llmOutput})}else return await a?.[p]?.handleLLMError(f.reason),Promise.reject(f.reason)}))}let c={generations:s,llmOutput:u.length?this._combineLLMOutput?.(...u):void 0};return Object.defineProperty(c,V6,{value:a?{runIds:a?.map(d=>d.runId)}:void 0,configurable:!0}),c}async _generateCached({messages:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i}){let a=e.map(y=>y.map(Db)),s={...i.metadata,...this.getLsParams(o)},u=await _u.configure(i.callbacks,this.callbacks,i.tags,this.tags,s,this.metadata,{verbose:this.verbose}),l={options:o,invocation_params:this?.invocationParams(o),batch_size:1},c=await u?.handleChatModelStart(this.toJSON(),a.map(xFe),i.runId,void 0,l,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(a.map(async(y,g)=>{let _=t._convertInputToPromptValue(y).toString(),w=await r.lookup(_,n);return w==null&&d.push(g),w}))).map((y,g)=>({result:y,runManager:c?.[g]})).filter(({result:y})=>y.status==="fulfilled"&&y.value!=null||y.status==="rejected"),m=[];await Promise.all(p.map(async({result:y,runManager:g},_)=>{if(y.status==="fulfilled"){let w=y.value;return m[_]=w.map(S=>("message"in S&&Hg(S.message)&&Ki(S.message)&&(S.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0}),S.generationInfo={...S.generationInfo,tokenUsage:{}},S)),w.length&&await g?.handleLLMNewToken(w[0].text),g?.handleLLMEnd({generations:[w]},void 0,void 0,void 0,{cached:!0})}else return await g?.handleLLMError(y.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(y.reason)}));let h={generations:m,missingPromptIndices:d,startedRunManagers:c};return Object.defineProperty(h,V6,{value:c?{runIds:c?.map(y=>y.runId)}:void 0,configurable:!0}),h}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(m=>m.map(Db)),[a,s]=this._separateRunnableConfigFromCallOptionsCompat(o);if(a.callbacks=a.callbacks??n,!this.cache)return this._generateUncached(i,s,a);let{cache:u}=this,l=this._getSerializedCacheKeyParametersForCall(s),{generations:c,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({messages:i,cache:u,llmStringKey:l,parsedOptions:s,handledOptions:a}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>i[h]),s,a,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,y)=>{let g=d[y];c[g]=h;let _=t._convertInputToPromptValue(i[g]).toString();return u.update(_,l,h)})),p=m.llmOutput??{}}return{generations:c,llmOutput:p}}invocationParams(e){return{}}_modelType(){return"base_chat_model"}serialize(){return{...this.invocationParams(),_type:this._llmType(),_model:this._modelType()}}async generatePrompt(e,r,n){let o=e.map(i=>i.toChatMessages());return this.generate(o,r,n)}async call(e,r,n){return(await this.generate([e.map(Db)],r,n)).generations[0][0].message}async callPrompt(e,r,n){let o=e.toChatMessages();return this.call(o,r,n)}async predictMessages(e,r,n){return this.call(e,r,n)}async predict(e,r,n){let o=new eu(e),i=await this.call([o],r,n);if(typeof i.content!="string")throw new Error("Cannot use predict when output is not a string.");return i.content}withStructuredOutput(e,r){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(r?.strict)throw new Error('"strict" mode is not supported for this model by default.');let n=e,o=r?.name,i=Pj(n)??"A function available to call.",a=r?.method,s=r?.includeRaw;if(a==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let u=o??"extract",l;jh(n)?l=[{type:"function",function:{name:u,description:i,parameters:Pm(n)}}]:("name"in n&&(u=n.name),l=[{type:"function",function:{name:u,description:i,parameters:n}}]);let c=this.bindTools(l),d=Mp.from(h=>{if(!h.tool_calls||h.tool_calls.length===0)throw new Error("No tool calls found in the response.");let y=h.tool_calls.find(g=>g.name===u);if(!y)throw new Error(`No tool call found with name ${u}.`);return y.args});if(!s)return c.pipe(d).withConfig({runName:"StructuredOutput"});let f=Fo.assign({parsed:(h,y)=>d.invoke(h.raw,y)}),p=Fo.assign({parsed:()=>null}),m=f.withFallbacks({fallbacks:[p]});return Fi.from([{raw:c},m]).withConfig({runName:"StructuredOutputRunnable"})}}});var GC=b(()=>{sBt()});var Qf=b(()=>{MB()});var no=b(()=>{vj()});function uBt(t,e=0){return(Bd[t[e+0]]+Bd[t[e+1]]+Bd[t[e+2]]+Bd[t[e+3]]+"-"+Bd[t[e+4]]+Bd[t[e+5]]+"-"+Bd[t[e+6]]+Bd[t[e+7]]+"-"+Bd[t[e+8]]+Bd[t[e+9]]+"-"+Bd[t[e+10]]+Bd[t[e+11]]+Bd[t[e+12]]+Bd[t[e+13]]+Bd[t[e+14]]+Bd[t[e+15]]).toLowerCase()}var Bd,mle,lBt=b(()=>{Bd=[];for(mle=0;mle<256;++mle)Bd.push((mle+256).toString(16).slice(1))});function SFe(){if(!hle&&(hle=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!hle))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return hle(vcn)}var hle,vcn,cBt=b(()=>{vcn=new Uint8Array(16)});var wcn,CFe,dBt=b(()=>{wcn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),CFe={randomUUID:wcn}});function xcn(t,e,r){if(CFe.randomUUID&&!e&&!t)return CFe.randomUUID();t=t||{};var n=t.random||(t.rng||SFe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return uBt(n)}var OFe,fBt=b(()=>{dBt();cBt();lBt();OFe=xcn});var pBt=b(()=>{fBt()});function mBt(t){let e=[],r=[];typeof t=="string"?r=[{output:t}]:t instanceof Map||typeof t=="object"&&t!==null&&!Array.isArray(t)?r=[t]:Array.isArray(t)||(r=[{output:t}]);for(let n of r)!(n instanceof Map)&&(typeof n!="object"||n===null)&&(n={output:n}),e.push(n);return e}function gle(t,e){let r=i=>{switch(i){case"system":return"SYSTEM";case"human":return"USER";case"ai":return"CHATBOT";case"tool":return"TOOL";default:throw new Error(`Unknown message type: '${i}'. Accepted types: 'human', 'ai', 'system', 'tool'`)}},n=i=>{if(typeof i=="string")return i;throw new Error(`ChatCohere does not support non text message content. Received: ${JSON.stringify(i,null,2)}`)},o=i=>Ki(i)&&i.tool_calls?i.tool_calls.map(a=>({name:a.name,parameters:a.args})):[];if(t._getType().toLowerCase()==="ai")return{role:r(t._getType()),message:n(t.content),toolCalls:o(t)};if(t._getType().toLowerCase()==="tool")return{role:r(t._getType()),message:n(t.content),toolResults:e};if(t._getType().toLowerCase()==="human"||t._getType().toLowerCase()==="system")return{role:r(t._getType()),message:n(t.content)};throw new Error("Got unknown message type. Supported types are AIMessage, ToolMessage, HumanMessage, and SystemMessage")}function Ccn(t){return"name"in t&&"description"in t&&"parameterDefinitions"in t}function hBt(t){return t._getType()==="tool"}function gBt(t){let e="properties"in t?t.properties:{},r="required"in t?t.required:[],n={};return Object.keys(e).forEach(o=>{n[o]=e[o],r===void 0&&(r=[]),n[o].required=r.includes(o)}),n}function Ocn(t){if(t){if(t.every(Ccn))return t;if(t.every($d))return t.map(e=>({name:e.function.name,description:e.function.description??"",parameterDefinitions:gBt(e.function.parameters)}));if(t.every(Kc))return t.map(e=>{let r=ss(e.schema);return{name:e.name,description:e.description??"",parameterDefinitions:gBt(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var yBt,yle,bBt=b(()=>{yBt=j(_K(),1);Gg();Bs();ag();sg();GC();Qf();Bs();no();pBt();yle=class extends Au{static lc_name(){return"ChatCohere"}constructor(e){super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"command-r-plus"}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:.3}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0});let r=e?.apiKey??lt("COHERE_API_KEY");if(!r)throw new Error("No API key provided for ChatCohere.");this.client=new yBt.CohereClient({token:r}),this.model=e?.model??this.model,this.temperature=e?.temperature??this.temperature,this.streaming=e?.streaming??this.streaming,this.streamUsage=e?.streamUsage??this.streamUsage}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"cohere",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:this.temperature??void 0,ls_max_tokens:typeof r.maxTokens=="number"?r.maxTokens:void 0,ls_stop:Array.isArray(r.stopSequences)?r.stopSequences:void 0}}_llmType(){return"cohere"}invocationParams(e){if(e.tool_choice)throw new Error("'tool_choice' call option is not supported by ChatCohere.");let r={model:this.model,preamble:e.preamble,conversationId:e.conversationId,promptTruncation:e.promptTruncation,connectors:e.connectors,searchQueriesOnly:e.searchQueriesOnly,documents:e.documents,temperature:e.temperature??this.temperature,forceSingleStep:e.forceSingleStep,tools:e.tools};return Object.fromEntries(Object.entries(r).filter(([,n])=>n!==void 0))}bindTools(e,r){return this.bind({tools:Ocn(e),...r})}_getChatRequest(e,r){let n=this.invocationParams(r),o=this._messagesToCohereToolResultsCurrChatTurn(e),i=[],a="",s=[];if(n.forceSingleStep){a="";for(let l=0;l<e.length-1;l+=1){let c=e[l];if(!(Ki(c)&&c.tool_calls))if(c._getType().toLowerCase()==="tool"){if(s=s.concat(this._messageToCohereToolResults(e,l)),l===e.length-1||e[l+1]._getType().toLowerCase()!=="tool"){let d=gle(c,s);i.push(d),s=[]}}else i.push(gle(c,[]))}for(let l=e.length-1;l>=0;l-=1){let c=e[l];if(c._getType().toLowerCase()==="human"&&c.content){a=c.content.toString();break}}}else{for(let l=0;l<e.length-1;l+=1){let c=e[l];if(c._getType().toLowerCase()==="tool"){if(s=s.concat(this._messageToCohereToolResults(e,l)),l===e.length-1||e[l+1]._getType().toLowerCase()!=="tool"){let d=gle(c,s);i.push(d),s=[]}}else i.push(gle(c,[]))}a=o.length>0?"":e[e.length-1].content.toString()}return{message:a,chatHistory:i,toolResults:o.length>0?o:void 0,...n}}_getCurrChatTurnMessages(e){let r=[];for(let n=e.length-1;n>=0;n-=1){let o=e[n];if(r.push(o),o._getType().toLowerCase()==="human")break}return r.reverse()}_messagesToCohereToolResultsCurrChatTurn(e){let r=[],n=this._getCurrChatTurnMessages(e);for(let o of n)if(hBt(o)){let i=o,a=n.filter(s=>Ki(s)&&s.tool_calls!==void 0);if(a.length>0){let s=a[a.length-1];s.tool_calls&&r.push(...s.tool_calls.filter(u=>u.id===i.tool_call_id).map(u=>({call:{name:u.name,parameters:u.args},outputs:mBt(i.content)})))}}return r}_messageToCohereToolResults(e,r){let n=[],o=e[r];if(!hBt(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=e.slice(0,r).filter(s=>Ki(s)&&s.tool_calls).slice(-1)[0];return a.tool_calls&&n.push(...a.tool_calls.filter(s=>s.id===o.tool_call_id).map(s=>({call:{name:s.name,parameters:s.args},outputs:mBt(o.content)}))),n}_formatCohereToolCalls(e=null){if(!e)return[];let r=[];for(let n of e)r.push({id:OFe().substring(0,32),function:{name:n.name,arguments:n.parameters},type:"function"});return r}_convertCohereToolCallToLangchain(e){return e.map(r=>({name:r.function.name,args:r.function.arguments,id:r.id,type:"tool_call"}))}async _generate(e,r,n){let o={},i=this._getChatRequest(e,r);if(this.streaming){let c=this._streamResponseChunks(e,r,n),d={};for await(let p of c){let m=p.generationInfo?.completion??0;d[m]===void 0?d[m]=p:d[m]=d[m].concat(p)}return{generations:Object.entries(d).sort(([p],[m])=>parseInt(p,10)-parseInt(m,10)).map(([p,m])=>m),llmOutput:{estimatedTokenUsage:o}}}let a=await this.caller.callWithOptions({signal:r.signal},async()=>{let c;try{c=await this.client.chat(i)}catch(d){throw d.status=d.status??d.statusCode,d}return c});if(a.meta?.tokens){let{inputTokens:c,outputTokens:d}=a.meta.tokens;d&&(o.completionTokens=(o.completionTokens??0)+d),c&&(o.promptTokens=(o.promptTokens??0)+c),o.totalTokens=(o.totalTokens??0)+(o.promptTokens??0)+(o.completionTokens??0)}let s={...a};delete s.text,a.toolCalls&&a.toolCalls.length>0&&(s.toolCalls=this._formatCohereToolCalls(a.toolCalls));let u=[];return"toolCalls"in s&&(u=this._convertCohereToolCallToLangchain(s.toolCalls)),{generations:[{text:a.text,message:new Ln({content:a.text,additional_kwargs:s,tool_calls:u,usage_metadata:{input_tokens:o.promptTokens??0,output_tokens:o.completionTokens??0,total_tokens:o.totalTokens??0}}),generationInfo:s}],llmOutput:{estimatedTokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=this._getChatRequest(e,r),i=await this.caller.call(async()=>{let a;try{a=await this.client.chatStream(o)}catch(s){throw s.status=s.status??s.statusCode,s}return a});for await(let a of i)if(a.eventType==="text-generation")yield new co({text:a.text,message:new vr({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new co({text:"",message:new vr({content:"",additional_kwargs:{...a}}),generationInfo:{...a}});else if(a.eventType==="stream-end"&&(this.streamUsage||r.streamUsage)){let s=a.response.meta?.tokens?.inputTokens??0,u=a.response.meta?.tokens?.outputTokens??0,l={...a.response};a.response.toolCalls&&a.response.toolCalls.length>0&&(l.toolCalls=this._formatCohereToolCalls(a.response.toolCalls));let c=[],d=l.toolCalls??[];d.length>0&&(c=d.map(f=>({name:f.function.name,args:f.function.arguments,id:f.id,index:f.index,type:"tool_call_chunk"}))),yield new co({text:"",message:new vr({content:"",additional_kwargs:{eventType:"stream-end"},tool_call_chunks:c,usage_metadata:{input_tokens:s,output_tokens:u,total_tokens:s+u}}),generationInfo:{eventType:"stream-end",...l}})}}_combineLLMOutput(...e){return e.reduce((r,n)=>{if(n&&n.estimatedTokenUsage){let o=r.estimatedTokenUsage?.completionTokens??0,i=r.estimatedTokenUsage?.promptTokens??0,a=r.estimatedTokenUsage?.totalTokens??0;o+=n.estimatedTokenUsage.completionTokens??0,i+=n.estimatedTokenUsage.promptTokens??0,a+=n.estimatedTokenUsage.totalTokens??0,r.estimatedTokenUsage={completionTokens:o,promptTokens:i,totalTokens:a}}return r},{estimatedTokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}get lc_secrets(){return{apiKey:"COHERE_API_KEY",api_key:"COHERE_API_KEY"}}get lc_aliases(){return{apiKey:"cohere_api_key",api_key:"cohere_api_key"}}}});var _Bt=b(()=>{Aj();MB();KA();vK();Pv();N6()});var RL=b(()=>{_Bt()});var Ecn,wBt=b(()=>{Ecn=j(_K(),1);no();RL()});var Wp,xBt=b(()=>{RB();Wp=class{constructor(e){Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.caller=new Mh(e??{})}}});var NP=b(()=>{xBt()});var Kp,SBt=b(()=>{Kp=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),a=r[i]||[];return r[i]=a.concat([n]),r},[])});var Ry=b(()=>{SBt()});var CBt,ble,OBt=b(()=>{CBt=j(_K(),1);no();NP();Ry();ble=class extends Wp{constructor(e){let r={maxConcurrency:2,...e};super(r),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSize",{enumerable:!0,configurable:!0,writable:!0,value:48}),Object.defineProperty(this,"embeddingTypes",{enumerable:!0,configurable:!0,writable:!0,value:["float"]}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let n=r?.apiKey||lt("COHERE_API_KEY");if(!n)throw new Error("Cohere API key not found");if(this.client=new CBt.CohereClient({token:n}),this.model=r?.model??this.model,!this.model)throw new Error("Model not specified for CohereEmbeddings instance. Please provide a model name from the options here: https://docs.cohere.com/reference/embed");this.batchSize=r?.batchSize??this.batchSize,this.embeddingTypes=r?.embeddingTypes??this.embeddingTypes}async embedDocuments(e){let r=Kp(e,this.batchSize),n=r.map(a=>this.embeddingWithRetry({model:this.model,texts:a,inputType:"search_document",embeddingTypes:this.embeddingTypes})),o=await Promise.all(n),i=[];for(let a=0;a<o.length;a+=1){let s=r[a],{embeddings:u}=o[a];for(let l=0;l<s.length;l+=1)"float"in u&&u.float?i.push(u.float[l]):Array.isArray(u)&&i.push(u[l])}return i}async embedQuery(e){let{embeddings:r}=await this.embeddingWithRetry({model:this.model,texts:[e],inputType:"search_query",embeddingTypes:this.embeddingTypes});if("float"in r&&r.float)return r.float[0];if(Array.isArray(r))return r[0];throw new Error(`Invalid response from Cohere API. Received: ${JSON.stringify(r,null,2)}`)}async embed(e){let{embeddings:r}=await this.embeddingWithRetry(e);if("float"in r&&r.float)return r.float[0];if(Array.isArray(r))return r[0];throw new Error(`Invalid response from Cohere API. Received: ${JSON.stringify(r,null,2)}`)}async embeddingWithRetry(e){return this.caller.call(async()=>{let r;try{r=await this.client.embed(e)}catch(n){throw n.status=n.status??n.statusCode,n}return r})}get lc_secrets(){return{apiKey:"COHERE_API_KEY",api_key:"COHERE_API_KEY"}}get lc_aliases(){return{apiKey:"cohere_api_key",api_key:"cohere_api_key"}}}});var EBt=b(()=>{});var PBt=b(()=>{EBt()});var Pcn,TBt=b(()=>{PBt();no();Pcn=j(_K(),1)});var ABt=b(()=>{bBt();wBt();OBt();TBt()});var EFe=b(()=>{ABt()});function Rcn(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${Mcn}/${Icn}`),e.join(" ")}async function Ncn(t){var e;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",Rcn(t.requestOptions)),r.append("x-goog-api-key",t.apiKey);let n=(e=t.requestOptions)===null||e===void 0?void 0:e.customHeaders;if(n){if(!(n instanceof Headers))try{n=new Headers(n)}catch(o){throw new JC(`unable to convert customHeaders value ${JSON.stringify(n)} to Headers: ${o.message}`)}for(let[o,i]of n.entries()){if(o==="x-goog-api-key")throw new JC(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new JC(`Header name ${o} can only be set using the apiClient field`);r.append(o,i)}}return r}async function jcn(t,e,r,n,o,i){let a=new PFe(t,e,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},kcn(i)),{method:"POST",headers:await Ncn(a),body:o})}}async function CK(t,e,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await jcn(t,e,r,n,o,i);return Dcn(s,u,a)}async function Dcn(t,e,r=fetch){let n;try{n=await r(t,e)}catch(o){Lcn(o,t)}return n.ok||await Fcn(n,t),n}function Lcn(t,e){let r=t;throw t instanceof vle||t instanceof JC||(r=new ep(`Error fetching from ${e.toString()}: ${t.message}`),r.stack=t.stack),r}async function Fcn(t,e){let r="",n;try{let o=await t.json();r=o.error.message,o.error.details&&(r+=` ${JSON.stringify(o.error.details)}`,n=o.error.details)}catch{}throw new vle(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${r}`,t.status,t.statusText,n)}function kcn(t){let e={};if(t?.signal!==void 0||t?.timeout>=0){let r=new AbortController;t?.timeout>=0&&setTimeout(()=>r.abort(),t.timeout),t?.signal&&t.signal.addEventListener("abort",()=>{r.abort()}),e.signal=r.signal}return e}function AFe(t){return t.text=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`),_le(t.candidates[0]))throw new KM(`${GM(t)}`,t);return $cn(t)}else if(t.promptFeedback)throw new KM(`Text not available. ${GM(t)}`,t);return""},t.functionCall=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),_le(t.candidates[0]))throw new KM(`${GM(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),kBt(t)[0]}else if(t.promptFeedback)throw new KM(`Function call not available. ${GM(t)}`,t)},t.functionCalls=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),_le(t.candidates[0]))throw new KM(`${GM(t)}`,t);return kBt(t)}else if(t.promptFeedback)throw new KM(`Function call not available. ${GM(t)}`,t)},t}function $cn(t){var e,r,n,o;let i=[];if(!((r=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||r===void 0)&&r.parts)for(let a of(o=(n=t.candidates)===null||n===void 0?void 0:n[0].content)===null||o===void 0?void 0:o.parts)a.text&&i.push(a.text),a.executableCode&&i.push("\n```"+a.executableCode.language+`
`+a.executableCode.code+"\n```\n"),a.codeExecutionResult&&i.push("\n```\n"+a.codeExecutionResult.output+"\n```\n");return i.length>0?i.join(""):""}function kBt(t){var e,r,n,o;let i=[];if(!((r=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||r===void 0)&&r.parts)for(let a of(o=(n=t.candidates)===null||n===void 0?void 0:n[0].content)===null||o===void 0?void 0:o.parts)a.functionCall&&i.push(a.functionCall);if(i.length>0)return i}function _le(t){return!!t.finishReason&&Bcn.includes(t.finishReason)}function GM(t){var e,r,n;let o="";if((!t.candidates||t.candidates.length===0)&&t.promptFeedback)o+="Response was blocked",!((e=t.promptFeedback)===null||e===void 0)&&e.blockReason&&(o+=` due to ${t.promptFeedback.blockReason}`),!((r=t.promptFeedback)===null||r===void 0)&&r.blockReasonMessage&&(o+=`: ${t.promptFeedback.blockReasonMessage}`);else if(!((n=t.candidates)===null||n===void 0)&&n[0]){let i=t.candidates[0];_le(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function xK(t){return this instanceof xK?(this.v=t,this):new xK(t)}function zcn(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof xK?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){s("next",f)}function c(f){s("throw",f)}function d(f,p){f(p),i.shift(),i.length&&s(i[0][0],i[0][1])}}function Ucn(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=Vcn(e),[n,o]=r.tee();return{stream:Hcn(n),response:qcn(o)}}async function qcn(t){let e=[],r=t.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return AFe(Wcn(e));e.push(o)}}function Hcn(t){return zcn(this,arguments,function*(){let r=t.getReader();for(;;){let{value:n,done:o}=yield xK(r.read());if(o)break;yield yield xK(AFe(n))}})}function Vcn(t){let e=t.getReader();return new ReadableStream({start(n){let o="";return i();function i(){return e.read().then(({value:a,done:s})=>{if(s){if(o.trim()){n.error(new ep("Failed to parse stream"));return}n.close();return}o+=a;let u=o.match($Bt),l;for(;u;){try{l=JSON.parse(u[1])}catch{n.error(new ep(`Error parsing JSON response: "${u[1]}"`));return}n.enqueue(l),o=o.substring(u[0].length),u=o.match($Bt)}return i()})}}})}function Wcn(t){let e=t[t.length-1],r={promptFeedback:e?.promptFeedback};for(let n of t){if(n.candidates)for(let o of n.candidates){let i=o.index;if(r.candidates||(r.candidates=[]),r.candidates[i]||(r.candidates[i]={index:o.index}),r.candidates[i].citationMetadata=o.citationMetadata,r.candidates[i].groundingMetadata=o.groundingMetadata,r.candidates[i].finishReason=o.finishReason,r.candidates[i].finishMessage=o.finishMessage,r.candidates[i].safetyRatings=o.safetyRatings,o.content&&o.content.parts){r.candidates[i].content||(r.candidates[i].content={role:o.content.role||"user",parts:[]});let a={};for(let s of o.content.parts)s.text&&(a.text=s.text),s.functionCall&&(a.functionCall=s.functionCall),s.executableCode&&(a.executableCode=s.executableCode),s.codeExecutionResult&&(a.codeExecutionResult=s.codeExecutionResult),Object.keys(a).length===0&&(a.text=""),r.candidates[i].content.parts.push(a)}}n.usageMetadata&&(r.usageMetadata=n.usageMetadata)}return r}async function qBt(t,e,r,n){let o=await CK(e,LL.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(r),n);return Ucn(o)}async function HBt(t,e,r,n){let i=await(await CK(e,LL.GENERATE_CONTENT,t,!1,JSON.stringify(r),n)).json();return{response:AFe(i)}}function VBt(t){if(t!=null){if(typeof t=="string")return{role:"system",parts:[{text:t}]};if(t.text)return{role:"system",parts:[t]};if(t.parts)return t.role?t:{role:"system",parts:t.parts}}}function SK(t){let e=[];if(typeof t=="string")e=[{text:t}];else for(let r of t)typeof r=="string"?e.push({text:r}):e.push(r);return Kcn(e)}function Kcn(t){let e={role:"user",parts:[]},r={role:"function",parts:[]},n=!1,o=!1;for(let i of t)"functionResponse"in i?(r.parts.push(i),o=!0):(e.parts.push(i),n=!0);if(n&&o)throw new ep("Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message.");if(!n&&!o)throw new ep("No content is provided for sending chat message.");return n?e:r}function Gcn(t,e){var r;let n={model:e?.model,generationConfig:e?.generationConfig,safetySettings:e?.safetySettings,tools:e?.tools,toolConfig:e?.toolConfig,systemInstruction:e?.systemInstruction,cachedContent:(r=e?.cachedContent)===null||r===void 0?void 0:r.name,contents:[]},o=t.generateContentRequest!=null;if(t.contents){if(o)throw new JC("CountTokensRequest must have one of contents or generateContentRequest, not both.");n.contents=t.contents}else if(o)n=Object.assign(Object.assign({},n),t.generateContentRequest);else{let i=SK(t);n.contents=[i]}return{generateContentRequest:n}}function BBt(t){let e;return t.contents?e=t:e={contents:[SK(t)]},t.systemInstruction&&(e.systemInstruction=VBt(t.systemInstruction)),e}function Jcn(t){return typeof t=="string"||Array.isArray(t)?{content:SK(t)}:t}function Ycn(t){let e=!1;for(let r of t){let{role:n,parts:o}=r;if(!e&&n!=="user")throw new ep(`First content should be with role 'user', got ${n}`);if(!NBt.includes(n))throw new ep(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(NBt)}`);if(!Array.isArray(o))throw new ep("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new ep("Each Content should have at least one part");let i={text:0,inlineData:0,functionCall:0,functionResponse:0,fileData:0,executableCode:0,codeExecutionResult:0};for(let s of o)for(let u of zBt)u in s&&(i[u]+=1);let a=Zcn[n];for(let s of zBt)if(!a.includes(s)&&i[s]>0)throw new ep(`Content with role '${n}' can't contain '${s}' part`);e=!0}}async function Xcn(t,e,r,n){return(await CK(e,LL.COUNT_TOKENS,t,!1,JSON.stringify(r),n)).json()}async function Qcn(t,e,r,n){return(await CK(e,LL.EMBED_CONTENT,t,!1,JSON.stringify(r),n)).json()}async function edn(t,e,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await CK(e,LL.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),n)).json()}var IBt,MBt,RBt,NBt,NL,jL,jBt,DBt,wK,LBt,DL,FBt,ep,KM,vle,JC,Tcn,Acn,Icn,Mcn,LL,PFe,Bcn,$Bt,zBt,Zcn,UBt,TFe,wle,FL,OK=b(()=>{(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(IBt||(IBt={}));(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(MBt||(MBt={}));(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(RBt||(RBt={}));NBt=["user","model","function","system"];(function(t){t.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",t.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",t.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",t.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",t.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT"})(NL||(NL={}));(function(t){t.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",t.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",t.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",t.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",t.BLOCK_NONE="BLOCK_NONE"})(jL||(jL={}));(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(jBt||(jBt={}));(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(DBt||(DBt={}));(function(t){t.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",t.STOP="STOP",t.MAX_TOKENS="MAX_TOKENS",t.SAFETY="SAFETY",t.RECITATION="RECITATION",t.LANGUAGE="LANGUAGE",t.OTHER="OTHER"})(wK||(wK={}));(function(t){t.TASK_TYPE_UNSPECIFIED="TASK_TYPE_UNSPECIFIED",t.RETRIEVAL_QUERY="RETRIEVAL_QUERY",t.RETRIEVAL_DOCUMENT="RETRIEVAL_DOCUMENT",t.SEMANTIC_SIMILARITY="SEMANTIC_SIMILARITY",t.CLASSIFICATION="CLASSIFICATION",t.CLUSTERING="CLUSTERING"})(LBt||(LBt={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(DL||(DL={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(FBt||(FBt={}));ep=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},KM=class extends ep{constructor(e,r){super(e),this.response=r}},vle=class extends ep{constructor(e,r,n,o){super(e),this.status=r,this.statusText=n,this.errorDetails=o}},JC=class extends ep{};Tcn="https://generativelanguage.googleapis.com",Acn="v1beta",Icn="0.21.0",Mcn="genai-js";(function(t){t.GENERATE_CONTENT="generateContent",t.STREAM_GENERATE_CONTENT="streamGenerateContent",t.COUNT_TOKENS="countTokens",t.EMBED_CONTENT="embedContent",t.BATCH_EMBED_CONTENTS="batchEmbedContents"})(LL||(LL={}));PFe=class{constructor(e,r,n,o,i){this.model=e,this.task=r,this.apiKey=n,this.stream=o,this.requestOptions=i}toString(){var e,r;let n=((e=this.requestOptions)===null||e===void 0?void 0:e.apiVersion)||Acn,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||Tcn}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};Bcn=[wK.RECITATION,wK.SAFETY,wK.LANGUAGE];$Bt=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;zBt=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],Zcn={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};UBt="SILENT_ERROR",TFe=class{constructor(e,r,n,o={}){this.model=r,this.params=n,this._requestOptions=o,this._history=[],this._sendPromise=Promise.resolve(),this._apiKey=e,n?.history&&(Ycn(n.history),this._history=n.history)}async getHistory(){return await this._sendPromise,this._history}async sendMessage(e,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=SK(e),c={safetySettings:(n=this.params)===null||n===void 0?void 0:n.safetySettings,generationConfig:(o=this.params)===null||o===void 0?void 0:o.generationConfig,tools:(i=this.params)===null||i===void 0?void 0:i.tools,toolConfig:(a=this.params)===null||a===void 0?void 0:a.toolConfig,systemInstruction:(s=this.params)===null||s===void 0?void 0:s.systemInstruction,cachedContent:(u=this.params)===null||u===void 0?void 0:u.cachedContent,contents:[...this._history,l]},d=Object.assign(Object.assign({},this._requestOptions),r),f;return this._sendPromise=this._sendPromise.then(()=>HBt(this._apiKey,this.model,c,d)).then(p=>{var m;if(p.response.candidates&&p.response.candidates.length>0){this._history.push(l);let h=Object.assign({parts:[],role:"model"},(m=p.response.candidates)===null||m===void 0?void 0:m[0].content);this._history.push(h)}else{let h=GM(p.response);h&&console.warn(`sendMessage() was unsuccessful. ${h}. Inspect response object for details.`)}f=p}),await this._sendPromise,f}async sendMessageStream(e,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=SK(e),c={safetySettings:(n=this.params)===null||n===void 0?void 0:n.safetySettings,generationConfig:(o=this.params)===null||o===void 0?void 0:o.generationConfig,tools:(i=this.params)===null||i===void 0?void 0:i.tools,toolConfig:(a=this.params)===null||a===void 0?void 0:a.toolConfig,systemInstruction:(s=this.params)===null||s===void 0?void 0:s.systemInstruction,cachedContent:(u=this.params)===null||u===void 0?void 0:u.cachedContent,contents:[...this._history,l]},d=Object.assign(Object.assign({},this._requestOptions),r),f=qBt(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(UBt)}).then(p=>p.response).then(p=>{if(p.candidates&&p.candidates.length>0){this._history.push(l);let m=Object.assign({},p.candidates[0].content);m.role||(m.role="model"),this._history.push(m)}else{let m=GM(p);m&&console.warn(`sendMessageStream() was unsuccessful. ${m}. Inspect response object for details.`)}}).catch(p=>{p.message!==UBt&&console.error(p)}),f}};wle=class{constructor(e,r,n={}){this.apiKey=e,this._requestOptions=n,r.model.includes("/")?this.model=r.model:this.model=`models/${r.model}`,this.generationConfig=r.generationConfig||{},this.safetySettings=r.safetySettings||[],this.tools=r.tools,this.toolConfig=r.toolConfig,this.systemInstruction=VBt(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(e,r={}){var n;let o=BBt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return HBt(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(n=this.cachedContent)===null||n===void 0?void 0:n.name},o),i)}async generateContentStream(e,r={}){var n;let o=BBt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return qBt(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(n=this.cachedContent)===null||n===void 0?void 0:n.name},o),i)}startChat(e){var r;return new TFe(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(r=this.cachedContent)===null||r===void 0?void 0:r.name},e),this._requestOptions)}async countTokens(e,r={}){let n=Gcn(e,{model:this.model,generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent}),o=Object.assign(Object.assign({},this._requestOptions),r);return Xcn(this.apiKey,this.model,n,o)}async embedContent(e,r={}){let n=Jcn(e),o=Object.assign(Object.assign({},this._requestOptions),r);return Qcn(this.apiKey,this.model,n,o)}async batchEmbedContents(e,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return edn(this.apiKey,this.model,e,n)}};FL=class{constructor(e){this.apiKey=e}getGenerativeModel(e,r){if(!e.model)throw new ep("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new wle(this.apiKey,e,r)}getGenerativeModelFromCachedContent(e,r,n){if(!e.name)throw new JC("Cached content must contain a `name` field.");if(!e.model)throw new JC("Cached content must contain a `model` field.");let o=["model","systemInstruction"];for(let a of o)if(r?.[a]&&e[a]&&r?.[a]!==e[a]){if(a==="model"){let s=r.model.startsWith("models/")?r.model.replace("models/",""):r.model,u=e.model.startsWith("models/")?e.model.replace("models/",""):e.model;if(s===u)continue}throw new JC(`Different value for "${a}" specified in modelParams (${r[a]}) and cachedContent (${e[a]})`)}let i=Object.assign(Object.assign({},r),{model:e.model,tools:e.tools,toolConfig:e.toolConfig,systemInstruction:e.systemInstruction,cachedContent:e});return new wle(this.apiKey,i,n)}}});var WBt=b(()=>{OE()});var kL=b(()=>{WBt()});function u2(t){if(typeof t=="object"&&t!==null){let e={...t};"additionalProperties"in e&&delete e.additionalProperties,"$schema"in e&&delete e.$schema;for(let r in e)r in e&&(Array.isArray(e[r])?e[r]=e[r].map(u2):typeof e[r]=="object"&&e[r]!==null&&(e[r]=u2(e[r])));return e}return t}function xle(t){let e=u2(ss(t)),{$schema:r,...n}=e;return n}function KBt(t){let e=u2(t),{$schema:r,...n}=e;return n}var Sle=b(()=>{Gg()});function tdn(t){let e=t._getType();return Qs.isInstance(t)?t.role:e==="tool"?e:t.name??e}function rdn(t){switch(t){case"ai":case"model":return"model";case"system":return"system";case"human":return"user";case"tool":case"function":return"function";default:throw new Error(`Unknown / unsupported author: ${t}`)}}function ndn(t){if("mimeType"in t&&"data"in t)return{inlineData:{mimeType:t.mimeType,data:t.data}};throw new Error("Invalid media content")}function odn(t,e){if(typeof t.content=="string"&&t.content!=="")return[{text:t.content}];let r=[],n=[],o=[];return"tool_calls"in t&&Array.isArray(t.tool_calls)&&t.tool_calls.length>0?r=t.tool_calls.map(i=>({functionCall:{name:i.name,args:i.args}})):t.getType()==="tool"&&t.name&&t.content?n=[{functionResponse:{name:t.name,response:t.content}}]:Array.isArray(t.content)&&(o=t.content.map(i=>{if(i.type==="text")return{text:i.text};if(i.type==="executableCode")return{executableCode:i.executableCode};if(i.type==="codeExecutionResult")return{codeExecutionResult:i.codeExecutionResult};if(i.type==="image_url"){if(!e)throw new Error("This model does not support images");let a;if(typeof i.image_url=="string")a=i.image_url;else if(typeof i.image_url=="object"&&"url"in i.image_url)a=i.image_url.url;else throw new Error("Please provide image as base64 encoded data URL");let[s,u]=a.split(",");if(!s.startsWith("data:"))throw new Error("Please provide image as base64 encoded data URL");let[l,c]=s.replace(/^data:/,"").split(";");if(c!=="base64")throw new Error("Please provide image as base64 encoded data URL");return{inlineData:{data:u,mimeType:l}}}else{if(i.type==="media")return ndn(i);if(i.type==="tool_use")return{functionCall:{name:i.name,args:i.input}}}throw new Error(`Unknown content type ${i.type}`)})),[...o,...r,...n]}function IFe(t,e,r=!1){return t.reduce((n,o,i)=>{if(!Hg(o))throw new Error("Unsupported message input");let a=tdn(o);if(a==="system"&&i!==0)throw new Error("System message should be the first one");let s=rdn(a),u=n.content[n.content.length];if(!n.mergeWithPreviousContent&&u&&u.role===s)throw new Error("Google Generative AI requires alternate messages between authors");let l=odn(o,e);if(n.mergeWithPreviousContent){let f=n.content[n.content.length-1];if(!f)throw new Error("There was a problem parsing your system message. Please try a prompt without one.");return f.parts.push(...l),{mergeWithPreviousContent:!1,content:n.content}}let c=s;(c==="function"||c==="system"&&!r)&&(c="user");let d={role:c,parts:l};return{mergeWithPreviousContent:a==="system"&&!r,content:[...n.content,d]}},{content:[],mergeWithPreviousContent:!1}).content}function GBt(t,e){if(!t.candidates||t.candidates.length===0||!t.candidates[0])return{generations:[],llmOutput:{filters:t.promptFeedback}};let r=t.functionCalls(),[n]=t.candidates,{content:o,...i}=n,a;o?.parts.length===1&&o.parts[0].text?a=o.parts[0].text:a=o.parts.map(l=>"text"in l?{type:"text",text:l.text}:"executableCode"in l?{type:"executableCode",executableCode:l.executableCode}:"codeExecutionResult"in l?{type:"codeExecutionResult",codeExecutionResult:l.codeExecutionResult}:l);let s="";return typeof a=="string"?s=a:"text"in a[0]&&(s=a[0].text),{generations:[{text:s,message:new Ln({content:a,tool_calls:r?.map(l=>({...l,type:"tool_call"})),additional_kwargs:{...i},usage_metadata:e?.usageMetadata}),generationInfo:i}]}}function JBt(t,e){if(!t.candidates||t.candidates.length===0)return null;let r=t.functionCalls(),[n]=t.candidates,{content:o,...i}=n,a;o?.parts&&o.parts.every(l=>"text"in l)?a=o.parts.map(l=>l.text).join(""):o.parts&&(a=o.parts.map(l=>"text"in l?{type:"text",text:l.text}:"executableCode"in l?{type:"executableCode",executableCode:l.executableCode}:"codeExecutionResult"in l?{type:"codeExecutionResult",codeExecutionResult:l.codeExecutionResult}:l));let s="";a&&typeof a=="string"?s=a:a&&typeof a=="object"&&"text"in a[0]&&(s=a[0].text);let u=[];return r&&u.push(...r.map(l=>({...l,args:JSON.stringify(l.args),index:e.index,type:"tool_call_chunk"}))),new co({text:s,message:new vr({content:a||"",name:o?o.role:void 0,tool_call_chunks:u,additional_kwargs:{},usage_metadata:e.usageMetadata}),generationInfo:i})}function ZBt(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(Kc(e)){let r=xle(e.schema);return{name:e.name,description:e.description,parameters:r}}return $d(e)?{name:e.function.name,description:e.function.description??"A function available to call.",parameters:KBt(e.function.parameters)}:e})}]}var MFe=b(()=>{Bs();Qf();sg();ag();Sle()});var EK,YBt=b(()=>{$b();EK=class extends Ij{static lc_name(){return"GoogleGenerativeAIToolsOutputParser"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","google_genai","output_parsers"]}),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnSingle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"zodSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){if(this.zodSchema===void 0)return e;let r=await this.zodSchema.safeParseAsync(e);if(r.success)return r.data;throw new Dh(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error.errors)}`,JSON.stringify(e,null,2))}async parseResult(e){let r=e.flatMap(i=>{let{message:a}=i;return!("tool_calls"in a)||!Array.isArray(a.tool_calls)?[]:a.tool_calls});if(r[0]===void 0)throw new Error("No parseable tool calls provided to GoogleGenerativeAIToolsOutputParser.");let[n]=r;return await this._validateResult(n.args)}}});function RFe(t,e){let r=idn(t),n=sdn(r,e);return{tools:r,toolConfig:n}}function idn(t){let e=[],r=[];return t.forEach(o=>{if(Kc(o)){let[i]=ZBt([o]);i.functionDeclarations&&e.push(...i.functionDeclarations)}else if($d(o)){let{functionDeclarations:i}=adn(o);if(i)e.push(...i);else throw new Error("Failed to convert OpenAI structured tool to GenerativeAI tool")}else r.push(o)}),r.find(o=>"functionDeclarations"in o)?r.map(o=>{if(e?.length>0&&"functionDeclarations"in o){let i={functionDeclarations:[...o.functionDeclarations||[],...e]};return e=[],i}return o}):[...r,...e.length>0?[{functionDeclarations:e}]:[]]}function adn(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:u2(t.function.parameters)}]}}function sdn(t,e){if(!t.length||!e)return;let{toolChoice:r,allowedFunctionNames:n}=e,o={any:DL.ANY,auto:DL.AUTO,none:DL.NONE};if(r&&["any","auto","none"].includes(r))return{functionCallingConfig:{mode:o[r]??"MODE_UNSPECIFIED",allowedFunctionNames:n}};if(typeof r=="string"||n)return{functionCallingConfig:{mode:DL.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var XBt=b(()=>{OK();sg();ag();MFe();Sle()});var Cle,QBt=b(()=>{OK();no();GC();Im();kL();Sle();MFe();YBt();XBt();Cle=class extends Au{static lc_name(){return"ChatGoogleGenerativeAI"}get lc_secrets(){return{apiKey:"GOOGLE_API_KEY"}}get lc_aliases(){return{apiKey:"google_api_key"}}get _isMultimodalModel(){return this.model.includes("vision")||this.model.startsWith("gemini-1.5")||this.model.startsWith("gemini-2")}constructor(e){if(super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","google_genai"]}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:"gemini-pro"}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gemini-pro"}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxOutputTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topK",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"safetySettings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"convertSystemMessageToHumanContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.modelName=e?.model?.replace(/^models\//,"")??e?.modelName?.replace(/^models\//,"")??this.model,this.model=this.modelName,this.maxOutputTokens=e?.maxOutputTokens??this.maxOutputTokens,this.maxOutputTokens&&this.maxOutputTokens<0)throw new Error("`maxOutputTokens` must be a positive integer");if(this.temperature=e?.temperature??this.temperature,this.temperature&&(this.temperature<0||this.temperature>1))throw new Error("`temperature` must be in the range of [0.0,1.0]");if(this.topP=e?.topP??this.topP,this.topP&&this.topP<0)throw new Error("`topP` must be a positive integer");if(this.topP&&this.topP>1)throw new Error("`topP` must be below 1.");if(this.topK=e?.topK??this.topK,this.topK&&this.topK<0)throw new Error("`topK` must be a positive integer");if(this.stopSequences=e?.stopSequences??this.stopSequences,this.apiKey=e?.apiKey??lt("GOOGLE_API_KEY"),!this.apiKey)throw new Error("Please set an API key for Google GenerativeAI in the environment variable GOOGLE_API_KEY or in the `apiKey` field of the ChatGoogleGenerativeAI constructor");if(this.safetySettings=e?.safetySettings??this.safetySettings,this.safetySettings&&this.safetySettings.length>0&&new Set(this.safetySettings.map(n=>n.category)).size!==this.safetySettings.length)throw new Error("The categories in `safetySettings` array must be unique");this.streaming=e?.streaming??this.streaming,this.client=new FL(this.apiKey).getGenerativeModel({model:this.model,safetySettings:this.safetySettings,generationConfig:{candidateCount:1,stopSequences:this.stopSequences,maxOutputTokens:this.maxOutputTokens,temperature:this.temperature,topP:this.topP,topK:this.topK,...e?.json?{responseMimeType:"application/json"}:{}}},{apiVersion:e?.apiVersion,baseUrl:e?.baseUrl}),this.streamUsage=e?.streamUsage??this.streamUsage}useCachedContent(e,r,n){this.apiKey&&(this.client=new FL(this.apiKey).getGenerativeModelFromCachedContent(e,r,n))}get useSystemInstruction(){return typeof this.convertSystemMessageToHumanContent=="boolean"?!this.convertSystemMessageToHumanContent:this.computeUseSystemInstruction}get computeUseSystemInstruction(){return this.modelName==="gemini-1.0-pro-001"||this.modelName.startsWith("gemini-pro-vision")||this.modelName.startsWith("gemini-1.0-pro-vision")?!1:this.modelName!=="gemini-pro"}getLsParams(e){return{ls_provider:"google_genai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:this.client.generationConfig.temperature,ls_max_tokens:this.client.generationConfig.maxOutputTokens,ls_stop:e.stop}}_combineLLMOutput(){return[]}_llmType(){return"googlegenerativeai"}bindTools(e,r){return this.bind({tools:RFe(e)?.tools,...r})}invocationParams(e){let r=e?.tools?.length?RFe(e.tools,{toolChoice:e.tool_choice,allowedFunctionNames:e.allowedFunctionNames}):void 0;return{...r?.tools?{tools:r.tools}:{},...r?.toolConfig?{toolConfig:r.toolConfig}:{}}}async _generate(e,r,n){let o=IFe(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[c]=o;this.client.systemInstruction=c,i=o.slice(1)}let a=this.invocationParams(r);if(this.streaming){let c={},d=this._streamResponseChunks(e,r,n),f={};for await(let m of d){let h=m.generationInfo?.completion??0;f[h]===void 0?f[h]=m:f[h]=f[h].concat(m)}return{generations:Object.entries(f).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),llmOutput:{estimatedTokenUsage:c}}}let s=await this.completionWithRetry({...a,contents:i}),u;if("usageMetadata"in s.response){let c=s.response.usageMetadata;u={input_tokens:c.promptTokenCount??0,output_tokens:c.candidatesTokenCount??0,total_tokens:c.totalTokenCount??0}}let l=GBt(s.response,{usageMetadata:u});return await n?.handleLLMNewToken(l.generations[0].text??""),l}async*_streamResponseChunks(e,r,n){let o=IFe(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[d]=o;this.client.systemInstruction=d,i=o.slice(1)}let s={...this.invocationParams(r),contents:i},u=await this.caller.callWithOptions({signal:r?.signal},async()=>{let{stream:d}=await this.client.generateContentStream(s);return d}),l,c=0;for await(let d of u){if("usageMetadata"in d&&this.streamUsage!==!1&&r.streamUsage!==!1){let p=d.usageMetadata;if(!l)l={input_tokens:p.promptTokenCount,output_tokens:p.candidatesTokenCount,total_tokens:p.totalTokenCount};else{let m=p.candidatesTokenCount-l.output_tokens;l={input_tokens:0,output_tokens:m,total_tokens:m}}}let f=JBt(d,{usageMetadata:l,index:c});c+=1,f&&(yield f,await n?.handleLLMNewToken(f.text??""))}}async completionWithRetry(e,r){return this.caller.callWithOptions({signal:r?.signal},async()=>{try{return await this.client.generateContent(e)}catch(n){throw n.message?.includes("400 Bad Request")&&(n.status=400),n}})}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw;if(i==="jsonMode")throw new Error('ChatGoogleGenerativeAI only supports "functionCalling" as a method.');let s=o??"extract",u,l;if(Av(n)){let m=xle(n);l=[{functionDeclarations:[{name:s,description:m.description??"A function available to call.",parameters:m}]}],u=new EK({returnSingle:!0,keyName:s,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(m=n,s=n.name):m={name:s,description:n.description??"",parameters:n},l=[{functionDeclarations:[m]}],u=new EK({returnSingle:!0,keyName:s})}let c=this.bind({tools:l,tool_choice:s});if(!a)return c.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let d=Fo.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=Fo.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return Fi.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}}});var Ole,ezt=b(()=>{OK();no();NP();Ry();Ole=class extends Wp{constructor(e){if(super(e??{}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:"embedding-001"}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"embedding-001"}),Object.defineProperty(this,"taskType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stripNewLines",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxBatchSize",{enumerable:!0,configurable:!0,writable:!0,value:100}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.modelName=e?.model?.replace(/^models\//,"")??e?.modelName?.replace(/^models\//,"")??this.modelName,this.model=this.modelName,this.taskType=e?.taskType??this.taskType,this.title=e?.title??this.title,this.title&&this.taskType!=="RETRIEVAL_DOCUMENT")throw new Error("title can only be sepcified with TaskType.RETRIEVAL_DOCUMENT");if(this.apiKey=e?.apiKey??lt("GOOGLE_API_KEY"),!this.apiKey)throw new Error("Please set an API key for Google GenerativeAI in the environmentb variable GOOGLE_API_KEY or in the `apiKey` field of the GoogleGenerativeAIEmbeddings constructor");this.client=new FL(this.apiKey).getGenerativeModel({model:this.model})}_convertToContent(e){return{content:{role:"user",parts:[{text:this.stripNewLines?e.replace(/\n/g," "):e}]},taskType:this.taskType,title:this.title}}async _embedQueryContent(e){let r=this._convertToContent(e);return(await this.client.embedContent(r)).embedding.values??[]}async _embedDocumentsContent(e){let r=Kp(e,this.maxBatchSize),n=r.map(a=>({requests:a.map(s=>this._convertToContent(s))}));return(await Promise.allSettled(n.map(a=>this.client.batchEmbedContents(a)))).flatMap((a,s)=>a.status==="fulfilled"?a.value.embeddings.map(u=>u.values||[]):Array(r[s].length).fill([]))}embedQuery(e){return this.caller.call(this._embedQueryContent.bind(this),e)}embedDocuments(e){return this.caller.call(this._embedDocumentsContent.bind(this),e)}}});var tzt=b(()=>{QBt();ezt()});var NFe=b(()=>{tzt()});function udn(t){return t&&DataView.prototype.isPrototypeOf(t)}function l2(t){if(typeof t!="string"&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||t==="")throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function DFe(t){return typeof t!="string"&&(t=String(t)),t}function LFe(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return Gp.iterable&&(e[Symbol.iterator]=function(){return e}),e}function bc(t){this.map={},t instanceof bc?t.forEach(function(e,r){this.append(r,e)},this):Array.isArray(t)?t.forEach(function(e){if(e.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function jFe(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function izt(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function ldn(t){var e=new FileReader,r=izt(e);return e.readAsArrayBuffer(t),r}function cdn(t){var e=new FileReader,r=izt(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8";return e.readAsText(t,o),r}function ddn(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}function nzt(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function azt(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:Gp.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:Gp.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:Gp.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():Gp.arrayBuffer&&Gp.blob&&udn(t)?(this._bodyArrayBuffer=nzt(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Gp.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||ozt(t))?this._bodyArrayBuffer=nzt(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof t=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):Gp.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},Gp.blob&&(this.blob=function(){var t=jFe(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=jFe(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(Gp.blob)return this.blob().then(ldn);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var t=jFe(this);if(t)return t;if(this._bodyBlob)return cdn(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(ddn(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},Gp.formData&&(this.formData=function(){return this.text().then(mdn)}),this.json=function(){return this.text().then(JSON.parse)},this}function pdn(t){var e=t.toUpperCase();return fdn.indexOf(e)>-1?e:t}function BL(t,e){if(!(this instanceof BL))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e=e||{};var r=e.body;if(t instanceof BL){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new bc(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!r&&t._bodyInit!=null&&(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new bc(e.headers)),this.method=pdn(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in zd){var i=new AbortController;return i.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(e.cache==="no-store"||e.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var o=/\?/;this.url+=(o.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}function mdn(t){var e=new FormData;return t.trim().split("&").forEach(function(r){if(r){var n=r.split("="),o=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(o),decodeURIComponent(i))}}),e}function hdn(t){var e=new bc,r=t.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(n){return n.indexOf(`
`)===0?n.substr(1,n.length):n}).forEach(function(n){var o=n.split(":"),i=o.shift().trim();if(i){var a=o.join(":").trim();try{e.append(i,a)}catch(s){console.warn("Response "+s.message)}}}),e}function ZC(t,e){if(!(this instanceof ZC))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=e.status===void 0?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText===void 0?"":""+e.statusText,this.headers=new bc(e.headers),this.url=e.url||"",this._initBody(t)}function szt(t,e){return new Promise(function(r,n){var o=new BL(t,e);if(o.signal&&o.signal.aborted)return n(new $L("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:hdn(i.getAllResponseHeaders()||"")};o.url.indexOf("file://")===0&&(i.status<200||i.status>599)?l.status=200:l.status=i.status,l.url="responseURL"in i?i.responseURL:l.headers.get("X-Request-URL");var c="response"in i?i.response:i.responseText;setTimeout(function(){r(new ZC(c,l))},0)},i.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},i.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request timed out"))},0)},i.onabort=function(){setTimeout(function(){n(new $L("Aborted","AbortError"))},0)};function s(l){try{return l===""&&zd.location.href?zd.location.href:l}catch{return l}}if(i.open(o.method,s(o.url),!0),o.credentials==="include"?i.withCredentials=!0:o.credentials==="omit"&&(i.withCredentials=!1),"responseType"in i&&(Gp.blob?i.responseType="blob":Gp.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof bc||zd.Headers&&e.headers instanceof zd.Headers)){var u=[];Object.getOwnPropertyNames(e.headers).forEach(function(l){u.push(l2(l)),i.setRequestHeader(l,DFe(e.headers[l]))}),o.headers.forEach(function(l,c){u.indexOf(c)===-1&&i.setRequestHeader(c,l)})}else o.headers.forEach(function(l,c){i.setRequestHeader(c,l)});o.signal&&(o.signal.addEventListener("abort",a),i.onreadystatechange=function(){i.readyState===4&&o.signal.removeEventListener("abort",a)}),i.send(typeof o._bodyInit>"u"?null:o._bodyInit)})}var zd,Gp,rzt,ozt,fdn,gdn,$L,uzt=b(()=>{zd=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},Gp={searchParams:"URLSearchParams"in zd,iterable:"Symbol"in zd&&"iterator"in Symbol,blob:"FileReader"in zd&&"Blob"in zd&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in zd,arrayBuffer:"ArrayBuffer"in zd};Gp.arrayBuffer&&(rzt=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],ozt=ArrayBuffer.isView||function(t){return t&&rzt.indexOf(Object.prototype.toString.call(t))>-1});bc.prototype.append=function(t,e){t=l2(t),e=DFe(e);var r=this.map[t];this.map[t]=r?r+", "+e:e};bc.prototype.delete=function(t){delete this.map[l2(t)]};bc.prototype.get=function(t){return t=l2(t),this.has(t)?this.map[t]:null};bc.prototype.has=function(t){return this.map.hasOwnProperty(l2(t))};bc.prototype.set=function(t,e){this.map[l2(t)]=DFe(e)};bc.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)};bc.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),LFe(t)};bc.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),LFe(t)};bc.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),LFe(t)};Gp.iterable&&(bc.prototype[Symbol.iterator]=bc.prototype.entries);fdn=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];BL.prototype.clone=function(){return new BL(this,{body:this._bodyInit})};azt.call(BL.prototype);azt.call(ZC.prototype);ZC.prototype.clone=function(){return new ZC(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new bc(this.headers),url:this.url})};ZC.error=function(){var t=new ZC(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};gdn=[301,302,303,307,308];ZC.redirect=function(t,e){if(gdn.indexOf(e)===-1)throw new RangeError("Invalid status code");return new ZC(null,{status:e,headers:{location:t}})};$L=zd.DOMException;try{new $L}catch{$L=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},$L.prototype=Object.create(Error.prototype),$L.prototype.constructor=$L}szt.polyfill=!0;zd.fetch||(zd.fetch=szt,zd.Headers=bc,zd.Request=BL,zd.Response=ZC)});function vdn(){if(typeof window<"u"&&window.navigator){let t=navigator;return"userAgentData"in t&&t.userAgentData?.platform?`${t.userAgentData.platform.toLowerCase()} Browser/${navigator.userAgent};`:navigator.platform?`${navigator.platform.toLowerCase()} Browser/${navigator.userAgent};`:`unknown Browser/${navigator.userAgent};`}else if(typeof process<"u")return`${process.arch} ${process.platform} Node.js/${process.version}`;return""}function wdn(t){if(t instanceof Headers){let e={};return t.forEach((r,n)=>{e[n]=r}),e}else return Array.isArray(t)?Object.fromEntries(t):t||{}}var ydn,czt,dzt,bdn,_dn,FFe,$Fe,BFe,zFe,UFe,lzt,c2,xdn,Sdn,Cdn,Odn,Edn,kFe,d2,xGo,Ele=b(()=>{uzt();ydn="0.5.14",czt="11434",dzt=`http://127.0.0.1:${czt}`,bdn=Object.defineProperty,_dn=(t,e,r)=>e in t?bdn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,FFe=(t,e,r)=>(_dn(t,typeof e!="symbol"?e+"":e,r),r),$Fe=class t extends Error{constructor(e,r){super(e),this.error=e,this.status_code=r,this.name="ResponseError",Error.captureStackTrace&&Error.captureStackTrace(this,t)}},BFe=class{constructor(e,r,n){FFe(this,"abortController"),FFe(this,"itr"),FFe(this,"doneCallback"),this.abortController=e,this.itr=r,this.doneCallback=n}abort(){this.abortController.abort()}async*[Symbol.asyncIterator](){for await(let e of this.itr){if("error"in e)throw new Error(e.error);if(yield e,e.done||e.status==="success"){this.doneCallback();return}}throw new Error("Did not receive done or success response in stream.")}},zFe=async t=>{if(t.ok)return;let e=`Error ${t.status}: ${t.statusText}`,r=null;if(t.headers.get("content-type")?.includes("application/json"))try{r=await t.json(),e=r.error||e}catch{console.log("Failed to parse error response as JSON")}else try{console.log("Getting text from response"),e=await t.text()||e}catch{console.log("Failed to get text from error response")}throw new $Fe(e,t.status)};UFe=async(t,e,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${ydn} (${vdn()})`};r.headers=wdn(r.headers);let o=Object.fromEntries(Object.entries(r.headers).filter(([i])=>!Object.keys(n).some(a=>a.toLowerCase()===i.toLowerCase())));return r.headers={...n,...o},t(e,r)},lzt=async(t,e,r)=>{let n=await UFe(t,e,{headers:r?.headers});return await zFe(n),n},c2=async(t,e,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await UFe(t,e,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await zFe(a),a},xdn=async(t,e,r,n)=>{let o=await UFe(t,e,{method:"DELETE",body:JSON.stringify(r),headers:n?.headers});return await zFe(o),o},Sdn=async function*(t){let e=new TextDecoder("utf-8"),r="",n=t.getReader();for(;;){let{done:o,value:i}=await n.read();if(o)break;r+=e.decode(i);let a=r.split(`
`);r=a.pop()??"";for(let s of a)try{yield JSON.parse(s)}catch{console.warn("invalid json: ",s)}}for(let o of r.split(`
`).filter(i=>i!==""))try{yield JSON.parse(o)}catch{console.warn("invalid json: ",o)}},Cdn=t=>{if(!t)return dzt;let e=t.includes("://");t.startsWith(":")&&(t=`http://127.0.0.1${t}`,e=!0),e||(t=`http://${t}`);let r=new URL(t),n=r.port;n||(e?n=r.protocol==="https:"?"443":"80":n=czt);let o=`${r.protocol}//${r.hostname}:${n}${r.pathname}`;return o.endsWith("/")&&(o=o.slice(0,-1)),o},Odn=Object.defineProperty,Edn=(t,e,r)=>e in t?Odn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kFe=(t,e,r)=>(Edn(t,typeof e!="symbol"?e+"":e,r),r),d2=class{constructor(e){kFe(this,"config"),kFe(this,"fetch"),kFe(this,"ongoingStreamedRequests",[]),this.config={host:"",headers:e?.headers},e?.proxy||(this.config.host=Cdn(e?.host??dzt)),this.fetch=e?.fetch??fetch}abort(){for(let e of this.ongoingStreamedRequests)e.abort();this.ongoingStreamedRequests.length=0}async processStreamableRequest(e,r){r.stream=r.stream??!1;let n=`${this.config.host}/api/${e}`;if(r.stream){let i=new AbortController,a=await c2(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=Sdn(a.body),u=new BFe(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await c2(this.fetch,n,r,{headers:this.config.headers})).json()}async encodeImage(e){if(typeof e!="string"){let r=new Uint8Array(e),n="",o=r.byteLength;for(let i=0;i<o;i++)n+=String.fromCharCode(r[i]);return btoa(n)}return e}async generate(e){return e.images&&(e.images=await Promise.all(e.images.map(this.encodeImage.bind(this)))),this.processStreamableRequest("generate",e)}async chat(e){if(e.messages)for(let r of e.messages)r.images&&(r.images=await Promise.all(r.images.map(this.encodeImage.bind(this))));return this.processStreamableRequest("chat",e)}async create(e){return this.processStreamableRequest("create",{...e})}async pull(e){return this.processStreamableRequest("pull",{name:e.model,stream:e.stream,insecure:e.insecure})}async push(e){return this.processStreamableRequest("push",{name:e.model,stream:e.stream,insecure:e.insecure})}async delete(e){return await xdn(this.fetch,`${this.config.host}/api/delete`,{name:e.model},{headers:this.config.headers}),{status:"success"}}async copy(e){return await c2(this.fetch,`${this.config.host}/api/copy`,{...e},{headers:this.config.headers}),{status:"success"}}async list(){return await(await lzt(this.fetch,`${this.config.host}/api/tags`,{headers:this.config.headers})).json()}async show(e){return await(await c2(this.fetch,`${this.config.host}/api/show`,{...e},{headers:this.config.headers})).json()}async embed(e){return await(await c2(this.fetch,`${this.config.host}/api/embed`,{...e},{headers:this.config.headers})).json()}async embeddings(e){return await(await c2(this.fetch,`${this.config.host}/api/embeddings`,{...e},{headers:this.config.headers})).json()}async ps(){return await(await lzt(this.fetch,`${this.config.host}/api/ps`,{headers:this.config.headers})).json()}},xGo=new d2});var fzt=b(()=>{Pv()});function pzt(t,e=0){return(Ud[t[e+0]]+Ud[t[e+1]]+Ud[t[e+2]]+Ud[t[e+3]]+"-"+Ud[t[e+4]]+Ud[t[e+5]]+"-"+Ud[t[e+6]]+Ud[t[e+7]]+"-"+Ud[t[e+8]]+Ud[t[e+9]]+"-"+Ud[t[e+10]]+Ud[t[e+11]]+Ud[t[e+12]]+Ud[t[e+13]]+Ud[t[e+14]]+Ud[t[e+15]]).toLowerCase()}var Ud,Ple,mzt=b(()=>{Ud=[];for(Ple=0;Ple<256;++Ple)Ud.push((Ple+256).toString(16).slice(1))});function qFe(){if(!Tle&&(Tle=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Tle))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Tle(Pdn)}var Tle,Pdn,hzt=b(()=>{Pdn=new Uint8Array(16)});var Tdn,HFe,gzt=b(()=>{Tdn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),HFe={randomUUID:Tdn}});function Adn(t,e,r){if(HFe.randomUUID&&!e&&!t)return HFe.randomUUID();t=t||{};var n=t.random||(t.rng||qFe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return pzt(n)}var VFe,yzt=b(()=>{gzt();hzt();mzt();VFe=Adn});var bzt=b(()=>{yzt()});function WFe(t,e){return new vr({content:t.content??"",tool_call_chunks:t.tool_calls?.map(r=>({name:r.function.name,args:JSON.stringify(r.function.arguments),type:"tool_call_chunk",index:0,id:VFe()})),response_metadata:e?.responseMetadata,usage_metadata:e?.usageMetadata})}function _zt(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function Idn(t){if(typeof t.content=="string")return[{role:"assistant",content:t.content}];let r=t.content.filter(o=>o.type==="text"&&typeof o.text=="string").map(o=>({role:"assistant",content:o.text})),n;if(t.content.find(o=>o.type==="tool_use")&&t.tool_calls?.length){let o=t.tool_calls?.map(i=>({id:i.id,type:"function",function:{name:i.name,arguments:i.args}}));o&&(n={role:"assistant",tool_calls:o,content:""})}else if(t.content.find(o=>o.type==="tool_use")&&!t.tool_calls?.length)throw new Error("'tool_use' content type is not supported without tool calls.");return[...r,...n?[n]:[]]}function Mdn(t){return typeof t.content=="string"?[{role:"user",content:t.content}]:t.content.map(e=>{if(e.type==="text")return{role:"user",content:e.text};if(e.type==="image_url"){if(typeof e.image_url=="string")return{role:"user",content:"",images:[_zt(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[_zt(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function Rdn(t){if(typeof t.content=="string")return[{role:"system",content:t.content}];if(t.content.every(e=>e.type==="text"&&typeof e.text=="string"))return t.content.map(e=>({role:"system",content:e.text}));throw new Error(`Unsupported content type(s): ${t.content.map(e=>e.type).join(", ")}`)}function Ndn(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function vzt(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return Mdn(e);if(e._getType()==="ai")return Idn(e);if(e._getType()==="system")return Rdn(e);if(e._getType()==="tool")return Ndn(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var wzt=b(()=>{Bs();bzt()});var Ale,xzt=b(()=>{Bs();GC();Ele();Qf();Bs();Im();sg();fzt();$b();kL();Gg();wzt();Ale=class extends Au{static lc_name(){return"ChatOllama"}constructor(e){super(e??{}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"llama3"}),Object.defineProperty(this,"numa",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numCtx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numBatch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numGpu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mainGpu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lowVram",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"f16Kv",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logitsAll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"vocabOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useMmap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useMlock",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"embeddingOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numThread",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numKeep",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"seed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numPredict",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topK",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tfsZ",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"typicalP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"repeatLastN",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"repeatPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mirostat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mirostatTau",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mirostatEta",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"penalizeNewline",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"format",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"checkOrPullModel",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:"http://127.0.0.1:11434"}),this.client=new d2({host:e?.baseUrl,headers:e?.headers}),this.baseUrl=e?.baseUrl??this.baseUrl,this.model=e?.model??this.model,this.numa=e?.numa,this.numCtx=e?.numCtx,this.numBatch=e?.numBatch,this.numGpu=e?.numGpu,this.mainGpu=e?.mainGpu,this.lowVram=e?.lowVram,this.f16Kv=e?.f16Kv,this.logitsAll=e?.logitsAll,this.vocabOnly=e?.vocabOnly,this.useMmap=e?.useMmap,this.useMlock=e?.useMlock,this.embeddingOnly=e?.embeddingOnly,this.numThread=e?.numThread,this.numKeep=e?.numKeep,this.seed=e?.seed,this.numPredict=e?.numPredict,this.topK=e?.topK,this.topP=e?.topP,this.tfsZ=e?.tfsZ,this.typicalP=e?.typicalP,this.repeatLastN=e?.repeatLastN,this.temperature=e?.temperature,this.repeatPenalty=e?.repeatPenalty,this.presencePenalty=e?.presencePenalty,this.frequencyPenalty=e?.frequencyPenalty,this.mirostat=e?.mirostat,this.mirostatTau=e?.mirostatTau,this.mirostatEta=e?.mirostatEta,this.penalizeNewline=e?.penalizeNewline,this.streaming=e?.streaming,this.format=e?.format,this.keepAlive=e?.keepAlive,this.checkOrPullModel=e?.checkOrPullModel??this.checkOrPullModel}_llmType(){return"ollama"}async pull(e,r){let{stream:n,insecure:o,logProgress:i}={stream:!0,...r};if(n)for await(let a of await this.client.pull({model:e,insecure:o,stream:n}))i&&console.log(a);else{let a=await this.client.pull({model:e,insecure:o});i&&console.log(a)}}bindTools(e,r){return this.bind({tools:e.map(n=>KC(n)),...r})}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"ollama",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.options?.temperature??void 0,ls_max_tokens:r.options?.num_predict??void 0,ls_stop:e.stop}}invocationParams(e){if(e?.tool_choice)throw new Error("Tool choice is not supported for ChatOllama.");return{model:this.model,format:e?.format??this.format,keep_alive:this.keepAlive,options:{numa:this.numa,num_ctx:this.numCtx,num_batch:this.numBatch,num_gpu:this.numGpu,main_gpu:this.mainGpu,low_vram:this.lowVram,f16_kv:this.f16Kv,logits_all:this.logitsAll,vocab_only:this.vocabOnly,use_mmap:this.useMmap,use_mlock:this.useMlock,embedding_only:this.embeddingOnly,num_thread:this.numThread,num_keep:this.numKeep,seed:this.seed,num_predict:this.numPredict,top_k:this.topK,top_p:this.topP,tfs_z:this.tfsZ,typical_p:this.typicalP,repeat_last_n:this.repeatLastN,temperature:this.temperature,repeat_penalty:this.repeatPenalty,presence_penalty:this.presencePenalty,frequency_penalty:this.frequencyPenalty,mirostat:this.mirostat,mirostat_tau:this.mirostatTau,mirostat_eta:this.mirostatEta,penalize_newline:this.penalizeNewline,stop:e?.stop},tools:e?.tools?.length?e.tools.map(r=>KC(r)):void 0}}async checkModelExistsOnMachine(e){let{models:r}=await this.client.list();return!!r.find(n=>n.name===e||n.name===`${e}:latest`)}async _generate(e,r,n){this.checkOrPullModel&&(await this.checkModelExistsOnMachine(this.model)||await this.pull(this.model,{logProgress:!0}));let o;for await(let a of this._streamResponseChunks(e,r,n))o?o=Dc(o,a.message):o=a.message;let i=new Ln({id:o?.id,content:o?.content??"",tool_calls:o?.tool_calls,response_metadata:o?.response_metadata,usage_metadata:o?.usage_metadata});return{generations:[{text:typeof i.content=="string"?i.content:"",message:i}]}}async*_streamResponseChunks(e,r,n){this.checkOrPullModel&&(await this.checkModelExistsOnMachine(this.model)||await this.pull(this.model,{logProgress:!0}));let o=this.invocationParams(r),i=vzt(e),a={input_tokens:0,output_tokens:0,total_tokens:0};if(o.tools&&o.tools.length>0){let l=await this.client.chat({...o,messages:i,stream:!1}),{message:c,...d}=l;return a.input_tokens+=d.prompt_eval_count??0,a.output_tokens+=d.eval_count??0,a.total_tokens=a.input_tokens+a.output_tokens,yield new co({text:c.content,message:WFe(c,{responseMetadata:d,usageMetadata:a})}),n?.handleLLMNewToken(c.content)}let s=await this.client.chat({...o,messages:i,stream:!0}),u;for await(let l of s){r.signal?.aborted&&this.client.abort();let{message:c,...d}=l;a.input_tokens+=d.prompt_eval_count??0,a.output_tokens+=d.eval_count??0,a.total_tokens=a.input_tokens+a.output_tokens,u=d,yield new co({text:c.content??"",message:WFe(c)}),await n?.handleLLMNewToken(c.content??"")}yield new co({text:"",message:new vr({content:"",response_metadata:u,usage_metadata:a})})}withStructuredOutput(e,r){if(r?.method===void 0||r?.method==="jsonSchema"){let n=Av(e),o=n?ss(e):e,i=this.bind({format:o}),a=n?Sd.fromZodSchema(e):new Cd;if(!r?.includeRaw)return i.pipe(a);let s=Fo.assign({parsed:(c,d)=>a.invoke(c.raw,d)}),u=Fo.assign({parsed:()=>null}),l=s.withFallbacks({fallbacks:[u]});return Fi.from([{raw:i},l])}else return super.withStructuredOutput(e,r)}}});var Ile,Szt=b(()=>{NP();Ele();Ile=class extends Wp{constructor(e){super({maxConcurrency:1,...e}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"mxbai-embed-large"}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:"http://localhost:11434"}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requestOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"truncate",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.client=new d2({host:e?.baseUrl,headers:e?.headers?new Headers(e.headers):void 0}),this.baseUrl=e?.baseUrl??this.baseUrl,this.model=e?.model??this.model,this.keepAlive=e?.keepAlive,this.truncate=e?.truncate??this.truncate,this.requestOptions=e?.requestOptions?this._convertOptions(e?.requestOptions):void 0}_convertOptions(e){let r={},n={embeddingOnly:"embedding_only",frequencyPenalty:"frequency_penalty",keepAlive:"keep_alive",logitsAll:"logits_all",lowVram:"low_vram",mainGpu:"main_gpu",mirostat:"mirostat",mirostatEta:"mirostat_eta",mirostatTau:"mirostat_tau",numBatch:"num_batch",numCtx:"num_ctx",numGpu:"num_gpu",numKeep:"num_keep",numPredict:"num_predict",numThread:"num_thread",penalizeNewline:"penalize_newline",presencePenalty:"presence_penalty",repeatLastN:"repeat_last_n",repeatPenalty:"repeat_penalty",temperature:"temperature",stop:"stop",tfsZ:"tfs_z",topK:"top_k",topP:"top_p",typicalP:"typical_p",useMlock:"use_mlock",useMmap:"use_mmap",vocabOnly:"vocab_only",f16Kv:"f16_kv",numa:"numa",seed:"seed"};for(let[o,i]of Object.entries(e)){let a=n[o];a?r[a]=i:r[o]=i}return r}async embedDocuments(e){return this.embeddingWithRetry(e)}async embedQuery(e){return(await this.embeddingWithRetry([e]))[0]}async embeddingWithRetry(e){return(await this.caller.call(()=>this.client.embed({model:this.model,input:e,keep_alive:this.keepAlive,options:this.requestOptions,truncate:this.truncate}))).embeddings}}});var Czt=b(()=>{});var Ozt=b(()=>{Qf();RL();Ele()});var Ezt=b(()=>{xzt();Szt();Czt();Ozt()});var KFe=b(()=>{Ezt()});function Xt(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function de(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var Ny=b(()=>{});var GFe,JFe=b(()=>{GFe=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return GFe=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))}});function PK(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var TK,Mle=b(()=>{TK=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)}});var ht,_c,zs,JM,YC,f2,p2,m2,h2,g2,y2,b2,_2,v2,w2,XC,QC=b(()=>{Mle();ht=class extends Error{},_c=class t extends ht{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.requestID=o?.get("x-request-id"),this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new JM({message:n,cause:TK(r)});let i=r?.error;return e===400?new f2(e,i,n,o):e===401?new p2(e,i,n,o):e===403?new m2(e,i,n,o):e===404?new h2(e,i,n,o):e===409?new g2(e,i,n,o):e===422?new y2(e,i,n,o):e===429?new b2(e,i,n,o):e>=500?new _2(e,i,n,o):new t(e,i,n,o)}},zs=class extends _c{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},JM=class extends _c{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},YC=class extends JM{constructor({message:e}={}){super({message:e??"Request timed out."})}},f2=class extends _c{},p2=class extends _c{},m2=class extends _c{},h2=class extends _c{},g2=class extends _c{},y2=class extends _c{},b2=class extends _c{},_2=class extends _c{},v2=class extends ht{constructor(){super("Could not parse response content as the length limit was reached")}},w2=class extends ht{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},XC=class extends Error{constructor(e){super(e)}}});function Tzt(t){return typeof t!="object"?{}:t??{}}function Azt(t){if(!t)return!0;for(let e in t)return!1;return!0}function Izt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function x2(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var Ddn,Pzt,tp,ZFe,Mzt,Rzt,jP=b(()=>{QC();Ddn=/^[a-z][a-z0-9+.-]*:/i,Pzt=t=>Ddn.test(t),tp=t=>(tp=Array.isArray,tp(t)),ZFe=tp;Mzt=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new ht(`${t} must be an integer`);if(e<0)throw new ht(`${t} must be a positive integer`);return e},Rzt=t=>{try{return JSON.parse(t)}catch{return}}});var eO,S2=b(()=>{eO=t=>new Promise(e=>setTimeout(e,t))});var ZM,YFe=b(()=>{ZM="5.12.1"});function Ldn(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}function kdn(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${o}.${i}.${a}`}}}return null}var Lzt,Fdn,Nzt,jzt,Dzt,Fzt,XFe=b(()=>{YFe();Lzt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";Fdn=()=>{let t=Ldn();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ZM,"X-Stainless-OS":jzt(Deno.build.os),"X-Stainless-Arch":Nzt(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ZM,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ZM,"X-Stainless-OS":jzt(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Nzt(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=kdn();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ZM,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ZM,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};Nzt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",jzt=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),Fzt=()=>Dzt??(Dzt=Fdn())});function kzt(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function QFe(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function Rle(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return QFe({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function eke(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function $zt(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var AK=b(()=>{});var Bzt,zzt=b(()=>{Bzt=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)})});var Nle,tke,jle,rke,Dle=b(()=>{Nle="RFC3986",tke=t=>String(t),jle={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:tke},rke="RFC1738"});function qzt(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function oke(t,e){if(tp(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var Lle,tO,nke,Uzt,Hzt=b(()=>{Dle();jP();Lle=(t,e)=>(Lle=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Lle(t,e)),tO=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),nke=1024,Uzt=(t,e,r,n,o)=>{if(t.length===0)return t;let i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(s){return"%26%23"+parseInt(s.slice(2),16)+"%3B"});let a="";for(let s=0;s<i.length;s+=nke){let u=i.length>=nke?i.slice(s,s+nke):i,l=[];for(let c=0;c<u.length;++c){let d=u.charCodeAt(c);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===rke&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=tO[d];continue}if(d<2048){l[l.length]=tO[192|d>>6]+tO[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=tO[224|d>>12]+tO[128|d>>6&63]+tO[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=tO[240|d>>18]+tO[128|d>>12&63]+tO[128|d>>6&63]+tO[128|d&63]}a+=l.join("")}return a}});function zdn(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function Gzt(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,y,g){let _=t,w=g,S=0,C=!1;for(;(w=w.get(ike))!==void 0&&!C;){let N=w.get(t);if(S+=1,typeof N<"u"){if(N===S)throw new RangeError("Cyclic object value");C=!0}typeof w.get(ike)>"u"&&(S=0)}if(typeof l=="function"?_=l(e,_):_ instanceof Date?_=f?.(_):r==="comma"&&tp(_)&&(_=oke(_,function(N){return N instanceof Date?f?.(N):N})),_===null){if(i)return u&&!h?u(e,vc.encoder,y,"key",p):e;_=""}if(zdn(_)||qzt(_)){if(u){let N=h?e:u(e,vc.encoder,y,"key",p);return[m?.(N)+"="+m?.(u(_,vc.encoder,y,"value",p))]}return[m?.(e)+"="+m?.(String(_))]}let E=[];if(typeof _>"u")return E;let P;if(r==="comma"&&tp(_))h&&u&&(_=oke(_,u)),P=[{value:_.length>0?_.join(",")||null:void 0}];else if(tp(l))P=l;else{let N=Object.keys(_);P=c?N.sort(c):N}let T=s?String(e).replace(/\./g,"%2E"):String(e),I=n&&tp(_)&&_.length===1?T+"[]":T;if(o&&tp(_)&&_.length===0)return I+"[]";for(let N=0;N<P.length;++N){let M=P[N],D=typeof M=="object"&&typeof M.value<"u"?M.value:_[M];if(a&&D===null)continue;let k=d&&s?M.replace(/\./g,"%2E"):M,L=tp(_)?typeof r=="function"?r(I,k):I:I+(d?"."+k:"["+k+"]");g.set(t,S);let H=new WeakMap;H.set(ike,g),Kzt(E,Gzt(D,L,r,n,o,i,a,s,r==="comma"&&h&&tp(_)?null:u,l,c,d,f,p,m,h,y,H))}return E}function Udn(t=vc){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||vc.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=Nle;if(typeof t.format<"u"){if(!Lle(jle,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=jle[r],o=vc.filter;(typeof t.filter=="function"||tp(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in Wzt?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=vc.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:vc.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:vc.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:vc.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:vc.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?vc.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:vc.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:vc.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:vc.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:vc.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:vc.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:vc.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:vc.strictNullHandling}}function ake(t,e={}){let r=t,n=Udn(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):tp(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=Wzt[n.arrayFormat],u=s==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);let l=new WeakMap;for(let f=0;f<o.length;++f){let p=o[f];n.skipNulls&&r[p]===null||Kzt(a,Gzt(r[p],p,s,u,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}let c=a.join(n.delimiter),d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),c.length>0?d+c:""}var Wzt,Kzt,Vzt,vc,ike,Jzt=b(()=>{Hzt();Dle();jP();Wzt={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},Kzt=function(t,e){Array.prototype.push.apply(t,tp(e)?e:[e])},vc={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Uzt,encodeValuesOnly:!1,format:Nle,formatter:tke,indices:!1,serializeDate(t){return(Vzt??(Vzt=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};ike={}});var Zzt=b(()=>{Dle();Jzt()});function Qzt(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}function C2(t){let e;return(Yzt??(e=new globalThis.TextEncoder,Yzt=e.encode.bind(e)))(t)}function ske(t){let e;return(Xzt??(e=new globalThis.TextDecoder,Xzt=e.decode.bind(e)))(t)}var Yzt,Xzt,Fle=b(()=>{});function Hdn(t,e){for(let o=e??0;o<t.length;o++){if(t[o]===10)return{preceding:o,index:o+1,carriage:!1};if(t[o]===13)return{preceding:o,index:o+1,carriage:!0}}return null}function eUt(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var ug,lg,zL,tUt=b(()=>{Ny();Fle();zL=class{constructor(){ug.set(this,void 0),lg.set(this,void 0),Xt(this,ug,new Uint8Array,"f"),Xt(this,lg,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?C2(e):e;Xt(this,ug,Qzt([de(this,ug,"f"),r]),"f");let n=[],o;for(;(o=Hdn(de(this,ug,"f"),de(this,lg,"f")))!=null;){if(o.carriage&&de(this,lg,"f")==null){Xt(this,lg,o.index,"f");continue}if(de(this,lg,"f")!=null&&(o.index!==de(this,lg,"f")+1||o.carriage)){n.push(ske(de(this,ug,"f").subarray(0,de(this,lg,"f")-1))),Xt(this,ug,de(this,ug,"f").subarray(de(this,lg,"f")),"f"),Xt(this,lg,null,"f");continue}let i=de(this,lg,"f")!==null?o.preceding-1:o.preceding,a=ske(de(this,ug,"f").subarray(0,i));n.push(a),Xt(this,ug,de(this,ug,"f").subarray(o.index),"f"),Xt(this,lg,null,"f")}return n}flush(){return de(this,ug,"f").length?this.decode(`
`):[]}};ug=new WeakMap,lg=new WeakMap;zL.NEWLINE_CHARS=new Set([`
`,"\r"]);zL.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function IK(){}function kle(t,e,r){return!e||$le[t]>$le[r]?IK:e[t].bind(e)}function fu(t){let e=t.logger,r=t.logLevel??"off";if(!e)return Vdn;let n=rUt.get(e);if(n&&n[0]===r)return n[1];let o={error:kle("error",e,r),warn:kle("warn",e,r),info:kle("info",e,r),debug:kle("debug",e,r)};return rUt.set(e,[r,o]),o}var $le,uke,Vdn,rUt,DP,MK=b(()=>{jP();$le={off:0,error:200,warn:300,info:400,debug:500},uke=(t,e,r)=>{if(t){if(Izt($le,t))return t;fu(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys($le))}`)}};Vdn={error:IK,warn:IK,info:IK,debug:IK},rUt=new WeakMap;DP=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t)});async function*Wdn(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new ht("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new ht("Attempted to iterate over a response with no body");let r=new lke,n=new zL,o=eke(t.body);for await(let i of Kdn(o))for(let a of n.decode(i)){let s=r.decode(a);s&&(yield s)}for(let i of n.flush()){let a=r.decode(i);a&&(yield a)}}async function*Kdn(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?C2(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=eUt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function Gdn(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var RK,rO,lke,cke=b(()=>{Ny();QC();AK();tUt();AK();Mle();Fle();MK();QC();rO=class t{constructor(e,r,n){this.iterator=e,RK.set(this,void 0),this.controller=r,Xt(this,RK,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?fu(n):console;async function*a(){if(o)throw new ht("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of Wdn(e,r))if(!s){if(u.data.startsWith("[DONE]")){s=!0;continue}if(u.event===null||!u.event.startsWith("thread.")){let l;try{l=JSON.parse(u.data)}catch(c){throw i.error("Could not parse message into JSON:",u.data),i.error("From chunk:",u.raw),c}if(l&&l.error)throw new _c(void 0,l.error,void 0,e.headers);yield l}else{let l;try{l=JSON.parse(u.data)}catch(c){throw console.error("Could not parse message into JSON:",u.data),console.error("From chunk:",u.raw),c}if(u.event=="error")throw new _c(void 0,l.error,l.message,void 0);yield{event:u.event,data:l}}}s=!0}catch(u){if(PK(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}static fromReadableStream(e,r,n){let o=!1;async function*i(){let s=new zL,u=eke(e);for await(let l of u)for(let c of s.decode(l))yield c;for(let l of s.flush())yield l}async function*a(){if(o)throw new ht("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of i())s||u&&(yield JSON.parse(u));s=!0}catch(u){if(PK(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}[(RK=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller,de(this,RK,"f")),new t(()=>o(r),this.controller,de(this,RK,"f"))]}toReadableStream(){let e=this,r;return QFe({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:o,done:i}=await r.next();if(i)return n.close();let a=C2(JSON.stringify(o)+`
`);n.enqueue(a)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};lke=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=Gdn(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function Ble(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,a=await(async()=>{if(e.options.stream)return fu(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):rO.fromSSEResponse(r,e.controller,t);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let u=r.headers.get("content-type")?.split(";")[0]?.trim();if(u?.includes("application/json")||u?.endsWith("+json")){let d=await r.json();return dke(d,r)}return await r.text()})();return fu(t).debug(`[${n}] response parsed`,DP({retryOfRequestLogID:o,url:r.url,status:r.status,body:a,durationMs:Date.now()-i})),a}function dke(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}var fke=b(()=>{cke();MK()});var NK,UL,zle=b(()=>{Ny();fke();UL=class t extends Promise{constructor(e,r,n=Ble){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,NK.set(this,void 0),Xt(this,NK,e,"f")}_thenUnwrap(e){return new t(de(this,NK,"f"),this.responsePromise,async(r,n)=>dke(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(de(this,NK,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};NK=new WeakMap});var Ule,qle,jK,nO,wn,Za=b(()=>{Ny();QC();fke();zle();jP();qle=class{constructor(e,r,n,o){Ule.set(this,void 0),Xt(this,Ule,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new ht("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await de(this,Ule,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Ule=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},jK=class extends UL{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await Ble(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},nO=class extends qle{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},wn=class extends qle{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.getPaginatedItems(),r=e[e.length-1]?.id;return r?{...this.options,query:{...Tzt(this.options.query),after:r}}:null}}});function O2(t,e,r){return mke(),new File(t,e??"unknown_file",r)}function DK(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}function Zdn(t){let e=typeof t=="function"?t:t.fetch,r=nUt.get(e);if(r)return r;let n=(async()=>{try{let o="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new o(i).text()}catch{return!0}})();return nUt.set(e,n),n}var mke,hke,cg,nUt,Ydn,Xdn,pke,LP=b(()=>{AK();mke=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};hke=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",cg=async(t,e)=>({...t,body:await Ydn(t.body,e)}),nUt=new WeakMap;Ydn=async(t,e)=>{if(!await Zdn(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>pke(r,n,o))),r},Xdn=t=>t instanceof Blob&&"name"in t,pke=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response)t.append(e,O2([await r.blob()],DK(r)));else if(hke(r))t.append(e,O2([await new Response(Rle(r)).blob()],DK(r)));else if(Xdn(r))t.append(e,r,DK(r));else if(Array.isArray(r))await Promise.all(r.map(n=>pke(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>pke(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}}});async function LK(t,e,r){if(mke(),t=await t,Qdn(t))return t instanceof File?t:O2([await t.arrayBuffer()],t.name);if(efn(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),O2(await gke(o),e,r)}let n=await gke(t);if(e||(e=DK(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return O2(n,e,r)}async function gke(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(oUt(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(hke(t))for await(let r of t)e.push(...await gke(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${tfn(t)}`)}return e}function tfn(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var oUt,Qdn,efn,iUt=b(()=>{LP();LP();oUt=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",Qdn=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&oUt(t),efn=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function"});var yke=b(()=>{iUt()});var $e,Mr=b(()=>{$e=class{constructor(e){this._client=e}}});function sUt(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var aUt,nfn,De,aa=b(()=>{QC();aUt=Object.freeze(Object.create(null)),nfn=(t=sUt)=>function(r,...n){if(r.length===1)return r[0];let o=!1,i=[],a=r.reduce((c,d,f)=>{/[?#]/.test(d)&&(o=!0);let p=n[f],m=(o?encodeURIComponent:t)(""+p);return f!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??aUt)??aUt)?.toString)&&(m=p+"",i.push({start:c.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),c+d+(f===n.length?"":m)},""),s=a.split(/[?#]/,1)[0],u=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,l;for(;(l=u.exec(s))!==null;)i.push({start:l.index,length:l[0].length,error:`Value "${l[0]}" can't be safely passed as a path parameter`});if(i.sort((c,d)=>c.start-d.start),i.length>0){let c=0,d=i.reduce((f,p)=>{let m=" ".repeat(p.start-c),h="^".repeat(p.length);return c=p.start+p.length,f+m+h},"");throw new ht(`Path parameters result in path with invalid segments:
${i.map(f=>f.error).join(`
`)}
${a}
${d}`)}return a},De=nfn(sUt)});var qL,Hle=b(()=>{Mr();Za();aa();qL=class extends $e{list(e,r={},n){return this._client.getAPIList(De`/chat/completions/${e}/messages`,wn,{query:r,...n})}}});var h_=b(()=>{QC()});function FK(t){return t!==void 0&&"function"in t&&t.function!==void 0}function uUt(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function kK(t){return t?.$brand==="auto-parseable-response-format"}function HL(t){return t?.$brand==="auto-parseable-tool"}function lUt(t,e){return!e||!bke(e)?{...t,choices:t.choices.map(r=>(dUt(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:$K(t,e)}function $K(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new v2;if(n.finish_reason==="content_filter")throw new w2;return dUt(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>sfn(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?afn(e,n.message.content):null}}});return{...t,choices:r}}function afn(t,e){return t.response_format?.type!=="json_schema"?null:t.response_format?.type==="json_schema"?"$parseRaw"in t.response_format?t.response_format.$parseRaw(e):JSON.parse(e):null}function sfn(t,e){let r=t.tools?.find(n=>FK(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:HL(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function cUt(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>FK(n)&&n.function?.name===e.function.name);return FK(r)&&(HL(r)||r?.function.strict||!1)}function bke(t){return kK(t.response_format)?!0:t.tools?.some(e=>HL(e)||e.type==="function"&&e.function.strict===!0)??!1}function dUt(t){for(let e of t||[])if(e.type!=="function")throw new ht(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function fUt(t){for(let e of t??[]){if(e.type!=="function")throw new ht(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new ht(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var E2=b(()=>{h_()});var P2,_ke,vke=b(()=>{P2=t=>t?.role==="assistant",_ke=t=>t?.role==="tool"});var wke,Vle,Wle,BK,zK,Kle,UK,FP,qK,Gle,Jle,T2,pUt,YM,Zle=b(()=>{Ny();h_();YM=class{constructor(){wke.add(this),this.controller=new AbortController,Vle.set(this,void 0),Wle.set(this,()=>{}),BK.set(this,()=>{}),zK.set(this,void 0),Kle.set(this,()=>{}),UK.set(this,()=>{}),FP.set(this,{}),qK.set(this,!1),Gle.set(this,!1),Jle.set(this,!1),T2.set(this,!1),Xt(this,Vle,new Promise((e,r)=>{Xt(this,Wle,e,"f"),Xt(this,BK,r,"f")}),"f"),Xt(this,zK,new Promise((e,r)=>{Xt(this,Kle,e,"f"),Xt(this,UK,r,"f")}),"f"),de(this,Vle,"f").catch(()=>{}),de(this,zK,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},de(this,wke,"m",pUt).bind(this))},0)}_connected(){this.ended||(de(this,Wle,"f").call(this),this._emit("connect"))}get ended(){return de(this,qK,"f")}get errored(){return de(this,Gle,"f")}get aborted(){return de(this,Jle,"f")}abort(){this.controller.abort()}on(e,r){return(de(this,FP,"f")[e]||(de(this,FP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=de(this,FP,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(de(this,FP,"f")[e]||(de(this,FP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Xt(this,T2,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Xt(this,T2,!0,"f"),await de(this,zK,"f")}_emit(e,...r){if(de(this,qK,"f"))return;e==="end"&&(Xt(this,qK,!0,"f"),de(this,Kle,"f").call(this));let n=de(this,FP,"f")[e];if(n&&(de(this,FP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!de(this,T2,"f")&&!n?.length&&Promise.reject(o),de(this,BK,"f").call(this,o),de(this,UK,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!de(this,T2,"f")&&!n?.length&&Promise.reject(o),de(this,BK,"f").call(this,o),de(this,UK,"f").call(this,o),this._emit("end")}}_emitFinal(){}};Vle=new WeakMap,Wle=new WeakMap,BK=new WeakMap,zK=new WeakMap,Kle=new WeakMap,UK=new WeakMap,FP=new WeakMap,qK=new WeakMap,Gle=new WeakMap,Jle=new WeakMap,T2=new WeakMap,wke=new WeakSet,pUt=function(e){if(Xt(this,Gle,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new zs),e instanceof zs)return Xt(this,Jle,!0,"f"),this._emit("abort",e);if(e instanceof ht)return this._emit("error",e);if(e instanceof Error){let r=new ht(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new ht(String(e)))}});function mUt(t){return typeof t.parse=="function"}var xke=b(()=>{});var Jp,Ske,Yle,Cke,Oke,Eke,hUt,gUt,ufn,A2,Pke=b(()=>{Ny();h_();E2();vke();Zle();xke();ufn=10,A2=class extends YM{constructor(){super(...arguments),Jp.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);let r=e.choices[0]?.message;return r&&this._addMessage(r),e}_addMessage(e,r=!0){if("content"in e||(e.content=null),this.messages.push(e),r){if(this._emit("message",e),_ke(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(P2(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionToolCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new ht("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),de(this,Jp,"m",Ske).call(this)}async finalMessage(){return await this.done(),de(this,Jp,"m",Yle).call(this)}async finalFunctionToolCall(){return await this.done(),de(this,Jp,"m",Cke).call(this)}async finalFunctionToolCallResult(){return await this.done(),de(this,Jp,"m",Oke).call(this)}async totalUsage(){return await this.done(),de(this,Jp,"m",Eke).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=de(this,Jp,"m",Yle).call(this);r&&this._emit("finalMessage",r);let n=de(this,Jp,"m",Ske).call(this);n&&this._emit("finalContent",n);let o=de(this,Jp,"m",Cke).call(this);o&&this._emit("finalFunctionToolCall",o);let i=de(this,Jp,"m",Oke).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",de(this,Jp,"m",Eke).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),de(this,Jp,"m",hUt).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion($K(i,r))}async _runChatCompletion(e,r,n){for(let o of r.messages)this._addMessage(o,!1);return await this._createChatCompletion(e,r,n)}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i.type==="function"&&i?.function?.name,{maxChatCompletions:l=ufn}=n||{},c=r.tools.map(p=>{if(HL(p)){if(!p.$callback)throw new ht("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of c)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?c.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;p<l;++p){let h=(await this._createChatCompletion(e,{...s,tool_choice:i,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!h)throw new ht("missing message in ChatCompletion response");if(!h.tool_calls?.length)return;for(let y of h.tool_calls){if(y.type!=="function")continue;let g=y.id,{name:_,arguments:w}=y.function,S=d[_];if(S){if(u&&u!==_){let T=`Invalid tool_call: ${JSON.stringify(_)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:g,content:T});continue}}else{let T=`Invalid tool_call: ${JSON.stringify(_)}. Available options are: ${Object.keys(d).map(I=>JSON.stringify(I)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:T});continue}let C;try{C=mUt(S)?await S.parse(w):w}catch(T){let I=T instanceof Error?T.message:String(T);this._addMessage({role:o,tool_call_id:g,content:I});continue}let E=await S.function(C,this),P=de(this,Jp,"m",gUt).call(this,E);if(this._addMessage({role:o,tool_call_id:g,content:P}),u)return}}}};Jp=new WeakSet,Ske=function(){return de(this,Jp,"m",Yle).call(this).content??null},Yle=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(P2(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new ht("stream ended without producing a ChatCompletionMessage with role=assistant")},Cke=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(P2(r)&&r?.tool_calls?.length)return r.tool_calls.filter(n=>n.type==="function").at(-1)?.function}},Oke=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(_ke(r)&&r.content!=null&&typeof r.content=="string"&&this.messages.some(n=>n.role==="assistant"&&n.tool_calls?.some(o=>o.type==="function"&&o.id===r.tool_call_id)))return r.content}},Eke=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:r}of this._chatCompletions)r&&(e.completion_tokens+=r.completion_tokens,e.prompt_tokens+=r.prompt_tokens,e.total_tokens+=r.total_tokens);return e},hUt=function(e){if(e.n!=null&&e.n>1)throw new ht("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},gUt=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var HK,Tke=b(()=>{Pke();vke();HK=class t extends A2{static runTools(e,r,n){let o=new t,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}_addMessage(e,r=!0){super._addMessage(e,r),P2(e)&&e.content&&this._emit("content",e.content)}}});function lfn(t,e=Gc.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return cfn(t.trim(),e)}var Gc,Ake,Ike,cfn,Mke,yUt=b(()=>{Gc={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511},Ake=class extends Error{},Ike=class extends Error{};cfn=(t,e)=>{let r=t.length,n=0,o=f=>{throw new Ake(`${f} at position ${n}`)},i=f=>{throw new Ike(`${f} at position ${n}`)},a=()=>(d(),n>=r&&o("Unexpected end of input"),t[n]==='"'?s():t[n]==="{"?u():t[n]==="["?l():t.substring(n,n+4)==="null"||Gc.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Gc.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Gc.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Gc.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Gc.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||Gc.NAN&e&&r-n<3&&"NaN".startsWith(t.substring(n))?(n+=3,NaN):c()),s=()=>{let f=n,p=!1;for(n++;n<r&&(t[n]!=='"'||p&&t[n-1]==="\\");)p=t[n]==="\\"?!p:!1,n++;if(t.charAt(n)=='"')try{return JSON.parse(t.substring(f,++n-Number(p)))}catch(m){i(String(m))}else if(Gc.STR&e)try{return JSON.parse(t.substring(f,n-Number(p))+'"')}catch{return JSON.parse(t.substring(f,t.lastIndexOf("\\"))+'"')}o("Unterminated string literal")},u=()=>{n++,d();let f={};try{for(;t[n]!=="}";){if(d(),n>=r&&Gc.OBJ&e)return f;let p=s();d(),n++;try{let m=a();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(Gc.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Gc.OBJ&e)return f;o("Expected '}' at end of object")}return n++,f},l=()=>{n++;let f=[];try{for(;t[n]!=="]";)f.push(a()),d(),t[n]===","&&n++}catch{if(Gc.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&Gc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Gc.NUM&e)try{return t[t.length-1]==="."?JSON.parse(t.substring(0,t.lastIndexOf("."))):JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch{}i(String(p))}}let f=n;for(t[n]==="-"&&n++;t[n]&&!",]}".includes(t[n]);)n++;n==r&&!(Gc.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Gc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;n<r&&`
\r `.includes(t[n]);)n++};return a()},Mke=t=>lfn(t,Gc.ALL^Gc.NUM)});var Rke=b(()=>{cke()});function dfn(t,e){let{id:r,choices:n,created:o,model:i,system_fingerprint:a,...s}=t,u={...s,id:r,choices:n.map(({message:l,finish_reason:c,index:d,logprobs:f,...p})=>{if(!c)throw new ht(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:y,...g}=l,_=l.role;if(!_)throw new ht(`missing role for choice ${d}`);if(h){let{arguments:w,name:S}=h;if(w==null)throw new ht(`missing function_call.arguments for choice ${d}`);if(!S)throw new ht(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:w,name:S},role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return y?{...p,index:d,finish_reason:c,logprobs:f,message:{...g,role:_,content:m,refusal:l.refusal??null,tool_calls:y.map((w,S)=>{let{function:C,type:E,id:P,...T}=w,{arguments:I,name:N,...M}=C||{};if(P==null)throw new ht(`missing choices[${d}].tool_calls[${S}].id
${ece(t)}`);if(E==null)throw new ht(`missing choices[${d}].tool_calls[${S}].type
${ece(t)}`);if(N==null)throw new ht(`missing choices[${d}].tool_calls[${S}].function.name
${ece(t)}`);if(I==null)throw new ht(`missing choices[${d}].tool_calls[${S}].function.arguments
${ece(t)}`);return{...T,id:P,type:E,function:{...M,name:N,arguments:I}}})}}:{...p,message:{...g,content:m,role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return lUt(u,e)}function ece(t){return JSON.stringify(t)}var wc,kP,I2,XM,Nke,Xle,jke,Dke,Lke,Qle,Fke,bUt,VL,tce=b(()=>{Ny();yUt();h_();E2();Rke();Pke();VL=class t extends A2{constructor(e){super(),wc.add(this),kP.set(this,void 0),I2.set(this,void 0),XM.set(this,void 0),Xt(this,kP,e,"f"),Xt(this,I2,[],"f")}get currentChatCompletionSnapshot(){return de(this,XM,"f")}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createChatCompletion(e,r,n){let o=new t(r);return o._run(()=>o._runChatCompletion(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(e,r,n){super._createChatCompletion;let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),de(this,wc,"m",Nke).call(this);let i=await e.chat.completions.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)de(this,wc,"m",jke).call(this,a);if(i.controller.signal?.aborted)throw new zs;return this._addChatCompletion(de(this,wc,"m",Qle).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),de(this,wc,"m",Nke).call(this),this._connected();let o=rO.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(de(this,wc,"m",Qle).call(this)),de(this,wc,"m",jke).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new zs;return this._addChatCompletion(de(this,wc,"m",Qle).call(this))}[(kP=new WeakMap,I2=new WeakMap,XM=new WeakMap,wc=new WeakSet,Nke=function(){this.ended||Xt(this,XM,void 0,"f")},Xle=function(r){let n=de(this,I2,"f")[r.index];return n||(n={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},de(this,I2,"f")[r.index]=n,n)},jke=function(r){if(this.ended)return;let n=de(this,wc,"m",bUt).call(this,r);this._emit("chunk",r,n);for(let o of r.choices){let i=n.choices[o.index];o.delta.content!=null&&i.message?.role==="assistant"&&i.message?.content&&(this._emit("content",o.delta.content,i.message.content),this._emit("content.delta",{delta:o.delta.content,snapshot:i.message.content,parsed:i.message.parsed})),o.delta.refusal!=null&&i.message?.role==="assistant"&&i.message?.refusal&&this._emit("refusal.delta",{delta:o.delta.refusal,snapshot:i.message.refusal}),o.logprobs?.content!=null&&i.message?.role==="assistant"&&this._emit("logprobs.content.delta",{content:o.logprobs?.content,snapshot:i.logprobs?.content??[]}),o.logprobs?.refusal!=null&&i.message?.role==="assistant"&&this._emit("logprobs.refusal.delta",{refusal:o.logprobs?.refusal,snapshot:i.logprobs?.refusal??[]});let a=de(this,wc,"m",Xle).call(this,i);i.finish_reason&&(de(this,wc,"m",Lke).call(this,i),a.current_tool_call_index!=null&&de(this,wc,"m",Dke).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(de(this,wc,"m",Lke).call(this,i),a.current_tool_call_index!=null&&de(this,wc,"m",Dke).call(this,i,a.current_tool_call_index)),a.current_tool_call_index=s.index;for(let s of o.delta.tool_calls??[]){let u=i.message.tool_calls?.[s.index];u?.type&&(u?.type==="function"?this._emit("tool_calls.function.arguments.delta",{name:u.function?.name,index:s.index,arguments:u.function.arguments,parsed_arguments:u.function.parsed_arguments,arguments_delta:s.function?.arguments??""}):(u?.type,void 0))}}},Dke=function(r,n){if(de(this,wc,"m",Xle).call(this,r).done_tool_calls.has(n))return;let i=r.message.tool_calls?.[n];if(!i)throw new Error("no tool call snapshot");if(!i.type)throw new Error("tool call snapshot missing `type`");if(i.type==="function"){let a=de(this,kP,"f")?.tools?.find(s=>FK(s)&&s.function.name===i.function.name);this._emit("tool_calls.function.arguments.done",{name:i.function.name,index:n,arguments:i.function.arguments,parsed_arguments:HL(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Lke=function(r){let n=de(this,wc,"m",Xle).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=de(this,wc,"m",Fke).call(this);this._emit("content.done",{content:r.message.content,parsed:o?o.$parseRaw(r.message.content):null})}r.message.refusal&&!n.refusal_done&&(n.refusal_done=!0,this._emit("refusal.done",{refusal:r.message.refusal})),r.logprobs?.content&&!n.logprobs_content_done&&(n.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:r.logprobs.content})),r.logprobs?.refusal&&!n.logprobs_refusal_done&&(n.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:r.logprobs.refusal}))},Qle=function(){if(this.ended)throw new ht("stream has ended, this shouldn't happen");let r=de(this,XM,"f");if(!r)throw new ht("request ended without sending any chunks");return Xt(this,XM,void 0,"f"),Xt(this,I2,[],"f"),dfn(r,de(this,kP,"f"))},Fke=function(){let r=de(this,kP,"f")?.response_format;return kK(r)?r:null},bUt=function(r){var n,o,i,a;let s=de(this,XM,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=Xt(this,XM,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=s.choices[f];if(h||(h=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:E,refusal:P,...T}=p;Object.assign(h.logprobs,T),E&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...E)),P&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...P))}if(d&&(h.finish_reason=d,de(this,kP,"f")&&bke(de(this,kP,"f")))){if(d==="length")throw new v2;if(d==="content_filter")throw new w2}if(Object.assign(h,m),!c)continue;let{content:y,refusal:g,function_call:_,role:w,tool_calls:S,...C}=c;if(Object.assign(h.message,C),g&&(h.message.refusal=(h.message.refusal||"")+g),w&&(h.message.role=w),_&&(h.message.function_call?(_.name&&(h.message.function_call.name=_.name),_.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=_.arguments)):h.message.function_call=_),y&&(h.message.content=(h.message.content||"")+y,!h.message.refusal&&de(this,wc,"m",Fke).call(this)&&(h.message.parsed=Mke(h.message.content))),S){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:E,id:P,type:T,function:I,...N}of S){let M=(a=h.message.tool_calls)[E]??(a[E]={});Object.assign(M,N),P&&(M.id=P),T&&(M.type=T),I&&(M.function??(M.function={name:I.name??"",arguments:""})),I?.name&&(M.function.name=I.name),I?.arguments&&(M.function.arguments+=I.arguments,cUt(de(this,kP,"f"),M)&&(M.function.parsed_arguments=Mke(M.function.arguments)))}}}return s},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("chunk",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new rO(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var VK,kke=b(()=>{tce();VK=class t extends VL{static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static runTools(e,r,n){let o=new t(r),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}}});var $P,WK=b(()=>{Mr();Hle();Hle();Za();aa();Tke();kke();tce();E2();kke();xke();tce();Tke();$P=class extends $e{constructor(){super(...arguments),this.messages=new qL(this._client)}create(e,r){return this._client.post("/chat/completions",{body:e,...r,stream:e.stream??!1})}retrieve(e,r){return this._client.get(De`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(De`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/chat/completions",wn,{query:e,...r})}delete(e,r){return this._client.delete(De`/chat/completions/${e}`,r)}parse(e,r){return fUt(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>$K(n,e))}runTools(e,r){return e.stream?VK.runTools(this._client,e,r):HK.runTools(this._client,e,r)}stream(e,r){return VL.createChatCompletion(this._client,e,r)}};$P.Messages=qL});var QM,$ke=b(()=>{Mr();WK();WK();QM=class extends $e{constructor(){super(...arguments),this.completions=new $P(this._client)}};QM.Completions=$P});var _Ut=b(()=>{WK();WK();Hle()});var vUt=b(()=>{$ke();_Ut()});var wUt=b(()=>{});function*pfn(t){if(!t)return;if(xUt in t){let{values:n,nulls:o}=t;yield*n.entries();for(let i of o)yield[i,null];return}let e=!1,r;t instanceof Headers?r=t.entries():ZFe(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let o=n[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let i=ZFe(n[1])?n[1]:[n[1]],a=!1;for(let s of i)s!==void 0&&(e&&!a&&(a=!0,yield[o,null]),yield[o,s])}}var xUt,mt,Iu=b(()=>{jP();xUt=Symbol("brand.privateNullableHeaders");mt=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,a]of pfn(n)){let s=i.toLowerCase();o.has(s)||(e.delete(i),o.add(s)),a===null?(e.delete(i),r.add(s)):(e.append(i,a),r.delete(s))}}return{[xUt]:!0,values:e,nulls:r}}});var M2,Bke=b(()=>{Mr();Iu();M2=class extends $e{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:mt([{Accept:"application/octet-stream"},r?.headers]),__binaryResponse:!0})}}});var R2,zke=b(()=>{Mr();LP();R2=class extends $e{create(e,r){return this._client.post("/audio/transcriptions",cg({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}}});var N2,Uke=b(()=>{Mr();LP();N2=class extends $e{create(e,r){return this._client.post("/audio/translations",cg({body:e,...r,__metadata:{model:e.model}},this._client))}}});var oO,qke=b(()=>{Mr();Bke();Bke();zke();zke();Uke();Uke();oO=class extends $e{constructor(){super(...arguments),this.transcriptions=new R2(this._client),this.translations=new N2(this._client),this.speech=new M2(this._client)}};oO.Transcriptions=R2;oO.Translations=N2;oO.Speech=M2});var WL,Hke=b(()=>{Mr();Za();aa();WL=class extends $e{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(De`/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/batches",wn,{query:e,...r})}cancel(e,r){return this._client.post(De`/batches/${e}/cancel`,r)}}});var j2,Vke=b(()=>{Mr();Za();Iu();aa();j2=class extends $e{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(De`/assistants/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(De`/assistants/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/assistants",wn,{query:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(De`/assistants/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var D2,Wke=b(()=>{Mr();Iu();D2=class extends $e{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var L2,Kke=b(()=>{Mr();Iu();L2=class extends $e{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var eR,Gke=b(()=>{Mr();Wke();Wke();Kke();Kke();eR=class extends $e{constructor(){super(...arguments),this.sessions=new D2(this._client),this.transcriptionSessions=new L2(this._client)}};eR.Sessions=D2;eR.TranscriptionSessions=L2});var F2,Jke=b(()=>{Mr();Za();Iu();aa();F2=class extends $e{create(e,r,n){return this._client.post(De`/threads/${e}/messages`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(De`/threads/${o}/messages/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(De`/threads/${o}/messages/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(De`/threads/${e}/messages`,wn,{query:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete(De`/threads/${o}/messages/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var k2,Zke=b(()=>{Mr();Za();Iu();aa();k2=class extends $e{retrieve(e,r,n){let{thread_id:o,run_id:i,...a}=r;return this._client.get(De`/threads/${o}/runs/${i}/steps/${e}`,{query:a,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r,n){let{thread_id:o,...i}=r;return this._client.getAPIList(De`/threads/${o}/runs/${e}/steps`,wn,{query:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var SUt,CUt=b(()=>{QC();Fle();SUt=t=>{if(typeof Buffer<"u"){let e=Buffer.from(t,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=e.charCodeAt(o);return Array.from(new Float32Array(n.buffer))}}});var g_,Yke=b(()=>{g_=t=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()}});var KK=b(()=>{jP();CUt();Yke();MK();JFe();S2()});var qd,GL,Xke,iO,rce,y_,JL,$2,KL,ice,dg,nce,oce,ZK,GK,JK,OUt,EUt,PUt,TUt,AUt,IUt,MUt,BP,Qke=b(()=>{Ny();Rke();h_();Zle();KK();BP=class extends YM{constructor(){super(...arguments),qd.add(this),Xke.set(this,[]),iO.set(this,{}),rce.set(this,{}),y_.set(this,void 0),JL.set(this,void 0),$2.set(this,void 0),KL.set(this,void 0),ice.set(this,void 0),dg.set(this,void 0),nce.set(this,void 0),oce.set(this,void 0),ZK.set(this,void 0)}[(Xke=new WeakMap,iO=new WeakMap,rce=new WeakMap,y_=new WeakMap,JL=new WeakMap,$2=new WeakMap,KL=new WeakMap,ice=new WeakMap,dg=new WeakMap,nce=new WeakMap,oce=new WeakMap,ZK=new WeakMap,qd=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new GL;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=rO.fromReadableStream(e,this.controller);for await(let i of o)de(this,qd,"m",GK).call(this,i);if(o.controller.signal?.aborted)throw new zs;return this._addRun(de(this,qd,"m",JK).call(this))}toReadableStream(){return new rO(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let i=new GL;return i._run(()=>i._runToolAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}async _createToolAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let a={...n,stream:!0},s=await e.submitToolOutputs(r,a,{...o,signal:this.controller.signal});this._connected();for await(let u of s)de(this,qd,"m",GK).call(this,u);if(s.controller.signal?.aborted)throw new zs;return this._addRun(de(this,qd,"m",JK).call(this))}static createThreadAssistantStream(e,r,n){let o=new GL;return o._run(()=>o._threadAssistantStream(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(e,r,n,o){let i=new GL;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return de(this,nce,"f")}currentRun(){return de(this,oce,"f")}currentMessageSnapshot(){return de(this,y_,"f")}currentRunStepSnapshot(){return de(this,ZK,"f")}async finalRunSteps(){return await this.done(),Object.values(de(this,iO,"f"))}async finalMessages(){return await this.done(),Object.values(de(this,rce,"f"))}async finalRun(){if(await this.done(),!de(this,JL,"f"))throw Error("Final run was not received.");return de(this,JL,"f")}async _createThreadAssistantStream(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));let i={...r,stream:!0},a=await e.createAndRun(i,{...n,signal:this.controller.signal});this._connected();for await(let s of a)de(this,qd,"m",GK).call(this,s);if(a.controller.signal?.aborted)throw new zs;return this._addRun(de(this,qd,"m",JK).call(this))}async _createAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let a={...n,stream:!0},s=await e.create(r,a,{...o,signal:this.controller.signal});this._connected();for await(let u of s)de(this,qd,"m",GK).call(this,u);if(s.controller.signal?.aborted)throw new zs;return this._addRun(de(this,qd,"m",JK).call(this))}static accumulateDelta(e,r){for(let[n,o]of Object.entries(r)){if(!e.hasOwnProperty(n)){e[n]=o;continue}let i=e[n];if(i==null){e[n]=o;continue}if(n==="index"||n==="type"){e[n]=o;continue}if(typeof i=="string"&&typeof o=="string")i+=o;else if(typeof i=="number"&&typeof o=="number")i+=o;else if(x2(i)&&x2(o))i=this.accumulateDelta(i,o);else if(Array.isArray(i)&&Array.isArray(o)){if(i.every(a=>typeof a=="string"||typeof a=="number")){i.push(...o);continue}for(let a of o){if(!x2(a))throw new Error(`Expected array delta entry to be an object but got: ${a}`);let s=a.index;if(s==null)throw console.error(a),new Error("Expected array delta entry to have an `index` property");if(typeof s!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${s}`);let u=i[s];u==null?i.push(a):i[s]=this.accumulateDelta(u,a)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${o}, accValue: ${i}`);e[n]=i}return e}_addRun(e){return e}async _threadAssistantStream(e,r,n){return await this._createThreadAssistantStream(r,e,n)}async _runAssistantStream(e,r,n,o){return await this._createAssistantStream(r,e,n,o)}async _runToolAssistantStream(e,r,n,o){return await this._createToolAssistantStream(r,e,n,o)}};GL=BP,GK=function(e){if(!this.ended)switch(Xt(this,nce,e,"f"),de(this,qd,"m",PUt).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":de(this,qd,"m",MUt).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":de(this,qd,"m",EUt).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":de(this,qd,"m",OUt).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},JK=function(){if(this.ended)throw new ht("stream has ended, this shouldn't happen");if(!de(this,JL,"f"))throw Error("Final run has not been received");return de(this,JL,"f")},OUt=function(e){let[r,n]=de(this,qd,"m",AUt).call(this,e,de(this,y_,"f"));Xt(this,y_,r,"f"),de(this,rce,"f")[r.id]=r;for(let o of n){let i=r.content[o.index];i?.type=="text"&&this._emit("textCreated",i.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,r),e.data.delta.content)for(let o of e.data.delta.content){if(o.type=="text"&&o.text){let i=o.text,a=r.content[o.index];if(a&&a.type=="text")this._emit("textDelta",i,a.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(o.index!=de(this,$2,"f")){if(de(this,KL,"f"))switch(de(this,KL,"f").type){case"text":this._emit("textDone",de(this,KL,"f").text,de(this,y_,"f"));break;case"image_file":this._emit("imageFileDone",de(this,KL,"f").image_file,de(this,y_,"f"));break}Xt(this,$2,o.index,"f")}Xt(this,KL,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(de(this,$2,"f")!==void 0){let o=e.data.content[de(this,$2,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,de(this,y_,"f"));break;case"text":this._emit("textDone",o.text,de(this,y_,"f"));break}}de(this,y_,"f")&&this._emit("messageDone",e.data),Xt(this,y_,void 0,"f")}},EUt=function(e){let r=de(this,qd,"m",TUt).call(this,e);switch(Xt(this,ZK,r,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let n=e.data.delta;if(n.step_details&&n.step_details.type=="tool_calls"&&n.step_details.tool_calls&&r.step_details.type=="tool_calls")for(let i of n.step_details.tool_calls)i.index==de(this,ice,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(de(this,dg,"f")&&this._emit("toolCallDone",de(this,dg,"f")),Xt(this,ice,i.index,"f"),Xt(this,dg,r.step_details.tool_calls[i.index],"f"),de(this,dg,"f")&&this._emit("toolCallCreated",de(this,dg,"f")));this._emit("runStepDelta",e.data.delta,r);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":Xt(this,ZK,void 0,"f"),e.data.step_details.type=="tool_calls"&&de(this,dg,"f")&&(this._emit("toolCallDone",de(this,dg,"f")),Xt(this,dg,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},PUt=function(e){de(this,Xke,"f").push(e),this._emit("event",e)},TUt=function(e){switch(e.event){case"thread.run.step.created":return de(this,iO,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=de(this,iO,"f")[e.data.id];if(!r)throw Error("Received a RunStepDelta before creation of a snapshot");let n=e.data;if(n.delta){let o=GL.accumulateDelta(r,n.delta);de(this,iO,"f")[e.data.id]=o}return de(this,iO,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":de(this,iO,"f")[e.data.id]=e.data;break}if(de(this,iO,"f")[e.data.id])return de(this,iO,"f")[e.data.id];throw new Error("No snapshot available")},AUt=function(e,r){let n=[];switch(e.event){case"thread.message.created":return[e.data,n];case"thread.message.delta":if(!r)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let o=e.data;if(o.delta.content)for(let i of o.delta.content)if(i.index in r.content){let a=r.content[i.index];r.content[i.index]=de(this,qd,"m",IUt).call(this,i,a)}else r.content[i.index]=i,n.push(i);return[r,n];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(r)return[r,n];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},IUt=function(e,r){return GL.accumulateDelta(r,e)},MUt=function(e){switch(Xt(this,oce,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":Xt(this,JL,e.data,"f"),de(this,dg,"f")&&(this._emit("toolCallDone",de(this,dg,"f")),Xt(this,dg,void 0,"f"));break;case"thread.run.cancelling":break}}});var ZL,e$e=b(()=>{Mr();Zke();Zke();Za();Iu();Qke();S2();aa();ZL=class extends $e{constructor(){super(...arguments),this.steps=new k2(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(De`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(De`/threads/${o}/runs/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(De`/threads/${o}/runs/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(De`/threads/${e}/runs`,wn,{query:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post(De`/threads/${o}/runs/${e}/cancel`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(o.id,{thread_id:e},n)}createAndStream(e,r,n){return BP.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o=mt([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:a}=await this.retrieve(e,r,{...n,headers:{...n?.headers,...o}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=a.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await eO(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return BP.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...i}=r;return this._client.post(De`/threads/${o}/runs/${e}/submit_tool_outputs`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}async submitToolOutputsAndPoll(e,r,n){let o=await this.submitToolOutputs(e,r,n);return await this.poll(o.id,r,n)}submitToolOutputsStream(e,r,n){return BP.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};ZL.Steps=k2});var tR,t$e=b(()=>{Mr();Jke();Jke();e$e();e$e();Iu();Qke();aa();tR=class extends $e{constructor(){super(...arguments),this.runs=new ZL(this._client),this.messages=new F2(this._client)}create(e={},r){return this._client.post("/threads",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(De`/threads/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(De`/threads/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r){return this._client.delete(De`/threads/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers]),stream:e.stream??!1})}async createAndRunPoll(e,r){let n=await this.createAndRun(e,r);return await this.runs.poll(n.id,{thread_id:n.thread_id},r)}createAndRunStream(e,r){return BP.createThreadAssistantStream(e,this._client.beta.threads,r)}};tR.Runs=ZL;tR.Messages=F2});var aO,r$e=b(()=>{Mr();Vke();Vke();Gke();Gke();t$e();t$e();aO=class extends $e{constructor(){super(...arguments),this.realtime=new eR(this._client),this.assistants=new j2(this._client),this.threads=new tR(this._client)}};aO.Realtime=eR;aO.Assistants=j2;aO.Threads=tR});var YL,n$e=b(()=>{Mr();YL=class extends $e{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var B2,o$e=b(()=>{Mr();Iu();aa();B2=class extends $e{retrieve(e,r,n){let{container_id:o}=r;return this._client.get(De`/containers/${o}/files/${e}/content`,{...n,headers:mt([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}}});var XL,i$e=b(()=>{Mr();o$e();o$e();Za();Iu();LP();aa();XL=class extends $e{constructor(){super(...arguments),this.content=new B2(this._client)}create(e,r,n){return this._client.post(De`/containers/${e}/files`,cg({body:r,...n},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get(De`/containers/${o}/files/${e}`,n)}list(e,r={},n){return this._client.getAPIList(De`/containers/${e}/files`,wn,{query:r,...n})}delete(e,r,n){let{container_id:o}=r;return this._client.delete(De`/containers/${o}/files/${e}`,{...n,headers:mt([{Accept:"*/*"},n?.headers])})}};XL.Content=B2});var rR,a$e=b(()=>{Mr();i$e();i$e();Za();Iu();aa();rR=class extends $e{constructor(){super(...arguments),this.files=new XL(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r})}retrieve(e,r){return this._client.get(De`/containers/${e}`,r)}list(e={},r){return this._client.getAPIList("/containers",wn,{query:e,...r})}delete(e,r){return this._client.delete(De`/containers/${e}`,{...r,headers:mt([{Accept:"*/*"},r?.headers])})}};rR.Files=XL});var QL,s$e=b(()=>{Mr();KK();QL=class extends $e{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&fu(this._client).debug("embeddings/user defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(fu(this._client).debug("embeddings/decoding base64 embeddings from base64"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=SUt(u)}),a)))}}});var z2,u$e=b(()=>{Mr();Za();aa();z2=class extends $e{retrieve(e,r,n){let{eval_id:o,run_id:i}=r;return this._client.get(De`/evals/${o}/runs/${i}/output_items/${e}`,n)}list(e,r,n){let{eval_id:o,...i}=r;return this._client.getAPIList(De`/evals/${o}/runs/${e}/output_items`,wn,{query:i,...n})}}});var eF,l$e=b(()=>{Mr();u$e();u$e();Za();aa();eF=class extends $e{constructor(){super(...arguments),this.outputItems=new z2(this._client)}create(e,r,n){return this._client.post(De`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get(De`/evals/${o}/runs/${e}`,n)}list(e,r={},n){return this._client.getAPIList(De`/evals/${e}/runs`,wn,{query:r,...n})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete(De`/evals/${o}/runs/${e}`,n)}cancel(e,r,n){let{eval_id:o}=r;return this._client.post(De`/evals/${o}/runs/${e}`,n)}};eF.OutputItems=z2});var nR,c$e=b(()=>{Mr();l$e();l$e();Za();aa();nR=class extends $e{constructor(){super(...arguments),this.runs=new eF(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(De`/evals/${e}`,r)}update(e,r,n){return this._client.post(De`/evals/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/evals",wn,{query:e,...r})}delete(e,r){return this._client.delete(De`/evals/${e}`,r)}};nR.Runs=eF});var tF,d$e=b(()=>{Mr();Za();Iu();S2();h_();LP();aa();tF=class extends $e{create(e,r){return this._client.post("/files",cg({body:e,...r},this._client))}retrieve(e,r){return this._client.get(De`/files/${e}`,r)}list(e={},r){return this._client.getAPIList("/files",wn,{query:e,...r})}delete(e,r){return this._client.delete(De`/files/${e}`,r)}content(e,r){return this._client.get(De`/files/${e}/content`,{...r,headers:mt([{Accept:"application/binary"},r?.headers]),__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:r=5e3,maxWait:n=30*60*1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),a=await this.retrieve(e);for(;!a.status||!o.has(a.status);)if(await eO(r),a=await this.retrieve(e),Date.now()-i>n)throw new YC({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}}});var U2,f$e=b(()=>{Mr();U2=class extends $e{}});var q2,p$e=b(()=>{Mr();q2=class extends $e{run(e,r){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...r})}validate(e,r){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...r})}}});var rF,m$e=b(()=>{Mr();p$e();p$e();rF=class extends $e{constructor(){super(...arguments),this.graders=new q2(this._client)}};rF.Graders=q2});var H2,h$e=b(()=>{Mr();Za();aa();H2=class extends $e{create(e,r,n){return this._client.getAPIList(De`/fine_tuning/checkpoints/${e}/permissions`,nO,{body:r,method:"post",...n})}retrieve(e,r={},n){return this._client.get(De`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete(De`/fine_tuning/checkpoints/${o}/permissions/${e}`,n)}}});var nF,g$e=b(()=>{Mr();h$e();h$e();nF=class extends $e{constructor(){super(...arguments),this.permissions=new H2(this._client)}};nF.Permissions=H2});var V2,y$e=b(()=>{Mr();Za();aa();V2=class extends $e{list(e,r={},n){return this._client.getAPIList(De`/fine_tuning/jobs/${e}/checkpoints`,wn,{query:r,...n})}}});var oF,b$e=b(()=>{Mr();y$e();y$e();Za();aa();oF=class extends $e{constructor(){super(...arguments),this.checkpoints=new V2(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(De`/fine_tuning/jobs/${e}`,r)}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",wn,{query:e,...r})}cancel(e,r){return this._client.post(De`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return this._client.getAPIList(De`/fine_tuning/jobs/${e}/events`,wn,{query:r,...n})}pause(e,r){return this._client.post(De`/fine_tuning/jobs/${e}/pause`,r)}resume(e,r){return this._client.post(De`/fine_tuning/jobs/${e}/resume`,r)}};oF.Checkpoints=V2});var b_,_$e=b(()=>{Mr();f$e();f$e();m$e();m$e();g$e();g$e();b$e();b$e();b_=class extends $e{constructor(){super(...arguments),this.methods=new U2(this._client),this.jobs=new oF(this._client),this.checkpoints=new nF(this._client),this.alpha=new rF(this._client)}};b_.Methods=U2;b_.Jobs=oF;b_.Checkpoints=nF;b_.Alpha=rF});var W2,v$e=b(()=>{Mr();W2=class extends $e{}});var oR,w$e=b(()=>{Mr();v$e();v$e();oR=class extends $e{constructor(){super(...arguments),this.graderModels=new W2(this._client)}};oR.GraderModels=W2});var iF,x$e=b(()=>{Mr();LP();iF=class extends $e{createVariation(e,r){return this._client.post("/images/variations",cg({body:e,...r},this._client))}edit(e,r){return this._client.post("/images/edits",cg({body:e,...r,stream:e.stream??!1},this._client))}generate(e,r){return this._client.post("/images/generations",{body:e,...r,stream:e.stream??!1})}}});var aF,S$e=b(()=>{Mr();Za();aa();aF=class extends $e{retrieve(e,r){return this._client.get(De`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",nO,e)}delete(e,r){return this._client.delete(De`/models/${e}`,r)}}});var sF,C$e=b(()=>{Mr();sF=class extends $e{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});function RUt(t,e){return!e||!kfn(e)?{...t,output_parsed:null,output:t.output.map(r=>r.type==="function_call"?{...r,parsed_arguments:null}:r.type==="message"?{...r,content:r.content.map(n=>({...n,parsed:null}))}:r)}:O$e(t,e)}function O$e(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:zfn(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:Ffn(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||ace(n),Object.defineProperty(n,"output_parsed",{enumerable:!0,get(){for(let o of n.output)if(o.type==="message"){for(let i of o.content)if(i.type==="output_text"&&i.parsed!==null)return i.parsed}return null}}),n}function Ffn(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function kfn(t){return!!kK(t.text?.format)}function $fn(t){return t?.$brand==="auto-parseable-tool"}function Bfn(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function zfn(t,e){let r=Bfn(t.tools??[],e.name);return{...e,...e,parsed_arguments:$fn(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function ace(t){let e=[];for(let r of t.output)if(r.type==="message")for(let n of r.content)n.type==="output_text"&&e.push(n.text);t.output_text=e.join("")}var sce=b(()=>{h_();E2()});function Ufn(t,e){return RUt(t,e)}var K2,uce,iR,lce,NUt,jUt,DUt,LUt,cce,FUt=b(()=>{Ny();h_();Zle();sce();cce=class t extends YM{constructor(e){super(),K2.add(this),uce.set(this,void 0),iR.set(this,void 0),lce.set(this,void 0),Xt(this,uce,e,"f")}static createResponse(e,r,n){let o=new t(r);return o._run(()=>o._createOrRetrieveResponse(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createOrRetrieveResponse(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),de(this,K2,"m",NUt).call(this);let i,a=null;"response_id"in r?(i=await e.responses.retrieve(r.response_id,{stream:!0},{...n,signal:this.controller.signal,stream:!0}),a=r.starting_after??null):i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal}),this._connected();for await(let s of i)de(this,K2,"m",jUt).call(this,s,a);if(i.controller.signal?.aborted)throw new zs;return de(this,K2,"m",DUt).call(this)}[(uce=new WeakMap,iR=new WeakMap,lce=new WeakMap,K2=new WeakSet,NUt=function(){this.ended||Xt(this,iR,void 0,"f")},jUt=function(r,n){if(this.ended)return;let o=(a,s)=>{(n==null||s.sequence_number>n)&&this._emit(a,s)},i=de(this,K2,"m",LUt).call(this,r);switch(o("event",r),r.type){case"response.output_text.delta":{let a=i.output[r.output_index];if(!a)throw new ht(`missing output at index ${r.output_index}`);if(a.type==="message"){let s=a.content[r.content_index];if(!s)throw new ht(`missing content at index ${r.content_index}`);if(s.type!=="output_text")throw new ht(`expected content to be 'output_text', got ${s.type}`);o("response.output_text.delta",{...r,snapshot:s.text})}break}case"response.function_call_arguments.delta":{let a=i.output[r.output_index];if(!a)throw new ht(`missing output at index ${r.output_index}`);a.type==="function_call"&&o("response.function_call_arguments.delta",{...r,snapshot:a.arguments});break}default:o(r.type,r);break}},DUt=function(){if(this.ended)throw new ht("stream has ended, this shouldn't happen");let r=de(this,iR,"f");if(!r)throw new ht("request ended without sending any events");Xt(this,iR,void 0,"f");let n=Ufn(r,de(this,uce,"f"));return Xt(this,lce,n,"f"),n},LUt=function(r){let n=de(this,iR,"f");if(!n){if(r.type!=="response.created")throw new ht(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=Xt(this,iR,r.response,"f"),n}switch(r.type){case"response.output_item.added":{n.output.push(r.item);break}case"response.content_part.added":{let o=n.output[r.output_index];if(!o)throw new ht(`missing output at index ${r.output_index}`);o.type==="message"&&o.content.push(r.part);break}case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new ht(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new ht(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new ht(`expected content to be 'output_text', got ${i.type}`);i.text+=r.delta}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new ht(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{Xt(this,iR,r.response,"f");break}}return n},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=de(this,lce,"f");if(!e)throw new ht("stream ended without producing a ChatCompletion");return e}}});var G2,E$e=b(()=>{Mr();Za();aa();G2=class extends $e{list(e,r={},n){return this._client.getAPIList(De`/responses/${e}/input_items`,wn,{query:r,...n})}}});var aR,P$e=b(()=>{sce();FUt();Mr();E$e();E$e();Iu();aa();aR=class extends $e{constructor(){super(...arguments),this.inputItems=new G2(this._client)}create(e,r){return this._client.post("/responses",{body:e,...r,stream:e.stream??!1})._thenUnwrap(n=>("object"in n&&n.object==="response"&&ace(n),n))}retrieve(e,r={},n){return this._client.get(De`/responses/${e}`,{query:r,...n,stream:r?.stream??!1})._thenUnwrap(o=>("object"in o&&o.object==="response"&&ace(o),o))}delete(e,r){return this._client.delete(De`/responses/${e}`,{...r,headers:mt([{Accept:"*/*"},r?.headers])})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>O$e(n,e))}stream(e,r){return cce.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(De`/responses/${e}/cancel`,r)}};aR.InputItems=G2});var J2,T$e=b(()=>{Mr();LP();aa();J2=class extends $e{create(e,r,n){return this._client.post(De`/uploads/${e}/parts`,cg({body:r,...n},this._client))}}});var sR,A$e=b(()=>{Mr();T$e();T$e();aa();sR=class extends $e{constructor(){super(...arguments),this.parts=new J2(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(De`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(De`/uploads/${e}/complete`,{body:r,...n})}};sR.Parts=J2});var kUt,$Ut=b(()=>{kUt=async t=>{let e=await Promise.allSettled(t),r=e.filter(o=>o.status==="rejected");if(r.length){for(let o of r)console.error(o.reason);throw new Error(`${r.length} promise(s) failed - see the above errors`)}let n=[];for(let o of e)o.status==="fulfilled"&&n.push(o.value);return n}});var Z2,I$e=b(()=>{Mr();Za();Iu();S2();$Ut();aa();Z2=class extends $e{create(e,r,n){return this._client.post(De`/vector_stores/${e}/file_batches`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(De`/vector_stores/${o}/file_batches/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{vector_store_id:o}=r;return this._client.post(De`/vector_stores/${o}/file_batches/${e}/cancel`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r);return await this.poll(e,o.id,n)}listFiles(e,r,n){let{vector_store_id:o,...i}=r;return this._client.getAPIList(De`/vector_stores/${o}/file_batches/${e}/files`,wn,{query:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async poll(e,r,n){let o=mt([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:a}=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse();switch(i.status){case"in_progress":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=a.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await eO(s);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,a=Math.min(i,r.length),s=this._client,u=r.values(),l=[...n];async function c(f){for(let p of f){let m=await s.files.create({file:p,purpose:"assistants"},o);l.push(m.id)}}let d=Array(a).fill(u).map(c);return await kUt(d),await this.createAndPoll(e,{file_ids:l})}}});var Y2,M$e=b(()=>{Mr();Za();Iu();KK();aa();Y2=class extends $e{create(e,r,n){return this._client.post(De`/vector_stores/${e}/files`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(De`/vector_stores/${o}/files/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{vector_store_id:o,...i}=r;return this._client.post(De`/vector_stores/${o}/files/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(De`/vector_stores/${e}/files`,wn,{query:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{vector_store_id:o}=r;return this._client.delete(De`/vector_stores/${o}/files/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(e,o.id,n)}async poll(e,r,n){let o=mt([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let i=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse(),a=i.data;switch(a.status){case"in_progress":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=i.response.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await eO(s);break;case"failed":case"completed":return a}}}async upload(e,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(e,{file_id:o.id},n)}async uploadAndPoll(e,r,n){let o=await this.upload(e,r,n);return await this.poll(e,o.id,n)}content(e,r,n){let{vector_store_id:o}=r;return this._client.getAPIList(De`/vector_stores/${o}/files/${e}/content`,nO,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var zP,R$e=b(()=>{Mr();I$e();I$e();M$e();M$e();Za();Iu();aa();zP=class extends $e{constructor(){super(...arguments),this.files=new Y2(this._client),this.fileBatches=new Z2(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(De`/vector_stores/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(De`/vector_stores/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/vector_stores",wn,{query:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(De`/vector_stores/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}search(e,r,n){return this._client.getAPIList(De`/vector_stores/${e}/search`,nO,{body:r,method:"post",...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};zP.Files=Y2;zP.FileBatches=Z2});var X2,BUt,dce,uF,N$e=b(()=>{Ny();h_();Mr();Iu();uF=class extends $e{constructor(){super(...arguments),X2.add(this)}async unwrap(e,r,n=this._client.webhookSecret,o=300){return await this.verifySignature(e,r,n,o),JSON.parse(e)}async verifySignature(e,r,n=this._client.webhookSecret,o=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");de(this,X2,"m",BUt).call(this,n);let i=mt([r]).values,a=de(this,X2,"m",dce).call(this,i,"webhook-signature"),s=de(this,X2,"m",dce).call(this,i,"webhook-timestamp"),u=de(this,X2,"m",dce).call(this,i,"webhook-id"),l=parseInt(s,10);if(isNaN(l))throw new XC("Invalid webhook timestamp format");let c=Math.floor(Date.now()/1e3);if(c-l>o)throw new XC("Webhook timestamp is too old");if(l>c+o)throw new XC("Webhook timestamp is too new");let d=a.split(" ").map(h=>h.startsWith("v1,")?h.substring(3):h),f=n.startsWith("whsec_")?Buffer.from(n.replace("whsec_",""),"base64"):Buffer.from(n,"utf-8"),p=u?`${u}.${s}.${e}`:`${s}.${e}`,m=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let h of d)try{let y=Buffer.from(h,"base64");if(await crypto.subtle.verify("HMAC",m,y,new TextEncoder().encode(p)))return}catch{continue}throw new XC("The given webhook signature does not match the expected signature")}};X2=new WeakSet,BUt=function(e){if(typeof e!="string"||e.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},dce=function(e,r){if(!e)throw new Error("Headers are required");let n=e.get(r);if(n==null)throw new Error(`Missing required header: ${r}`);return n}});var zUt=b(()=>{vUt();wUt();qke();Hke();r$e();n$e();a$e();s$e();c$e();d$e();_$e();w$e();x$e();S$e();C$e();P$e();A$e();R$e();N$e()});var j$e,D$e,fce,UUt,xr,pce=b(()=>{Ny();JFe();jP();S2();Mle();XFe();AK();zzt();Zzt();YFe();QC();Za();yke();zUt();zle();Hke();n$e();s$e();d$e();x$e();S$e();C$e();N$e();qke();r$e();$ke();a$e();c$e();_$e();w$e();P$e();A$e();R$e();XFe();Iu();Yke();MK();jP();xr=class{constructor({baseURL:e=g_("OPENAI_BASE_URL"),apiKey:r=g_("OPENAI_API_KEY"),organization:n=g_("OPENAI_ORG_ID")??null,project:o=g_("OPENAI_PROJECT_ID")??null,webhookSecret:i=g_("OPENAI_WEBHOOK_SECRET")??null,...a}={}){if(j$e.add(this),fce.set(this,void 0),this.completions=new YL(this),this.chat=new QM(this),this.embeddings=new QL(this),this.files=new tF(this),this.images=new iF(this),this.audio=new oO(this),this.moderations=new sF(this),this.models=new aF(this),this.fineTuning=new b_(this),this.graders=new oR(this),this.vectorStores=new zP(this),this.webhooks=new uF(this),this.beta=new aO(this),this.batches=new WL(this),this.uploads=new sR(this),this.responses=new aR(this),this.evals=new nR(this),this.containers=new rR(this),r===void 0)throw new ht("The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).");let s={apiKey:r,organization:n,project:o,webhookSecret:i,...a,baseURL:e||"https://api.openai.com/v1"};if(!s.dangerouslyAllowBrowser&&Lzt())throw new ht(`It looks like you're running in a browser-like environment.
This is disabled by default, as it risks exposing your secret API credentials to attackers.
If you understand the risks and have appropriate mitigations in place,
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
`);this.baseURL=s.baseURL,this.timeout=s.timeout??D$e.DEFAULT_TIMEOUT,this.logger=s.logger??console;let u="warn";this.logLevel=u,this.logLevel=uke(s.logLevel,"ClientOptions.logLevel",this)??uke(g_("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??u,this.fetchOptions=s.fetchOptions,this.maxRetries=s.maxRetries??2,this.fetch=s.fetch??kzt(),Xt(this,fce,Bzt,"f"),this._options=s,this.apiKey=r,this.organization=n,this.project=o,this.webhookSecret=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){}async authHeaders(e){return mt([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return ake(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${ZM}`}defaultIdempotencyKey(){return`stainless-node-retry-${GFe()}`}makeStatusError(e,r,n,o){return _c.generate(e,r,n,o)}buildURL(e,r,n){let o=!de(this,j$e,"m",UUt).call(this)&&n||this.baseURL,i=Pzt(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return Azt(a)||(r={...a,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(i.search=this.stringifyQuery(r)),i.toString()}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(o=>({method:e,path:r,...o})))}request(e,r=null){return new UL(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let o=await e,i=o.maxRetries??this.maxRetries;r==null&&(r=i),await this.prepareOptions(o);let{req:a,url:s,timeout:u}=await this.buildRequest(o,{retryCount:i-r});await this.prepareRequest(a,{url:s,options:o});let l="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),c=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if(fu(this).debug(`[${l}] sending request`,DP({retryOfRequestLogID:n,method:o.method,url:s,options:o,headers:a.headers})),o.signal?.aborted)throw new zs;let f=new AbortController,p=await this.fetchWithTimeout(s,a,u,f).catch(TK),m=Date.now();if(p instanceof Error){let g=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new zs;let _=PK(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return fu(this).info(`[${l}] connection ${_?"timed out":"failed"} - ${g}`),fu(this).debug(`[${l}] connection ${_?"timed out":"failed"} (${g})`,DP({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??l);throw fu(this).info(`[${l}] connection ${_?"timed out":"failed"} - error; no more retries left`),fu(this).debug(`[${l}] connection ${_?"timed out":"failed"} (error; no more retries left)`,DP({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),_?new YC:new JM({cause:p})}let h=[...p.headers.entries()].filter(([g])=>g==="x-request-id").map(([g,_])=>", "+g+": "+JSON.stringify(_)).join(""),y=`[${l}${c}${h}] ${a.method} ${s} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${m-d}ms`;if(!p.ok){let g=await this.shouldRetry(p);if(r&&g){let P=`retrying, ${r} attempts remaining`;return await $zt(p.body),fu(this).info(`${y} - ${P}`),fu(this).debug(`[${l}] response error (${P})`,DP({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),this.retryRequest(o,r,n??l,p.headers)}let _=g?"error; no more retries left":"error; not retryable";fu(this).info(`${y} - ${_}`);let w=await p.text().catch(P=>TK(P).message),S=Rzt(w),C=S?void 0:w;throw fu(this).debug(`[${l}] response error (${_})`,DP({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:C,durationMs:Date.now()-d})),this.makeStatusError(p.status,S,C,p.headers)}return fu(this).info(y),fu(this).debug(`[${l}] response start`,DP({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),{response:p,options:o,controller:f,requestLogID:l,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new jK(this,n,e)}async fetchWithTimeout(e,r,n,o){let{signal:i,method:a,...s}=r||{};i&&i.addEventListener("abort",()=>o.abort());let u=setTimeout(()=>o.abort(),n),l=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body=="object"&&s.body!==null&&Symbol.asyncIterator in s.body,c={signal:o.signal,...l?{duplex:"half"}:{},method:"GET",...s};a&&(c.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,c)}finally{clearTimeout(u)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,o){let i,a=o?.get("retry-after-ms");if(a){let u=parseFloat(a);Number.isNaN(u)||(i=u)}let s=o?.get("retry-after");if(s&&!i){let u=parseFloat(s);Number.isNaN(u)?i=Date.parse(s)-Date.now():i=u*1e3}if(!(i&&0<=i&&i<60*1e3)){let u=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(r,u)}return await eO(i),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:a,defaultBaseURL:s}=n,u=this.buildURL(i,a,s);"timeout"in n&&Mzt("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:l,body:c}=this.buildBody({options:n}),d=await this.buildHeaders({options:e,method:o,bodyHeaders:l,retryCount:r});return{req:{method:o,headers:d,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&c instanceof globalThis.ReadableStream&&{duplex:"half"},...c&&{body:c},...this.fetchOptions??{},...n.fetchOptions??{}},url:u,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:o}){let i={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let a=mt([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...Fzt(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=mt([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:Rle(e)}:de(this,fce,"f").call(this,{body:e,headers:n})}};D$e=xr,fce=new WeakMap,j$e=new WeakSet,UUt=function(){return this.baseURL!=="https://api.openai.com/v1"};xr.OpenAI=D$e;xr.DEFAULT_TIMEOUT=6e5;xr.OpenAIError=ht;xr.APIError=_c;xr.APIConnectionError=JM;xr.APIConnectionTimeoutError=YC;xr.APIUserAbortError=zs;xr.NotFoundError=h2;xr.ConflictError=g2;xr.RateLimitError=b2;xr.BadRequestError=f2;xr.AuthenticationError=p2;xr.InternalServerError=_2;xr.PermissionDeniedError=m2;xr.UnprocessableEntityError=y2;xr.InvalidWebhookSignatureError=XC;xr.toFile=LK;xr.Completions=YL;xr.Chat=QM;xr.Embeddings=QL;xr.Files=tF;xr.Images=iF;xr.Audio=oO;xr.Moderations=sF;xr.Models=aF;xr.FineTuning=b_;xr.Graders=oR;xr.VectorStores=zP;xr.Webhooks=uF;xr.Beta=aO;xr.Batches=WL;xr.Uploads=sR;xr.Responses=aR;xr.Evals=nR;xr.Containers=rR});var lF,Gfn,qUt,HUt=b(()=>{h_();KK();pce();Iu();lF=class extends xr{constructor({baseURL:e=g_("OPENAI_BASE_URL"),apiKey:r=g_("AZURE_OPENAI_API_KEY"),apiVersion:n=g_("OPENAI_API_VERSION"),endpoint:o,deployment:i,azureADTokenProvider:a,dangerouslyAllowBrowser:s,...u}={}){if(!n)throw new ht("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");if(typeof a=="function"&&(s=!0),!a&&!r)throw new ht("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(a&&r)throw new ht("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(r??(r=qUt),u.defaultQuery={...u.defaultQuery,"api-version":n},e){if(o)throw new ht("baseURL and endpoint are mutually exclusive")}else{if(o||(o=process.env.AZURE_OPENAI_ENDPOINT),!o)throw new ht("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");e=`${o}/openai`}super({apiKey:r,baseURL:e,...u,...s!==void 0?{dangerouslyAllowBrowser:s}:{}}),this.apiVersion="",this._azureADTokenProvider=a,this.apiVersion=n,this.deploymentName=i}async buildRequest(e,r={}){if(Gfn.has(e.path)&&e.method==="post"&&e.body!==void 0){if(!x2(e.body))throw new Error("Expected request body to be an object");let n=this.deploymentName||e.body.model||e.__metadata?.model;n!==void 0&&!this.baseURL.includes("/deployments")&&(e.path=`/deployments/${n}${e.path}`)}return super.buildRequest(e,r)}async _getAzureADToken(){if(typeof this._azureADTokenProvider=="function"){let e=await this._azureADTokenProvider();if(!e||typeof e!="string")throw new ht(`Expected 'azureADTokenProvider' argument to return a string but it returned ${e}`);return e}}async authHeaders(e){}async prepareOptions(e){if(e.headers=mt([e.headers]),e.headers.values.get("Authorization")||e.headers.values.get("api-key"))return super.prepareOptions(e);let r=await this._getAzureADToken();if(r)e.headers.values.set("Authorization",`Bearer ${r}`);else if(this.apiKey!==qUt)e.headers.values.set("api-key",this.apiKey);else throw new ht("Unable to handle auth");return super.prepareOptions(e)}},Gfn=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"]),qUt="<Missing Key>"});var sO=b(()=>{pce();yke();zle();pce();Za();QC();HUt()});function oh(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=OB(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new Dh([`Function "${t.function.name}" arguments:`,"",t.function.arguments,"","are not valid JSON.",`Error: ${o.message}`].join(`
`))}let n={name:t.function.name,args:r,type:"tool_call"};return e?.returnId&&(n.id=t.id),n}function uO(t){if(t.id===void 0)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:t.id,type:"function",function:{name:t.name,arguments:JSON.stringify(t.args)}}}function ih(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var L$e,Hd,VUt=b(()=>{UB();CSe();QA();Cj();OE();L$e=class extends Nj{static lc_name(){return"JsonOutputToolsParser"}constructor(e){super(e),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","openai_tools"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.returnId=e?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(e){return await this.parsePartialResult(e,!1)}async parsePartialResult(e,r=!0){let n=e[0].message,o;if(Ki(n)&&n.tool_calls?.length?o=n.tool_calls.map(a=>{let{id:s,...u}=a;return this.returnId?{id:s,...u}:u}):n.additional_kwargs.tool_calls!==void 0&&(o=JSON.parse(JSON.stringify(n.additional_kwargs.tool_calls)).map(s=>oh(s,{returnId:this.returnId,partial:r}))),!o)return[];let i=[];for(let a of o)if(a!==void 0){let s={type:a.name,args:a.args,id:a.id};i.push(s)}return i}},Hd=class extends L$e{static lc_name(){return"JsonOutputKeyToolsParser"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","openai_tools"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnSingle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"zodSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){if(this.zodSchema===void 0)return e;let r=await FQe(this.zodSchema,e);if(r.success)return r.data;throw new Dh(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error?.issues)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){let n=(await super.parsePartialResult(e)).filter(i=>i.type===this.keyName),o=n;if(n.length)return this.returnId||(o=n.map(i=>i.args)),this.returnSingle?o[0]:o}async parseResult(e){let n=(await super.parsePartialResult(e,!1)).filter(a=>a.type===this.keyName),o=n;return n.length?(this.returnId||(o=n.map(a=>a.args)),this.returnSingle?this._validateResult(o[0]):await Promise.all(o.map(a=>this._validateResult(a)))):void 0}}});var WUt=b(()=>{VUt()});var Q2=b(()=>{WUt()});var F$e=b(()=>{Tj()});function UP(t){let{azureOpenAIApiDeploymentName:e,azureOpenAIApiInstanceName:r,azureOpenAIApiKey:n,azureOpenAIBasePath:o,baseURL:i,azureADTokenProvider:a,azureOpenAIEndpoint:s}=t;if((n||a)&&o&&e)return`${o}/${e}`;if((n||a)&&s&&e)return`${s}/openai/deployments/${e}`;if(n||a){if(!r)throw new Error("azureOpenAIApiInstanceName is required when using azureOpenAIApiKey");if(!e)throw new Error("azureOpenAIApiDeploymentName is a required parameter when using azureOpenAIApiKey");return`https://${r}.openai.azure.com/openai/deployments/${e}`}return i}var uR=b(()=>{});var GUt,KUt,JUt,mce=b(()=>{GUt=Symbol("Let zodToJsonSchema decide on which parser to use"),KUt={name:void 0,$refStrategy:"root",effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",nullableStrategy:"from-target",removeAdditionalStrategy:"passthrough",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},JUt=t=>typeof t=="string"?{...KUt,basePath:["#"],definitions:{},name:t}:{...KUt,basePath:["#"],definitions:{},...t}});function ZUt(t){if(!t)return!0;for(let e in t)return!1;return!0}var YK,k$e=b(()=>{YK=t=>"_def"in t?t._def:t});var YUt,$$e=b(()=>{mce();k$e();YUt=t=>{let e=JUt(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:r,propertyPath:void 0,seenRefs:new Set,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[YK(o),{def:YK(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function B$e(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function ho(t,e,r,n,o){t[e]=r,B$e(t,e,n,o)}var lR=b(()=>{});function XUt(){return{}}var z$e=b(()=>{});function QUt(t,e){let r={type:"array"};return t.type?._def?.typeName!==re.ZodAny&&(r.items=Sr(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&ho(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&ho(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(ho(r,"minItems",t.exactLength.value,t.exactLength.message,e),ho(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var U$e=b(()=>{xd();lR();Mu()});function eqt(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?ho(r,"minimum",n.value,n.message,e):ho(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),ho(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?ho(r,"maximum",n.value,n.message,e):ho(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),ho(r,"maximum",n.value,n.message,e));break;case"multipleOf":ho(r,"multipleOf",n.value,n.message,e);break}return r}var q$e=b(()=>{lR()});function tqt(){return{type:"boolean"}}var H$e=b(()=>{});function rqt(t,e){return Sr(t.type._def,e)}var V$e=b(()=>{Mu()});var nqt,W$e=b(()=>{Mu();nqt=(t,e)=>Sr(t.innerType._def,e)});function K$e(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>K$e(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Jfn(t,e)}}var Jfn,G$e=b(()=>{lR();Jfn=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":ho(r,"minimum",n.value,n.message,e);break;case"max":ho(r,"maximum",n.value,n.message,e);break}return r}});function oqt(t,e){return{...Sr(t.innerType._def,e),default:t.defaultValue()}}var J$e=b(()=>{Mu()});function iqt(t,e,r){return e.effectStrategy==="input"?Sr(t.schema._def,e,r):{}}var Z$e=b(()=>{Mu()});function aqt(t){return{type:"string",enum:[...t.values]}}var Y$e=b(()=>{});function sqt(t,e){let r=[Sr(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Sr(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(Zfn(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:s,...u}=i;a=u}else n=void 0;o.push(a)}}),o.length?{allOf:o,...n}:void 0}var Zfn,X$e=b(()=>{Mu();Zfn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function uqt(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var Q$e=b(()=>{});function hce(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?Yfn(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":ho(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":ho(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"email":switch(e.emailStrategy){case"format:email":__(r,"email",o.message,e);break;case"format:idn-email":__(r,"idn-email",o.message,e);break;case"pattern:zod":v_(r,cF.email,o.message,e);break}break;case"url":__(r,"uri",o.message,e);break;case"uuid":__(r,"uuid",o.message,e);break;case"regex":v_(r,o.regex,o.message,e);break;case"cuid":v_(r,cF.cuid,o.message,e);break;case"cuid2":v_(r,cF.cuid2,o.message,e);break;case"startsWith":v_(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":v_(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":__(r,"date-time",o.message,e);break;case"date":__(r,"date",o.message,e);break;case"time":__(r,"time",o.message,e);break;case"duration":__(r,"duration",o.message,e);break;case"length":ho(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),ho(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{v_(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&__(r,"ipv4",o.message,e),o.version!=="v4"&&__(r,"ipv6",o.message,e);break}case"emoji":v_(r,cF.emoji,o.message,e);break;case"ulid":{v_(r,cF.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{__(r,"binary",o.message,e);break}case"contentEncoding:base64":{ho(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{v_(r,cF.base64,o.message,e);break}}break}case"nanoid":v_(r,cF.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var eBe,cF,Yfn,__,v_,lqt,gce=b(()=>{lR();cF={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:()=>(eBe===void 0&&(eBe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),eBe),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])$/,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})))$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/};Yfn=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),__=(t,e,r,n)=>{t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):ho(t,"format",e,r,n)},v_=(t,e,r,n)=>{t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:lqt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):ho(t,"pattern",lqt(e,n),r,n)},lqt=(t,e)=>{let r=typeof t=="function"?t():t;if(!e.applyRegexFlags||!r.flags)return r.source;let n={i:r.flags.includes("i"),m:r.flags.includes("m"),s:r.flags.includes("s")},o=n.i?r.source.toLowerCase():r.source,i="",a=!1,s=!1,u=!1;for(let l=0;l<o.length;l++){if(a){i+=o[l],a=!1;continue}if(n.i){if(s){if(o[l].match(/[a-z]/)){u?(i+=o[l],i+=`${o[l-2]}-${o[l]}`.toUpperCase(),u=!1):o[l+1]==="-"&&o[l+2]?.match(/[a-z]/)?(i+=o[l],u=!0):i+=`${o[l]}${o[l].toUpperCase()}`;continue}}else if(o[l].match(/[a-z]/)){i+=`[${o[l]}${o[l].toUpperCase()}]`;continue}}if(n.m){if(o[l]==="^"){i+=`(^|(?<=[\r
]))`;continue}else if(o[l]==="$"){i+=`($|(?=[\r
]))`;continue}}if(n.s&&o[l]==="."){i+=s?`${o[l]}\r
`:`[${o[l]}\r
]`;continue}i+=o[l],o[l]==="\\"?a=!0:s&&o[l]==="]"?s=!1:!s&&o[l]==="["&&(s=!0)}try{let l=new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),r.source}return i}});function yce(t,e){if(e.target==="openApi3"&&t.keyType?._def.typeName===re.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:Sr(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:Sr(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===re.ZodString&&t.keyType._def.checks?.length){let n=Object.entries(hce(t.keyType._def,e)).reduce((o,[i,a])=>i==="type"?o:{...o,[i]:a},{});return{...r,propertyNames:n}}else if(t.keyType?._def.typeName===re.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};return r}var bce=b(()=>{xd();Mu();gce()});function cqt(t,e){if(e.mapStrategy==="record")return yce(t,e);let r=Sr(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=Sr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}var tBe=b(()=>{Mu();bce()});function dqt(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}var rBe=b(()=>{});function fqt(){return{not:{}}}var nBe=b(()=>{});function pqt(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var oBe=b(()=>{});function hqt(t,e){if(e.target==="openApi3")return mqt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in XK&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=XK[i._def.typeName];return a&&!o.includes(a)?[...o,a]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,i)=>{let a=typeof i._def.value;switch(a){case"string":case"number":case"boolean":return[...o,a];case"bigint":return[...o,"integer"];case"object":if(i._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((i,a,s)=>s.indexOf(i)===a);return{type:o.length>1?o:o[0],enum:r.reduce((i,a)=>i.includes(a._def.value)?i:[...i,a._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return mqt(t,e)}var XK,mqt,_ce=b(()=>{Mu();XK={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};mqt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>Sr(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0}});function gqt(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"||e.nullableStrategy==="property"?{type:XK[t.innerType._def.typeName],nullable:!0}:{type:[XK[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Sr(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Sr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var iBe=b(()=>{Mu();_ce()});function yqt(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",B$e(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?ho(r,"minimum",n.value,n.message,e):ho(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),ho(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?ho(r,"maximum",n.value,n.message,e):ho(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),ho(r,"maximum",n.value,n.message,e));break;case"multipleOf":ho(r,"multipleOf",n.value,n.message,e);break}return r}var aBe=b(()=>{lR()});function Xfn(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":Sr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":Sr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function bqt(t,e){let r={type:"object",...Object.entries(t.shape()).reduce((n,[o,i])=>{if(i===void 0||i._def===void 0)return n;let a=[...e.currentPath,"properties",o],s=Sr(i._def,{...e,currentPath:a,propertyPath:a});if(s===void 0)return n;if(e.openaiStrictMode&&i.isOptional()&&!i.isNullable()&&typeof i._def?.defaultValue>"u")throw new Error(`Zod field at \`${a.join("/")}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required`);return{properties:{...n.properties,[o]:s},required:i.isOptional()&&!e.openaiStrictMode?n.required:[...n.required,o]}},{properties:{},required:[]}),additionalProperties:Xfn(t,e)};return r.required.length||delete r.required,r}var sBe=b(()=>{Mu()});var _qt,uBe=b(()=>{Mu();_qt=(t,e)=>{if(e.propertyPath&&e.currentPath.slice(0,e.propertyPath.length).toString()===e.propertyPath.toString())return Sr(t.innerType._def,{...e,currentPath:e.currentPath});let r=Sr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var vqt,lBe=b(()=>{Mu();vqt=(t,e)=>{if(e.pipeStrategy==="input")return Sr(t.in._def,e);if(e.pipeStrategy==="output")return Sr(t.out._def,e);let r=Sr(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Sr(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function wqt(t,e){return Sr(t.type._def,e)}var cBe=b(()=>{Mu()});function xqt(t,e){let n={type:"array",uniqueItems:!0,items:Sr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&ho(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&ho(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var dBe=b(()=>{lR();Mu()});function Sqt(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>Sr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Sr(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>Sr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var fBe=b(()=>{Mu()});function Cqt(){return{not:{}}}var pBe=b(()=>{});function Oqt(){return{}}var mBe=b(()=>{});var Eqt,hBe=b(()=>{Mu();Eqt=(t,e)=>Sr(t.innerType._def,e)});function Sr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==GUt)return a}if(n&&!r){let a=Qfn(n,e);if(a!==void 0)return"$ref"in a&&e.seenRefs.add(a.$ref),a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=tpn(t,t.typeName,e,r);return i&&rpn(t,e,i),o.jsonSchema=i,i}var Qfn,epn,tpn,rpn,Mu=b(()=>{xd();z$e();U$e();q$e();H$e();V$e();W$e();G$e();J$e();Z$e();Y$e();X$e();Q$e();tBe();rBe();nBe();oBe();iBe();aBe();sBe();uBe();lBe();cBe();bce();dBe();gce();fBe();pBe();_ce();mBe();hBe();mce();Qfn=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"extract-to-root":let r=t.path.slice(e.basePath.length+1).join("_");return r!==e.name&&e.nameStrategy==="duplicate-ref"&&(e.definitions[r]=t.def),{$ref:[...e.basePath,e.definitionPath,r].join("/")};case"relative":return{$ref:epn(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,o)=>e.currentPath[o]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},epn=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},tpn=(t,e,r,n)=>{switch(e){case re.ZodString:return hce(t,r);case re.ZodNumber:return yqt(t,r);case re.ZodObject:return bqt(t,r);case re.ZodBigInt:return eqt(t,r);case re.ZodBoolean:return tqt();case re.ZodDate:return K$e(t,r);case re.ZodUndefined:return Cqt();case re.ZodNull:return pqt(r);case re.ZodArray:return QUt(t,r);case re.ZodUnion:case re.ZodDiscriminatedUnion:return hqt(t,r);case re.ZodIntersection:return sqt(t,r);case re.ZodTuple:return Sqt(t,r);case re.ZodRecord:return yce(t,r);case re.ZodLiteral:return uqt(t,r);case re.ZodEnum:return aqt(t);case re.ZodNativeEnum:return dqt(t);case re.ZodNullable:return gqt(t,r);case re.ZodOptional:return _qt(t,r);case re.ZodMap:return cqt(t,r);case re.ZodSet:return xqt(t,r);case re.ZodLazy:return Sr(t.getter()._def,r);case re.ZodPromise:return wqt(t,r);case re.ZodNaN:case re.ZodNever:return fqt();case re.ZodEffects:return iqt(t,r,n);case re.ZodAny:return XUt();case re.ZodUnknown:return Oqt();case re.ZodDefault:return oqt(t,r);case re.ZodBranded:return rqt(t,r);case re.ZodReadonly:return Eqt(t,r);case re.ZodCatch:return nqt(t,r);case re.ZodPipeline:return vqt(t,r);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(o=>{})(e)}},rpn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var gBe,yBe=b(()=>{Mu();$$e();k$e();gBe=(t,e)=>{let r=YUt(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=Sr(t._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??{},i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(o.title=i);let a=(()=>{if(ZUt(r.definitions))return;let u={},l=new Set;for(let c=0;c<500;c++){let d=Object.entries(r.definitions).filter(([f])=>!l.has(f));if(d.length===0)break;for(let[f,p]of d)u[f]=Sr(YK(p),{...r,currentPath:[...r.basePath,r.definitionPath,f]},!0)??{},l.add(f)}return u})(),s=n===void 0?a?{...o,[r.definitionPath]:a}:o:r.nameStrategy==="duplicate-ref"?{...o,...a||r.seenRefs.size?{[r.definitionPath]:{...a,...r.seenRefs.size?{[n]:o}:void 0}}:void 0}:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...a,[n]:o}};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),s}});var Pqt=b(()=>{mce();$$e();lR();Mu();z$e();U$e();q$e();H$e();V$e();W$e();G$e();J$e();Z$e();Y$e();X$e();Q$e();tBe();rBe();nBe();oBe();iBe();aBe();sBe();uBe();lBe();cBe();hBe();bce();dBe();gce();fBe();pBe();_ce();mBe();yBe();yBe()});function npn(t,e){return gBe(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function Tqt(t,e,r){return uUt({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:npn(t,{name:e})}},n=>t.parse(JSON.parse(n)))}var Aqt=b(()=>{E2();Pqt();sce()});function QK(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var Iqt=b(()=>{});function cR(t){let e;return t.constructor.name===YC.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===zs.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=QK(t,"INVALID_TOOL_RESULTS"):t.status===401?e=QK(t,"MODEL_AUTHENTICATION"):t.status===429?e=QK(t,"MODEL_RATE_LIMIT"):t.status===404?e=QK(t,"MODEL_NOT_FOUND"):e=t,e}function bBe(t){if(t)return t==="any"||t==="required"?"required":t==="auto"?"auto":t==="none"?"none":typeof t=="string"?{type:"function",function:{name:t}}:t}function opn(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function Mqt(t,e,r){if(Nh(t))return Tqt(t,e,r);if(Em(t))return opn({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:Y6(t,{cycles:"ref",reused:"ref",override(n){n.jsonSchema.title=e}})}},n=>XQ(t,JSON.parse(n)));throw new Error("Unsupported schema response format")}var dF=b(()=>{sO();sg();kL();F$e();eee();Aqt();Iqt()});function ipn(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function Rqt(t){let e=["namespace functions {",""];for(let r of t)r.description&&e.push(`// ${r.description}`),Object.keys(r.parameters.properties??{}).length>0?(e.push(`type ${r.name} = (_: {`),e.push(Nqt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function Nqt(t,e){let r=[];for(let[n,o]of Object.entries(t.properties??{}))o.description&&e<2&&r.push(`// ${o.description}`),t.required?.includes(n)?r.push(`${n}: ${vce(o,e)},`):r.push(`${n}?: ${vce(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function vce(t,e){if(ipn(t))return t.anyOf.map(r=>vce(r,e)).join(" | ");switch(t.type){case"string":return t.enum?t.enum.map(r=>`"${r}"`).join(" | "):"string";case"number":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"integer":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"boolean":return"boolean";case"null":return"null";case"object":return["{",Nqt(t,e+2),"}"].join(`
`);case"array":return t.items?`${vce(t.items,e)}[]`:"any[]";default:return""}}var jqt=b(()=>{});function Dqt(t,e){let r;return Kc(t)?r=KC(t):r=t,r.type==="function"&&e?.strict!==void 0&&(r.function.strict=e.strict),r}function wce(t){return"type"in t&&t.type!=="function"&&t.type!=="custom"}function Lqt(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function Fqt(t){return typeof t=="object"&&t!==null&&"metadata"in t&&typeof t.metadata=="object"&&t.metadata!==null&&"customTool"in t.metadata&&typeof t.metadata.customTool=="object"&&t.metadata.customTool!==null}function _Be(t){return"type"in t&&t.type==="custom"&&"custom"in t&&typeof t.custom=="object"&&t.custom!==null}function kqt(t){if(t.type==="custom_tool_call")return{...t,type:"tool_call",call_id:t.id,id:t.call_id,name:t.name,isCustomTool:!0,args:{input:t.input}}}function $qt(t){return t.type==="tool_call"&&"isCustomTool"in t&&t.isCustomTool===!0}function Bqt(t){let e=()=>{if(t.custom.format){if(t.custom.format.type==="grammar")return{type:"grammar",definition:t.custom.format.grammar.definition,syntax:t.custom.format.grammar.syntax};if(t.custom.format.type==="text")return{type:"text"}}};return{type:"custom",name:t.custom.name,description:t.custom.description,format:e()}}function zqt(t){let e=()=>{if(t.format){if(t.format.type==="grammar")return{type:"grammar",grammar:{definition:t.format.definition,syntax:t.format.syntax}};if(t.format.type==="text")return{type:"text"}}};return{type:"custom",custom:{name:t.name,description:t.description,format:e()}}}var Uqt=b(()=>{sg();dF()});function Cce(t){return t&&(/^o\d/.test(t)||t.startsWith("gpt-5"))}function apn(t){return t!==void 0&&typeof t.schema=="object"}function spn(t){return t.role!=="system"&&t.role!=="developer"&&t.role!=="assistant"&&t.role!=="user"&&t.role!=="function"&&t.role!=="tool"&&console.warn(`Unknown message role: ${t.role}`),t.role}function wBe(t){let e=t._getType();switch(e){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";case"generic":{if(!Qs.isInstance(t))throw new Error("Invalid generic chat message");return spn(t)}default:throw new Error(`Unknown message type: ${e}`)}}function vBe(t,e){return t.flatMap(r=>{let n=wBe(r);n==="system"&&Cce(e)&&(n="developer");let o=typeof r.content=="string"?r.content:r.content.map(a=>jb(a)?L6(a,qqt):a),i={role:n,content:o};if(r.name!=null&&(i.name=r.name),r.additional_kwargs.function_call!=null&&(i.function_call=r.additional_kwargs.function_call,i.content=""),Ki(r)&&r.tool_calls?.length?(i.tool_calls=r.tool_calls.map(uO),i.content=""):(r.additional_kwargs.tool_calls!=null&&(i.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(i.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let a={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[i,a]}return i})}var e4,qqt,eG,xce,Sce,lO,Oce=b(()=>{sO();Bs();Qf();no();GC();ag();Im();$b();Q2();kL();F$e();uR();dF();jqt();Uqt();e4="__openai_function_call_ids__";qqt={providerName:"ChatOpenAI",fromStandardTextBlock(t){return{type:"text",text:t.text}},fromStandardImageBlock(t){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url,...t.metadata?.detail?{detail:t.metadata.detail}:{}}};if(t.source_type==="base64")return{type:"image_url",image_url:{url:`data:${t.mime_type??""};base64,${t.data}`,...t.metadata?.detail?{detail:t.metadata.detail}:{}}};throw new Error(`Image content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)},fromStandardAudioBlock(t){if(t.source_type==="url"){let e=EB({dataUrl:t.url});if(!e)throw new Error(`URL audio blocks with source_type ${t.source_type} must be formatted as a data URL for ChatOpenAI`);let r=e.mime_type||t.mime_type||"",n;try{n=sxe(r)}catch{throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`)}if(n.type!=="audio"||n.subtype!=="wav"&&n.subtype!=="mp3")throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`);return{type:"input_audio",input_audio:{format:n.subtype,data:e.data}}}if(t.source_type==="base64"){let e;try{e=sxe(t.mime_type??"")}catch{throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`)}if(e.type!=="audio"||e.subtype!=="wav"&&e.subtype!=="mp3")throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`);return{type:"input_audio",input_audio:{format:e.subtype,data:t.data}}}throw new Error(`Audio content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)},fromStandardFileBlock(t){if(t.source_type==="url"){if(!EB({dataUrl:t.url}))throw new Error(`URL file blocks with source_type ${t.source_type} must be formatted as a data URL for ChatOpenAI`);return{type:"file",file:{file_data:t.url,...t.metadata?.filename||t.metadata?.name?{filename:t.metadata?.filename||t.metadata?.name}:{}}}}if(t.source_type==="base64")return{type:"file",file:{file_data:`data:${t.mime_type??""};base64,${t.data}`,...t.metadata?.filename||t.metadata?.name||t.metadata?.title?{filename:t.metadata?.filename||t.metadata?.name||t.metadata?.title}:{}}};if(t.source_type==="id")return{type:"file",file:{file_id:t.id}};throw new Error(`File content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)}};eG=class extends Au{_llmType(){return"openai"}static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning","service_tier"]}get lc_secrets(){return{apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{apiKey:"openai_api_key",modelName:"model"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","model","modelName","modelKwargs","stop","stopSequences","timeout","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming","zdrEnabled","reasoning","verbosity","promptCacheKey"]}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}identifyingParams(){return this._identifyingParams()}constructor(e){super(e??{}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logitBias",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gpt-3.5-turbo"}),Object.defineProperty(this,"modelKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topLogprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__includeRawResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportsStrictToolCalling",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"audio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modalities",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reasoning",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"zdrEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"service_tier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"promptCacheKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.apiKey=e?.apiKey??e?.configuration?.apiKey??lt("OPENAI_API_KEY"),this.organization=e?.configuration?.organization??lt("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelKwargs=e?.modelKwargs??{},this.timeout=e?.timeout,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.logprobs=e?.logprobs,this.topLogprobs=e?.topLogprobs,this.n=e?.n??this.n,this.logitBias=e?.logitBias,this.stop=e?.stopSequences??e?.stop,this.stopSequences=this.stop,this.user=e?.user,this.__includeRawResponse=e?.__includeRawResponse,this.audio=e?.audio,this.modalities=e?.modalities,this.reasoning=e?.reasoning,this.maxTokens=e?.maxCompletionTokens??e?.maxTokens,this.disableStreaming=e?.disableStreaming??this.disableStreaming,this.promptCacheKey=e?.promptCacheKey??this.promptCacheKey,this.streaming=e?.streaming??!1,this.disableStreaming&&(this.streaming=!1),this.streamUsage=e?.streamUsage??this.streamUsage,this.disableStreaming&&(this.streamUsage=!1),this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration},e?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=e.supportsStrictToolCalling),e?.service_tier!==void 0&&(this.service_tier=e.service_tier),this.zdrEnabled=e?.zdrEnabled??!1}_getReasoningParams(e){if(!Cce(this.model))return;let r;return this.reasoning!==void 0&&(r={...r,...this.reasoning}),e?.reasoning!==void 0&&(r={...r,...e.reasoning}),r}_getResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&jh(e.json_schema.schema)?Mqt(e.json_schema.schema,e.json_schema.name,{description:e.json_schema.description}):e}_combineCallOptions(e){return{...this.defaultOptions,...e??{}}}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=UP(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new xr(i)}return{...this.clientConfig,...e}}_convertChatOpenAIToolToCompletionsTool(e,r){return Fqt(e)?zqt(e.metadata.customTool):$d(e)?r?.strict!==void 0?{...e,function:{...e.function,strict:r.strict}}:e:Dqt(e,r)}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.withConfig({tools:e.map(o=>wce(o)?o:this._convertChatOpenAIToolToCompletionsTool(o,{strict:n})),...r})}async stream(e,r){return super.stream(e,this._combineCallOptions(r))}async invoke(e,r){return super.invoke(e,this._combineCallOptions(r))}_combineLLMOutput(...e){return e.reduce((r,n)=>(n&&n.tokenUsage&&(r.tokenUsage.completionTokens+=n.tokenUsage.completionTokens??0,r.tokenUsage.promptTokens+=n.tokenUsage.promptTokens??0,r.tokenUsage.totalTokens+=n.tokenUsage.totalTokens??0),r),{tokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}async getNumTokensFromMessages(e){let r=0,n=0,o=0;this.model==="gpt-3.5-turbo-0301"?(n=4,o=-1):(n=3,o=1);let i=await Promise.all(e.map(async a=>{let s=await this.getNumTokens(a.content),u=await this.getNumTokens(wBe(a)),l=a.name!==void 0?o+await this.getNumTokens(a.name):0,c=s+n+u+l,d=a;if(d._getType()==="function"&&(c-=2),d.additional_kwargs?.function_call&&(c+=3),d?.additional_kwargs.function_call?.name&&(c+=await this.getNumTokens(d.additional_kwargs.function_call?.name)),d.additional_kwargs.function_call?.arguments)try{c+=await this.getNumTokens(JSON.stringify(JSON.parse(d.additional_kwargs.function_call?.arguments)))}catch(f){console.error("Error parsing function arguments",f,JSON.stringify(d.additional_kwargs.function_call)),c+=await this.getNumTokens(d.additional_kwargs.function_call?.arguments)}return r+=c,c}));return r+=3,{totalCount:r,countPerMessage:i}}async _getNumTokensFromGenerations(e){return(await Promise.all(e.map(async n=>n.message.additional_kwargs?.function_call?(await this.getNumTokensFromMessages([n.message])).countPerMessage[0]:await this.getNumTokens(n.message.content)))).reduce((n,o)=>n+o,0)}async _getEstimatedTokenCountFromPrompt(e,r,n){let o=(await this.getNumTokensFromMessages(e)).totalCount;if(r&&n!=="auto"){let i=Rqt(r);o+=await this.getNumTokens(i),o+=9}return r&&e.find(i=>i._getType()==="system")&&(o-=4),n==="none"?o+=1:typeof n=="object"&&(o+=await this.getNumTokens(n.name)+4),o}_getStructuredOutputMethod(e){let r={...e};if(!this.model.startsWith("gpt-3")&&!this.model.startsWith("gpt-4-")&&this.model!=="gpt-4"){if(r?.method===void 0)return"jsonSchema"}else r.method==="jsonSchema"&&console.warn(`[WARNING]: JSON Schema is not supported for model "${this.model}". Falling back to tool calling.`);return r.method}withStructuredOutput(e,r){let n,o,i,a;apn(e)?(n=e.schema,o=e.name,i=e.method,a=e.includeRaw):(n=e,o=r?.name,i=r?.method,a=r?.includeRaw);let s,u;if(r?.strict!==void 0&&i==="jsonMode")throw new Error("Argument `strict` is only supported for `method` = 'function_calling'");if(i=this._getStructuredOutputMethod({...r,method:i}),i==="jsonMode"){jh(n)?u=Sd.fromZodSchema(n):u=new Cd;let f=Pm(n);s=this.withConfig({response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"json_mode"},schema:{title:o??"extract",...f}}})}else if(i==="jsonSchema"){let f={name:o??"extract",description:Pj(n),schema:n,strict:r?.strict},p=Pm(f.schema);if(s=this.withConfig({response_format:{type:"json_schema",json_schema:f},ls_structured_output_format:{kwargs:{method:"json_schema"},schema:{title:f.name,description:f.description,...p}}}),jh(n)){let m=Sd.fromZodSchema(n);u=Mp.from(h=>"parsed"in h.additional_kwargs?h.additional_kwargs.parsed:m)}else u=new Cd}else{let f=o??"extract";if(jh(n)){let p=Pm(n);s=this.withConfig({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:f}},ls_structured_output_format:{kwargs:{method:"function_calling"},schema:{title:f,...p}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new Hd({returnSingle:!0,keyName:f,zodSchema:n})}else{let p;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(p=n,f=n.name):(f=n.title??f,p={name:f,description:n.description??"",parameters:n});let m=Pm(n);s=this.withConfig({tools:[{type:"function",function:p}],tool_choice:{type:"function",function:{name:f}},ls_structured_output_format:{kwargs:{method:"function_calling"},schema:{title:f,...m}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new Hd({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Fo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Fo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Fi.from([{raw:s},d])}},xce=class extends eG{invocationParams(e){let r;e?.strict!==void 0?r=e.strict:this.supportsStrictToolCalling!==void 0&&(r=this.supportsStrictToolCalling);let n={model:this.model,temperature:this.temperature,top_p:this.topP,user:this.user,stream:this.streaming,previous_response_id:e?.previous_response_id,truncation:e?.truncation,include:e?.include,tools:e?.tools?.length?this._reduceChatOpenAITools(e.tools,{stream:this.streaming,strict:r}):void 0,tool_choice:Lqt(e?.tool_choice)?e?.tool_choice:(()=>{let i=bBe(e?.tool_choice);if(typeof i=="object"&&"type"in i){if(i.type==="function")return{type:"function",name:i.function.name};if(i.type==="allowed_tools")return{type:"allowed_tools",mode:i.allowed_tools.mode,tools:i.allowed_tools.tools};if(i.type==="custom")return{type:"custom",name:i.custom.name}}})(),text:(()=>{if(e?.text)return e.text;let i=this._getResponseFormat(e?.response_format);return i?.type==="json_schema"?i.json_schema.schema!=null?{format:{type:"json_schema",schema:i.json_schema.schema,description:i.json_schema.description,name:i.json_schema.name,strict:i.json_schema.strict}}:void 0:{format:i}})(),parallel_tool_calls:e?.parallel_tool_calls,max_output_tokens:this.maxTokens===-1?void 0:this.maxTokens,prompt_cache_key:e?.promptCacheKey??this.promptCacheKey,...this.zdrEnabled?{store:!1}:{},...this.modelKwargs},o=this._getReasoningParams(e);return o!==void 0&&(n.reasoning=o),n}async _generate(e,r){let n=this.invocationParams(r);if(n.stream){let o=this._streamResponseChunks(e,r),i;for await(let a of o)a.message.response_metadata={...a.generationInfo,...a.message.response_metadata},i=i?.concat(a)??a;return{generations:i?[i]:[],llmOutput:{estimatedTokenUsage:i?.message?.usage_metadata}}}else{let o=this._convertMessagesToResponsesParams(e),i=await this.completionWithRetry({input:o,...n,stream:!1},{signal:r?.signal,...r?.options});return{generations:[{text:i.output_text,message:this._convertResponsesMessageToBaseMessage(i)}],llmOutput:{id:i.id,estimatedTokenUsage:i.usage?{promptTokens:i.usage.input_tokens,completionTokens:i.usage.output_tokens,totalTokens:i.usage.total_tokens}:void 0}}}}async*_streamResponseChunks(e,r,n){let o=await this.completionWithRetry({...this.invocationParams(r),input:this._convertMessagesToResponsesParams(e),stream:!0},r);for await(let i of o){let a=this._convertResponsesDeltaToBaseMessageChunk(i);a!=null&&(yield a,await n?.handleLLMNewToken(a.text||"",{prompt:r.promptIndex??0,completion:0},void 0,void 0,void 0,{chunk:a}))}}async completionWithRetry(e,r){return this.caller.call(async()=>{let n=this._getClientOptions(r);try{return e.text?.format?.type==="json_schema"&&!e.stream?await this.client.responses.parse(e,n):await this.client.responses.create(e,n)}catch(o){throw cR(o)}})}_convertResponsesMessageToBaseMessage(e){if(e.error){let u=new Error(e.error.message);throw u.name=e.error.code,u}let r,n=[],o=[],i=[],a={model:e.model,created_at:e.created_at,id:e.id,incomplete_details:e.incomplete_details,metadata:e.metadata,object:e.object,status:e.status,user:e.user,service_tier:e.service_tier,model_name:e.model},s={};for(let u of e.output)if(u.type==="message")r=u.id,n.push(...u.content.flatMap(l=>l.type==="output_text"?("parsed"in l&&l.parsed!=null&&(s.parsed=l.parsed),{type:"text",text:l.text,annotations:l.annotations}):l.type==="refusal"?(s.refusal=l.refusal,[]):l));else if(u.type==="function_call"){let l={function:{name:u.name,arguments:u.arguments},id:u.call_id};try{o.push(oh(l,{returnId:!0}))}catch(c){let d;typeof c=="object"&&c!=null&&"message"in c&&typeof c.message=="string"&&(d=c.message),i.push(ih(l,d))}s[e4]??(s[e4]={}),u.id&&(s[e4][u.call_id]=u.id)}else if(u.type==="reasoning")s.reasoning=u;else if(u.type==="custom_tool_call"){let l=kqt(u);l?o.push(l):i.push(ih(u,"Malformed custom tool call"))}else s.tool_outputs??(s.tool_outputs=[]),s.tool_outputs.push(u);return new Ln({id:r,content:n,tool_calls:o,invalid_tool_calls:i,usage_metadata:e.usage,additional_kwargs:s,response_metadata:a})}_convertResponsesDeltaToBaseMessageChunk(e){let r=[],n={},o,i=[],a={},s={},u;if(e.type==="response.output_text.delta")r.push({type:"text",text:e.delta,index:e.content_index});else if(e.type==="response.output_text.annotation.added")r.push({type:"text",text:"",annotations:[e.annotation],index:e.content_index});else if(e.type==="response.output_item.added"&&e.item.type==="message")u=e.item.id;else if(e.type==="response.output_item.added"&&e.item.type==="function_call")i.push({type:"tool_call_chunk",name:e.item.name,args:e.item.arguments,id:e.item.call_id,index:e.output_index}),s[e4]={[e.item.call_id]:e.item.id};else if(e.type==="response.output_item.done"&&["web_search_call","file_search_call","computer_call","code_interpreter_call","mcp_call","mcp_list_tools","mcp_approval_request","image_generation_call","custom_tool_call"].includes(e.item.type))s.tool_outputs=[e.item];else if(e.type==="response.created")a.id=e.response.id,a.model_name=e.response.model,a.model=e.response.model;else if(e.type==="response.completed"){let l=this._convertResponsesMessageToBaseMessage(e.response);o=e.response.usage,e.response.text?.format?.type==="json_schema"&&(s.parsed??(s.parsed=JSON.parse(l.text)));for(let[c,d]of Object.entries(e.response))c!=="id"&&(a[c]=d)}else if(e.type==="response.function_call_arguments.delta")i.push({type:"tool_call_chunk",args:e.delta,index:e.output_index});else if(e.type==="response.web_search_call.completed"||e.type==="response.file_search_call.completed")n={tool_outputs:{id:e.item_id,type:e.type.replace("response.","").replace(".completed",""),status:"completed"}};else if(e.type==="response.refusal.done")s.refusal=e.refusal;else if(e.type==="response.output_item.added"&&"item"in e&&e.item.type==="reasoning"){let l=e.item.summary?e.item.summary.map((c,d)=>({...c,index:d})):void 0;s.reasoning={id:e.item.id,type:e.item.type,...l?{summary:l}:{}}}else if(e.type==="response.reasoning_summary_part.added")s.reasoning={type:"reasoning",summary:[{...e.part,index:e.summary_index}]};else if(e.type==="response.reasoning_summary_text.delta")s.reasoning={type:"reasoning",summary:[{text:e.delta,type:"summary_text",index:e.summary_index}]};else return e.type==="response.image_generation_call.partial_image",null;return new co({text:r.map(l=>l.text).join(""),message:new vr({id:u,content:r,tool_call_chunks:i,usage_metadata:o,additional_kwargs:s,response_metadata:a}),generationInfo:n})}_convertMessagesToResponsesParams(e){return e.flatMap(r=>{let n=r.additional_kwargs,o=wBe(r);if(o==="system"&&Cce(this.model)&&(o="developer"),o==="function")throw new Error("Function messages are not supported in Responses API");if(o==="tool"){let i=r;return n?.type==="computer_call_output"?{type:"computer_call_output",output:(()=>{if(typeof i.content=="string")return{type:"computer_screenshot",image_url:i.content};if(Array.isArray(i.content)){let s=i.content.find(l=>l.type==="computer_screenshot");if(s)return s;let u=i.content.find(l=>l.type==="image_url");if(u)return{type:"computer_screenshot",image_url:typeof u.image_url=="string"?u.image_url:u.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:i.tool_call_id}:i.metadata?.customTool?{type:"custom_tool_call_output",call_id:i.tool_call_id,output:i.content}:{type:"function_call_output",call_id:i.tool_call_id,id:i.id?.startsWith("fc_")?i.id:void 0,output:typeof i.content!="string"?JSON.stringify(i.content):i.content}}if(o==="assistant"){if(!this.zdrEnabled&&r.response_metadata.output!=null&&Array.isArray(r.response_metadata.output)&&r.response_metadata.output.length>0&&r.response_metadata.output.every(c=>"type"in c))return r.response_metadata.output;let i=[];if(n?.reasoning&&!this.zdrEnabled){let c=this._convertReasoningSummary(n.reasoning);i.push(c)}let{content:a}=r;n?.refusal&&(typeof a=="string"&&(a=[{type:"output_text",text:a,annotations:[]}]),a=[...a,{type:"refusal",refusal:n.refusal}]),(typeof a=="string"||a.length>0)&&i.push({type:"message",role:"assistant",...r.id&&!this.zdrEnabled&&r.id.startsWith("msg_")?{id:r.id}:{},content:typeof a=="string"?a:a.flatMap(c=>c.type==="text"?{type:"output_text",text:c.text,annotations:c.annotations??[]}:c.type==="output_text"||c.type==="refusal"?c:[])});let s=n?.[e4];Ki(r)&&r.tool_calls?.length?i.push(...r.tool_calls.map(c=>$qt(c)?{type:"custom_tool_call",id:c.call_id,call_id:c.id??"",input:c.args.input,name:c.name}:{type:"function_call",name:c.name,arguments:JSON.stringify(c.args),call_id:c.id,...this.zdrEnabled?{id:s?.[c.id]}:{}})):n?.tool_calls&&i.push(...n.tool_calls.map(c=>({type:"function_call",name:c.function.name,call_id:c.id,arguments:c.function.arguments,...this.zdrEnabled?{id:s?.[c.id]}:{}})));let u=r.response_metadata.output?.length?r.response_metadata.output:n.tool_outputs,l=["computer_call","mcp_call","code_interpreter_call","image_generation_call"];if(u!=null){let d=u?.filter(f=>l.includes(f.type));d.length>0&&i.push(...d)}return i}if(o==="user"||o==="system"||o==="developer"){if(typeof r.content=="string")return{type:"message",role:o,content:r.content};let i=[],a=r.content.flatMap(s=>(s.type==="mcp_approval_response"&&i.push({type:"mcp_approval_response",approval_request_id:s.approval_request_id,approve:s.approve}),jb(s)?L6(s,qqt):s.type==="text"?{type:"input_text",text:s.text}:s.type==="image_url"?{type:"input_image",image_url:typeof s.image_url=="string"?s.image_url:s.image_url.url,detail:typeof s.image_url=="string"?"auto":s.image_url.detail}:s.type==="input_text"||s.type==="input_image"||s.type==="input_file"?s:[]));return a.length>0&&i.push({type:"message",role:o,content:a}),i}return console.warn(`Unsupported role found when converting to OpenAI Responses API: ${o}`),[]})}_convertReasoningSummary(e){let r=(e.summary.length>1?e.summary.reduce((n,o)=>{let i=n.at(-1);return i.index===o.index?i.text+=o.text:n.push(o),n},[{...e.summary[0]}]):e.summary).map(n=>Object.fromEntries(Object.entries(n).filter(([o])=>o!=="index")));return{...e,summary:r}}_reduceChatOpenAITools(e,r){let n=[];for(let o of e)wce(o)?(o.type==="image_generation"&&r?.stream&&(o.partial_images=1),n.push(o)):$d(o)?n.push({type:"function",name:o.function.name,parameters:o.function.parameters,description:o.function.description,strict:r?.strict??null}):_Be(o)&&n.push(Bqt(o));return n}},Sce=class extends eG{invocationParams(e,r){let n;e?.strict!==void 0?n=e.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling);let o={};e?.stream_options!==void 0?o={stream_options:e.stream_options}:this.streamUsage&&(this.streaming||r?.streaming)&&(o={stream_options:{include_usage:!0}});let i={model:this.model,temperature:this.temperature,top_p:this.topP,frequency_penalty:this.frequencyPenalty,presence_penalty:this.presencePenalty,logprobs:this.logprobs,top_logprobs:this.topLogprobs,n:this.n,logit_bias:this.logitBias,stop:e?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:e?.functions,function_call:e?.function_call,tools:e?.tools?.length?e.tools.map(s=>this._convertChatOpenAIToolToCompletionsTool(s,{strict:n})):void 0,tool_choice:bBe(e?.tool_choice),response_format:this._getResponseFormat(e?.response_format),seed:e?.seed,...o,parallel_tool_calls:e?.parallel_tool_calls,...this.audio||e?.audio?{audio:this.audio||e?.audio}:{},...this.modalities||e?.modalities?{modalities:this.modalities||e?.modalities}:{},...this.modelKwargs,prompt_cache_key:e?.promptCacheKey??this.promptCacheKey};e?.prediction!==void 0&&(i.prediction=e.prediction),this.service_tier!==void 0&&(i.service_tier=this.service_tier),e?.service_tier!==void 0&&(i.service_tier=e.service_tier);let a=this._getReasoningParams(e);return a!==void 0&&a.effort!==void 0&&(i.reasoning_effort=a.effort),Cce(i.model)?i.max_completion_tokens=this.maxTokens===-1?void 0:this.maxTokens:i.max_tokens=this.maxTokens===-1?void 0:this.maxTokens,i}async _generate(e,r,n){let o={},i=this.invocationParams(r),a=vBe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this._getEstimatedTokenCountFromPrompt(e,c,d),p=await this._getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}),{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let y={text:m.message?.content??"",message:this._convertCompletionsMessageToBaseMessage(m.message??{role:"assistant"},s)};y.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},Ki(y.message)&&(y.message.usage_metadata=o),y.message=new Ln(Object.fromEntries(Object.entries(y.message).filter(([g])=>!g.startsWith("lc_")))),p.push(y)}return{generations:p,llmOutput:{tokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}}async*_streamResponseChunks(e,r,n){let o=vBe(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertCompletionsDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model,m.service_tier=l.service_tier),this.logprobs&&(m.logprobs=c.logprobs);let h=new co({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new co({message:new vr({content:"",response_metadata:{usage:{...u}},usage_metadata:{input_tokens:u.prompt_tokens,output_tokens:u.completion_tokens,total_tokens:u.total_tokens,...Object.keys(l).length>0&&{input_token_details:l},...Object.keys(c).length>0&&{output_token_details:c}}}),text:""})}if(r.signal?.aborted)throw new Error("AbortError")}async completionWithRetry(e,r){let n=this._getClientOptions(r),o=e.response_format&&e.response_format.type==="json_schema";return this.caller.call(async()=>{try{return o&&!e.stream?await this.client.chat.completions.parse(e,n):(console.log("request",e),await this.client.chat.completions.create(e,n))}catch(i){throw cR(i)}})}_convertCompletionsMessageToBaseMessage(e,r){let n=e.tool_calls;switch(e.role){case"assistant":{let o=[],i=[];for(let u of n??[])try{o.push(oh(u,{returnId:!0}))}catch(l){i.push(ih(u,l.message))}let a={function_call:e.function_call,tool_calls:n};this.__includeRawResponse!==void 0&&(a.__raw_response=r);let s={model_name:r.model,...r.system_fingerprint?{usage:{...r.usage},system_fingerprint:r.system_fingerprint}:{}};return e.audio&&(a.audio=e.audio),new Ln({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Qs(e.content||"",e.role??"unknown")}}_convertCompletionsDeltaToBaseMessageChunk(e,r,n){let o=e.role??n,i=e.content??"",a;e.function_call?a={function_call:e.function_call}:e.tool_calls?a={tool_calls:e.tool_calls}:a={},this.__includeRawResponse&&(a.__raw_response=r),e.audio&&(a.audio={...e.audio,index:r.choices[0].index});let s={usage:{...r.usage}};if(o==="user")return new Pp({content:i,response_metadata:s});if(o==="assistant"){let u=[];if(Array.isArray(e.tool_calls))for(let l of e.tool_calls)u.push({name:l.function?.name,args:l.function?.arguments,id:l.id,index:l.index,type:"tool_call_chunk"});return new vr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Pf({content:i,response_metadata:s}):o==="developer"?new Pf({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Ih({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Wg({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new Ep({content:i,role:o,response_metadata:s})}},lO=class t extends eG{get lc_serializable_keys(){return[...super.lc_serializable_keys,"useResponsesApi"]}constructor(e){super(e),Object.defineProperty(this,"fields",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"useResponsesApi",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"responses",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"completions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.useResponsesApi=e?.useResponsesApi??!1,this.responses=e?.responses??new xce(e),this.completions=e?.completions??new Sce(e)}_useResponsesApi(e){let r=e?.tools?.some(wce),n=e?.previous_response_id!=null||e?.text!=null||e?.truncation!=null||e?.include!=null||e?.reasoning?.summary!=null||this.reasoning?.summary!=null,o=e?.tools?.some(_Be);return this.useResponsesApi||r||n||o}getLsParams(e){let r=this._combineCallOptions(e);return this._useResponsesApi(e)?this.responses.getLsParams(r):this.completions.getLsParams(r)}invocationParams(e){let r=this._combineCallOptions(e);return this._useResponsesApi(e)?this.responses.invocationParams(r):this.completions.invocationParams(r)}async _generate(e,r,n){return this._useResponsesApi(r)?this.responses._generate(e,r):this.completions._generate(e,r,n)}async*_streamResponseChunks(e,r,n){if(this._useResponsesApi(r)){yield*this.responses._streamResponseChunks(e,this._combineCallOptions(r),n);return}yield*this.completions._streamResponseChunks(e,this._combineCallOptions(r),n)}withConfig(e){let r=new t(this.fields);return r.defaultOptions={...this.defaultOptions,...e},r}}});function Hqt(t){return typeof Headers<"u"&&t!==null&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Headers]"}function Ece(t){let e=upn(()=>{if(Hqt(t))return t;if(Array.isArray(t))return new Headers(t);if(typeof t=="object"&&t!==null&&"values"in t&&Hqt(t.values))return t.values;if(typeof t=="object"&&t!==null){let r=Object.entries(t).filter(([,n])=>typeof n=="string").map(([n,o])=>[n,o]);return new Headers(r)}return new Headers});return Object.fromEntries(e.entries())}var upn,Pce=b(()=>{upn=t=>t()});var Vqt=b(()=>{sO();no();Oce();uR();Pce()});var xBe=b(()=>{sO();ag();Qf();no();RL();Ry();uR();dF()});var Gqt=b(()=>{sO();no();xBe();uR();Pce()});var qP,SBe=b(()=>{sO();no();NP();Ry();uR();dF();qP=class extends Wp{constructor(e){let r={maxConcurrency:2,...e};super(r),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"text-embedding-ada-002"}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSize",{enumerable:!0,configurable:!0,writable:!0,value:512}),Object.defineProperty(this,"stripNewLines",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"dimensions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let n=r?.apiKey??r?.openAIApiKey??lt("OPENAI_API_KEY");this.organization=r?.configuration?.organization??lt("OPENAI_ORGANIZATION"),this.model=r?.model??r?.modelName??this.model,this.modelName=this.model,this.batchSize=r?.batchSize??this.batchSize,this.stripNewLines=r?.stripNewLines??this.stripNewLines,this.timeout=r?.timeout,this.dimensions=r?.dimensions,this.clientConfig={apiKey:n,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration}}async embedDocuments(e){let r=Kp(this.stripNewLines?e.map(a=>a.replace(/\n/g," ")):e,this.batchSize),n=r.map(a=>{let s={model:this.model,input:a};return this.dimensions&&(s.dimensions=this.dimensions),this.embeddingWithRetry(s)}),o=await Promise.all(n),i=[];for(let a=0;a<o.length;a+=1){let s=r[a],{data:u}=o[a];for(let l=0;l<s.length;l+=1)i.push(u[l].embedding)}return i}async embedQuery(e){let r={model:this.model,input:this.stripNewLines?e.replace(/\n/g," "):e};this.dimensions&&(r.dimensions=this.dimensions);let{data:n}=await this.embeddingWithRetry(r);return n[0].embedding}async embeddingWithRetry(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=UP(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new xr(i)}let r={};return this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw cR(n)}})}}});var Tce,Jqt=b(()=>{sO();no();SBe();uR();dF();Pce();Tce=class extends qP{constructor(e){super(e),Object.defineProperty(this,"azureOpenAIApiVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureOpenAIApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureADTokenProvider",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureOpenAIApiInstanceName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureOpenAIApiDeploymentName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureOpenAIBasePath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.batchSize=e?.batchSize??1,this.azureOpenAIApiKey=e?.azureOpenAIApiKey??e?.apiKey??lt("AZURE_OPENAI_API_KEY"),this.azureOpenAIApiVersion=e?.azureOpenAIApiVersion??e?.openAIApiVersion??lt("AZURE_OPENAI_API_VERSION"),this.azureOpenAIBasePath=e?.azureOpenAIBasePath??lt("AZURE_OPENAI_BASE_PATH"),this.azureOpenAIApiInstanceName=e?.azureOpenAIApiInstanceName??lt("AZURE_OPENAI_API_INSTANCE_NAME"),this.azureOpenAIApiDeploymentName=(e?.azureOpenAIApiEmbeddingsDeploymentName||e?.azureOpenAIApiDeploymentName)??(lt("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME")||lt("AZURE_OPENAI_API_DEPLOYMENT_NAME")),this.azureADTokenProvider=e?.azureADTokenProvider}async embeddingWithRetry(e){if(!this.client){let n={azureOpenAIApiDeploymentName:this.azureOpenAIApiDeploymentName,azureOpenAIApiInstanceName:this.azureOpenAIApiInstanceName,azureOpenAIApiKey:this.azureOpenAIApiKey,azureOpenAIBasePath:this.azureOpenAIBasePath,azureADTokenProvider:this.azureADTokenProvider,baseURL:this.clientConfig.baseURL},o=UP(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};this.azureADTokenProvider||(i.apiKey=n.azureOpenAIApiKey),i.baseURL||delete i.baseURL;let a=Ece(i.defaultHeaders);i.defaultHeaders={...i.defaultHeaders,"User-Agent":a["User-Agent"]?`${a["User-Agent"]}: langchainjs-azure-openai-v2`:"langchainjs-azure-openai-v2"},this.client=new lF({apiVersion:this.azureOpenAIApiVersion,azureADTokenProvider:this.azureADTokenProvider,deployment:this.azureOpenAIApiDeploymentName,...i})}let r={};return this.azureOpenAIApiKey&&(r.headers={"api-key":this.azureOpenAIApiKey,...r.headers},r.query={"api-version":this.azureOpenAIApiVersion,...r.query}),this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw cR(n)}})}}});var Zqt=b(()=>{});function lpn(t){let{content:e,artifact:r,toolCallId:n,metadata:o}=t;return n&&!sXe(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new wE({content:e,artifact:r,tool_call_id:n,name:t.name,metadata:o}):new wE({content:cpn(e),artifact:r,tool_call_id:n,name:t.name,metadata:o}):e}function cpn(t){try{return JSON.stringify(t,null,2)??""}catch{return`${t}`}}var CBe,dR,Yqt=b(()=>{qX();Q6();KA();vK();Ov();PB();Ej();FQ();OE();Tj();ple();CBe=class extends a2{get lc_namespace(){return["langchain","tools"]}constructor(e){super(e??{}),Object.defineProperty(this,"returnDirect",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"verboseParsingErrors",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"responseFormat",{enumerable:!0,configurable:!0,writable:!0,value:"content"}),Object.defineProperty(this,"defaultConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.verboseParsingErrors=e?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=e?.responseFormat??this.responseFormat,this.defaultConfig=e?.defaultConfig??this.defaultConfig,this.metadata=e?.metadata??this.metadata}async invoke(e,r){let n,o=Tn(IB(this.defaultConfig,r));return HA(e)?(n=e.args,o={...o,toolCall:e}):n=e,this.call(n,o)}async call(e,r,n){let o=HA(e)?e.args:e,i;if(jh(this.schema))try{i=await BB(this.schema,o)}catch(m){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
Details: ${m.message}`),new Sj(h,JSON.stringify(e))}else{let m=wa(o,this.schema);if(!m.valid){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
Details: ${m.errors.map(y=>`${y.keywordLocation}: ${y.error}`).join(`
`)}`),new Sj(h,JSON.stringify(e))}i=o}let a=U6(r),u=await _u.configure(a.callbacks,this.callbacks,a.tags||n,this.tags,a.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof e=="string"?e:JSON.stringify(e),a.runId,void 0,void 0,void 0,a.runName);delete a.runId;let l;try{l=await this._call(i,u,a)}catch(m){throw await u?.handleToolError(m),m}let c,d;if(this.responseFormat==="content_and_artifact")if(Array.isArray(l)&&l.length===2)[c,d]=l;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple.
Result: ${JSON.stringify(l)}`);else c=l;let f;HA(e)&&(f=e.id),!f&&eXe(a)&&(f=a.toolCall.id);let p=lpn({content:c,artifact:d,toolCallId:f,name:this.name,metadata:this.metadata});return await u?.handleToolEnd(p),p}},dR=class extends CBe{constructor(e){super(e),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:dt.object({input:dt.string().optional()}).transform(r=>r.input)})}call(e,r){let n=typeof e=="string"||e==null?{input:e}:e;return super.call(n,r)}}});var tG=b(()=>{Yqt()});var OBe,Xqt=b(()=>{no();sO();tG();OBe=class extends dR{static lc_name(){return"DallEAPIWrapper"}constructor(e){e?.responseFormat!==void 0&&["url","b64_json"].includes(e.responseFormat)&&(e.dallEResponseFormat=e.responseFormat,e.responseFormat="content"),super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:"A wrapper around OpenAI DALL-E API. Useful for when you need to generate images from a text description. Input should be an image description."}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"dall-e-3"}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:"vivid"}),Object.defineProperty(this,"quality",{enumerable:!0,configurable:!0,writable:!0,value:"standard"}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:"1024x1024"}),Object.defineProperty(this,"dallEResponseFormat",{enumerable:!0,configurable:!0,writable:!0,value:"url"}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let r=e?.apiKey??e?.openAIApiKey??lt("OPENAI_API_KEY"),n=e?.organization??lt("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseURL:e?.baseUrl};this.client=new xr(o),this.model=e?.model??e?.modelName??this.model,this.style=e?.style??this.style,this.quality=e?.quality??this.quality,this.n=e?.n??this.n,this.size=e?.size??this.size,this.dallEResponseFormat=e?.dallEResponseFormat??this.dallEResponseFormat,this.user=e?.user}processMultipleGeneratedUrls(e){return this.dallEResponseFormat==="url"?e.flatMap(r=>r.data?.flatMap(o=>o.url?{type:"image_url",image_url:o.url}:[]).filter(o=>o!==void 0&&o.type==="image_url"&&typeof o.image_url=="string"&&o.image_url!==void 0)??[]):e.flatMap(r=>r.data?.flatMap(o=>o.b64_json?{type:"image_url",image_url:{url:o.b64_json}}:[]).filter(o=>o!==void 0&&o.type==="image_url"&&typeof o.image_url=="object"&&"url"in o.image_url&&typeof o.image_url.url=="string"&&o.image_url.url!==void 0)??[])}async _call(e){let r={model:this.model,prompt:e,n:1,size:this.size,response_format:this.dallEResponseFormat,style:this.style,quality:this.quality,user:this.user};if(this.n>1){let i=await Promise.all(Array.from({length:this.n}).map(()=>this.client.images.generate(r)));return this.processMultipleGeneratedUrls(i)}let n=await this.client.images.generate(r),o="";return this.dallEResponseFormat==="url"?[o]=n.data?.map(i=>i.url).filter(i=>i!=="undefined")??[]:[o]=n.data?.map(i=>i.b64_json).filter(i=>i!=="undefined")??[],o}};Object.defineProperty(OBe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"})});var Qqt=b(()=>{Xqt()});var e2t=b(()=>{Oce()});var t2t=b(()=>{Ej()});var r2t=b(()=>{Im();t2t();tG()});var n2t=b(()=>{sO();Oce();Vqt();xBe();Gqt();Jqt();SBe();Zqt();dF();uR();Qqt();e2t();r2t()});var Ace=b(()=>{n2t()});var Ice,o2t=b(()=>{NP();Ry();no();Ice=class extends Wp{constructor(e){let r={maxConcurrency:2,...e};super(r),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"jina-clip-v2"}),Object.defineProperty(this,"batchSize",{enumerable:!0,configurable:!0,writable:!0,value:24}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:"https://api.jina.ai/v1/embeddings"}),Object.defineProperty(this,"stripNewLines",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"dimensions",{enumerable:!0,configurable:!0,writable:!0,value:1024}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"normalized",{enumerable:!0,configurable:!0,writable:!0,value:!0});let n=r?.apiKey||lt("JINA_API_KEY")||lt("JINA_AUTH_TOKEN");if(!n)throw new Error("Jina API key not found");this.apiKey=n,this.model=r?.model??this.model,this.dimensions=r?.dimensions??this.dimensions,this.batchSize=r?.batchSize??this.batchSize,this.stripNewLines=r?.stripNewLines??this.stripNewLines,this.normalized=r?.normalized??this.normalized}doStripNewLines(e){return this.stripNewLines?e.map(r=>typeof r=="string"?r.replace(/\n/g," "):r.text?{text:r.text.replace(/\n/g," ")}:r):e}async embedDocuments(e){let r=Kp(this.doStripNewLines(e),this.batchSize),n=r.map(a=>{let s=this.getParams(a);return this.embeddingWithRetry(s)}),o=await Promise.all(n),i=[];for(let a=0;a<o.length;a+=1){let s=r[a],u=o[a]||[];for(let l=0;l<s.length;l+=1)i.push(u[l])}return i}async embedQuery(e){let r=this.getParams(this.doStripNewLines([e]),!0);return(await this.embeddingWithRetry(r)||[[]])[0]}getParams(e,r){return{model:this.model,input:e,dimensions:this.dimensions,task:r?"retrieval.query":"retrieval.passage",normalized:this.normalized}}async embeddingWithRetry(e){let n=await(await fetch(this.baseUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify(e)})).json();if("detail"in n&&n.detail)throw new Error(`${n.detail}`);return n.data.map(({embedding:o})=>o)}}});var i2t=b(()=>{o2t()});var Mce,a2t=b(()=>{i2t();Mce=class extends Ice{constructor(e){super(e),e?.baseUrl&&(this.baseUrl=e.baseUrl)}}});var rG,s2t=b(()=>{Ace();rG=class extends qP{constructor(e){super(e),this.customConfig=e}async embedQuery(e){return(await this.callEmbeddingAPI([e]))[0]}async embedDocuments(e){return await this.callEmbeddingAPI(e)}async callEmbeddingAPI(e){let r={model:this.customConfig.modelName,input:e,encoding_format:"float"},o=`${this.customConfig.configuration?.baseURL||"https://api.openai.com/v1"}/embeddings`,i=this.customConfig.apiKey,s=await(this.customConfig.configuration?.fetch||fetch)(o,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok){let l=await s.text();throw new Error(`Embedding API request failed: ${s.status} ${s.statusText} - ${l}`)}let u=await s.json();if(!u.data||!Array.isArray(u.data))throw new Error("Invalid API response format: missing or invalid data array");return u.data.map(l=>{if(!l.embedding||!Array.isArray(l.embedding))throw new Error("Invalid API response format: missing or invalid embedding array");return l.embedding})}}});var Rce,dpn,Ru,fF=b(()=>{er();qj();IE();_t();jy();kt();EFe();NFe();KFe();Ace();Rce=require("obsidian");a2t();s2t();dpn={"copilot-plus":rG,"copilot-plus-jina":Mce,openai:qP,cohereai:ble,google:Ole,"azure openai":Tce,ollama:Ile,"lm-studio":rG,"3rd party (openai-format)":qP},Ru=class t{constructor(){this.providerApiKeyMap={"copilot-plus":()=>ne().plusLicenseKey,"copilot-plus-jina":()=>ne().plusLicenseKey,openai:()=>ne().openAIApiKey,cohereai:()=>ne().cohereApiKey,google:()=>ne().googleApiKey,"azure openai":()=>ne().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key"};this.initialize(),oa(()=>this.initialize())}initialize(){let e=ne().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}getProviderConstructor(e){let r=dpn[e.provider];if(!r)throw console.warn(`Unknown provider: ${e.provider} for model: ${e.name}`),new Error(`Unknown provider: ${e.provider} for model: ${e.name}`);return r}buildModelMap(e){t.modelMap={};let r=t.modelMap;e.forEach(n=>{if(n.enabled){if(!Object.values(oI).contains(n.provider)){console.warn(`Unknown provider: ${n.provider} for embedding model: ${n.name}`);return}let o=this.getProviderConstructor(n),i=n.apiKey||this.providerApiKeyMap[n.provider](),a=Qr(n);r[a]={hasApiKey:!!i,EmbeddingConstructor:o,vendor:n.provider}}})}static getModelName(e){let r=e;if("model"in r&&r.model)return r.model;if("modelName"in r&&r.modelName)return r.modelName;throw new Error(`Embeddings instance missing model or modelName properties: ${e}`)}getCustomModel(e){return this.activeEmbeddingModels.filter(r=>{let n=Qr(r);return e===n})[0]}async getEmbeddingsAPI(){let{embeddingModelKey:e}=ne();if(!t.modelMap.hasOwnProperty(e))throw new en(`No embedding model found for: ${e}`);let r=this.getCustomModel(e);if(r.plusExclusive&&!ne().isPlusUser)throw new Rce.Notice("Plus-only model, please consider upgrading to Plus to access it."),new en("Plus-only model selected but user is not on Plus plan");if(r.believerExclusive){let a=await Zi.getInstance().validateLicenseKey();if(!a.plan||a.plan.toLowerCase()!=="believer")throw new Rce.Notice("Believer-only model, please consider upgrading to Believer to access it."),new en("Believer-only model selected but user is not on Believer plan")}let n=t.modelMap[e];if(!n.hasApiKey)throw new en(`API key is not provided for the embedding model: ${e}`);let o=await this.getEmbeddingConfig(r);try{return t.embeddingModel=new n.EmbeddingConstructor(o),t.embeddingModel}catch(i){throw new en(`Error creating embedding model: ${e}. ${i.message}`)}}async getEmbeddingConfig(e){let r=ne(),n=e.name,o={maxRetries:3,maxConcurrency:3},a={"copilot-plus":{modelName:n,apiKey:await Co(r.plusLicenseKey),timeout:1e4,batchSize:ne().embeddingBatchSize,configuration:{baseURL:aI,fetch:e.enableCors?wu:void 0}},"copilot-plus-jina":{model:n,apiKey:await Co(r.plusLicenseKey),timeout:1e4,batchSize:ne().embeddingBatchSize,dimensions:e.dimensions,baseUrl:aI+"/embeddings",configuration:{fetch:e.enableCors?wu:void 0}},openai:{modelName:n,apiKey:await Co(e.apiKey||r.openAIApiKey),timeout:1e4,batchSize:ne().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?wu:void 0}},cohereai:{model:n,apiKey:await Co(e.apiKey||r.cohereApiKey)},google:{modelName:n,apiKey:await Co(r.googleApiKey)},"azure openai":{modelName:n,azureOpenAIApiKey:await Co(e.apiKey||r.azureOpenAIApiKey),azureOpenAIApiInstanceName:e.azureOpenAIApiInstanceName||r.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:e.azureOpenAIApiEmbeddingDeploymentName||r.azureOpenAIApiEmbeddingDeploymentName,azureOpenAIApiVersion:e.azureOpenAIApiVersion||r.azureOpenAIApiVersion},ollama:{baseUrl:e.baseUrl||"http://localhost:11434",model:n,truncate:!0,headers:{Authorization:`Bearer ${await Co(e.apiKey||"default-key")}`}},"lm-studio":{modelName:n,openAIApiKey:await Co(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?wu:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await Co(e.apiKey||""),batchSize:ne().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?wu:void 0,dangerouslyAllowBrowser:!0}}}[e.provider]||{};return{...o,...a}}async ping(e){let r=async n=>{let o={...e,enableCors:n},i=await this.getEmbeddingConfig(o);await new(this.getProviderConstructor(o))(i).embedQuery("test")};try{return await r(!1),!0}catch(n){console.log("First ping attempt failed, trying with CORS...");try{return await r(!0),new Rce.Notice("Connection successful, but requires CORS to be enabled. Please enable CORS for this model once you add it above."),!0}catch(o){let i=`
without CORS Error: `+Fn(n)+`
with CORS Error: `+Fn(o);throw new Error(i)}}}}});function c2t(t){return t!==void 0&&nG.includes(t)?u2t[t]:void 0}var u2t,l2t,nG,Nce=b(()=>{u2t={arabic:"ar",armenian:"am",bulgarian:"bg",danish:"dk",dutch:"nl",english:"en",finnish:"fi",french:"fr",german:"de",greek:"gr",hungarian:"hu",indian:"in",indonesian:"id",irish:"ie",italian:"it",lithuanian:"lt",nepali:"np",norwegian:"no",portuguese:"pt",romanian:"ro",russian:"ru",serbian:"rs",slovenian:"ru",spanish:"es",swedish:"se",tamil:"ta",turkish:"tr",ukrainian:"uk",sanskrit:"sk"},l2t={dutch:/[^A-Za-zàèéìòóù0-9_'-]+/gim,english:/[^A-Za-zàèéìòóù0-9_'-]+/gim,french:/[^a-z0-9äâàéèëêïîöôùüûœç-]+/gim,italian:/[^A-Za-zàèéìòóù0-9_'-]+/gim,norwegian:/[^a-z0-9_æøåÆØÅäÄöÖüÜ]+/gim,portuguese:/[^a-z0-9à-úÀ-Ú]/gim,russian:/[^a-z0-9а-яА-ЯёЁ]+/gim,spanish:/[^a-z0-9A-Zá-úÁ-ÚñÑüÜ]+/gim,swedish:/[^a-z0-9_åÅäÄöÖüÜ-]+/gim,german:/[^a-z0-9A-ZäöüÄÖÜß]+/gim,finnish:/[^a-z0-9äöÄÖ]+/gim,danish:/[^a-z0-9æøåÆØÅ]+/gim,hungarian:/[^a-z0-9áéíóöőúüűÁÉÍÓÖŐÚÜŰ]+/gim,romanian:/[^a-z0-9ăâîșțĂÂÎȘȚ]+/gim,serbian:/[^a-z0-9čćžšđČĆŽŠĐ]+/gim,turkish:/[^a-z0-9çÇğĞıİöÖşŞüÜ]+/gim,lithuanian:/[^a-z0-9ąčęėįšųūžĄČĘĖĮŠŲŪŽ]+/gim,arabic:/[^a-z0-9أ-ي]+/gim,nepali:/[^a-z0-9अ-ह]+/gim,irish:/[^a-z0-9áéíóúÁÉÍÓÚ]+/gim,indian:/[^a-z0-9अ-ह]+/gim,armenian:/[^a-z0-9ա-ֆ]+/gim,greek:/[^a-z0-9α-ωά-ώ]+/gim,indonesian:/[^a-z0-9]+/gim,ukrainian:/[^a-z0-9а-яА-ЯіїєІЇЄ]+/gim,slovenian:/[^a-z0-9螚ȎŠ]+/gim,bulgarian:/[^a-z0-9а-яА-Я]+/gim,tamil:/[^a-z0-9அ-ஹ]+/gim,sanskrit:/[^a-z0-9A-Zāīūṛḷṃṁḥśṣṭḍṇṅñḻḹṝ]+/gim},nG=Object.keys(u2t)});function sa(t,e){if(e.length<EBe)Array.prototype.push.apply(t,e);else{let r=e.length;for(let n=0;n<r;n+=EBe)Array.prototype.push.apply(t,e.slice(n,n+EBe))}}function h2t(t,...e){return t.replace(/%(?:(?<position>\d+)\$)?(?<width>-?\d*\.?\d*)(?<type>[dfs])/g,function(...r){let n=r[r.length-1],{width:o,type:i,position:a}=n,s=a?e[Number.parseInt(a)-1]:e.shift(),u=o===""?0:Number.parseInt(o);switch(i){case"d":return s.toString().padStart(u,"0");case"f":{let l=s,[c,d]=o.split(".").map(f=>Number.parseFloat(f));return typeof d=="number"&&d>=0&&(l=l.toFixed(d)),typeof c=="number"&&c>=0?l.toString().padStart(u,"0"):l.toString()}case"s":return u<0?s.toString().padEnd(-u," "):s.toString().padStart(u," ");default:return s}})}function mpn(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function hpn(){return typeof process<"u"&&process.release&&process.release.name==="node"}function m2t(){return BigInt(Math.floor(performance.now()*1e6))}function pF(t){return typeof t=="number"&&(t=BigInt(t)),t<d2t?`${t}ns`:t<f2t?`${t/d2t}\u03BCs`:t<p2t?`${t/f2t}ms`:`${t/p2t}s`}function w_(){return mpn()?m2t():hpn()||typeof process<"u"&&typeof process?.hrtime?.bigint=="function"?process.hrtime.bigint():typeof performance<"u"?m2t():BigInt(0)}function oG(){return`${fpn}-${ppn++}`}function t4(t,e){return Object.hasOwn===void 0?Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0:Object.hasOwn(t,e)?t[e]:void 0}function g2t(t,e){return e[1]===t[1]?t[0]-e[0]:e[1]-t[1]}function r4(t){if(t.length===0)return[];if(t.length===1)return t[0];for(let r=1;r<t.length;r++)if(t[r].length<t[0].length){let n=t[0];t[0]=t[r],t[r]=n}let e=new Map;for(let r of t[0])e.set(r,1);for(let r=1;r<t.length;r++){let n=0;for(let o of t[r]){let i=e.get(o);i===r&&(e.set(o,i+1),n++)}if(n===0)return[]}return t[0].filter(r=>{let n=e.get(r);return n!==void 0&&e.set(r,0),n===t.length})}function jce(t,e){let r={},n=e.length;for(let o=0;o<n;o++){let i=e[o],a=i.split("."),s=t,u=a.length;for(let l=0;l<u;l++)if(s=s[a[l]],typeof s=="object"){if(s!==null&&"lat"in s&&"lon"in s&&typeof s.lat=="number"&&typeof s.lon=="number"){s=r[i]=s;break}else if(!Array.isArray(s)&&s!==null&&l===u-1){s=void 0;break}}else if((s===null||typeof s!="object")&&l<u-1){s=void 0;break}typeof s<"u"&&(r[i]=s)}return r}function n4(t,e){return jce(t,[e])[e]}function PBe(t,e){let r=gpn[e];if(r===void 0)throw new Error(Jt("INVALID_DISTANCE_SUFFIX",t).message);return t*r}function Dce(t,e){t.hits=t.hits.map(r=>({...r,document:{...r.document,...e.reduce((n,o)=>{let i=o.split("."),a=i.pop(),s=n;for(let u of i)s[u]=s[u]??{},s=s[u];return s[a]=null,n},r.document)}}))}function Nu(t){return t?.constructor?.name==="AsyncFunction"}var fpn,ppn,d2t,f2t,p2t,EBe,gpn,pu=b(()=>{Jc();fpn=Date.now().toString().slice(5),ppn=0,d2t=BigInt(1e3),f2t=BigInt(1e6),p2t=BigInt(1e9),EBe=65535;gpn={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344}});function Jt(t,...e){let r=new Error(h2t(bpn[t]??`Unsupported Orama Error code: ${t}`,...e));return r.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}var ypn,bpn,Jc=b(()=>{Nce();pu();ypn=nG.join(`
- `),bpn={NO_LANGUAGE_WITH_CUSTOM_TOKENIZER:"Do not pass the language option to create when using a custom tokenizer.",LANGUAGE_NOT_SUPPORTED:`Language "%s" is not supported.
Supported languages are:
- ${ypn}`,INVALID_STEMMER_FUNCTION_TYPE:"config.stemmer property must be a function.",MISSING_STEMMER:'As of version 1.0.0 @orama/orama does not ship non English stemmers by default. To solve this, please explicitly import and specify the "%s" stemmer from the package @orama/stemmers. See https://docs.oramasearch.com/open-source/text-analysis/stemming for more information.',CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY:"Custom stop words array must only contain strings.",UNSUPPORTED_COMPONENT:'Unsupported component "%s".',COMPONENT_MUST_BE_FUNCTION:'The component "%s" must be a function.',COMPONENT_MUST_BE_FUNCTION_OR_ARRAY_FUNCTIONS:'The component "%s" must be a function or an array of functions.',INVALID_SCHEMA_TYPE:'Unsupported schema type "%s" at "%s". Expected "string", "boolean" or "number" or array of them.',DOCUMENT_ID_MUST_BE_STRING:'Document id must be of type "string". Got "%s" instead.',DOCUMENT_ALREADY_EXISTS:'A document with id "%s" already exists.',DOCUMENT_DOES_NOT_EXIST:'A document with id "%s" does not exists.',MISSING_DOCUMENT_PROPERTY:'Missing searchable property "%s".',INVALID_DOCUMENT_PROPERTY:'Invalid document property "%s": expected "%s", got "%s"',UNKNOWN_INDEX:'Invalid property name "%s". Expected a wildcard string ("*") or array containing one of the following properties: %s',INVALID_BOOST_VALUE:"Boost value must be a number greater than, or less than 0.",INVALID_FILTER_OPERATION:"You can only use one operation per filter, you requested %d.",SCHEMA_VALIDATION_FAILURE:'Cannot insert document due schema validation failure on "%s" property.',INVALID_SORT_SCHEMA_TYPE:'Unsupported sort schema type "%s" at "%s". Expected "string" or "number".',CANNOT_SORT_BY_ARRAY:'Cannot configure sort for "%s" because it is an array (%s).',UNABLE_TO_SORT_ON_UNKNOWN_FIELD:'Unable to sort on unknown field "%s". Allowed fields: %s',SORT_DISABLED:"Sort is disabled. Please read the documentation at https://docs.oramasearch for more information.",UNKNOWN_GROUP_BY_PROPERTY:'Unknown groupBy property "%s".',INVALID_GROUP_BY_PROPERTY:'Invalid groupBy property "%s". Allowed types: "%s", but given "%s".',UNKNOWN_FILTER_PROPERTY:'Unknown filter property "%s".',INVALID_VECTOR_SIZE:'Vector size must be a number greater than 0. Got "%s" instead.',INVALID_VECTOR_VALUE:'Vector value must be a number greater than 0. Got "%s" instead.',INVALID_INPUT_VECTOR:`Property "%s" was declared as a %s-dimensional vector, but got a %s-dimensional vector instead.
Input vectors must be of the size declared in the schema, as calculating similarity between vectors of different sizes can lead to unexpected results.`,WRONG_SEARCH_PROPERTY_TYPE:'Property "%s" is not searchable. Only "string" properties are searchable.',FACET_NOT_SUPPORTED:`Facet doens't support the type "%s".`,INVALID_DISTANCE_SUFFIX:'Invalid distance suffix "%s". Valid suffixes are: cm, m, km, mi, yd, ft.',INVALID_SEARCH_MODE:'Invalid search mode "%s". Valid modes are: "fulltext", "vector", "hybrid".',MISSING_VECTOR_AND_SECURE_PROXY:"No vector was provided and no secure proxy was configured. Please provide a vector or configure an Orama Secure Proxy to perform hybrid search.",MISSING_TERM:'"term" is a required parameter when performing hybrid search. Please provide a search term.',INVALID_VECTOR_INPUT:'Invalid "vector" property. Expected an object with "value" and "property" properties, but got "%s" instead.',PLUGIN_CRASHED:"A plugin crashed during initialization. Please check the error message for more information:",PLUGIN_SECURE_PROXY_NOT_FOUND:`Could not find '@orama/secure-proxy-plugin' installed in your Orama instance.
Please install it before proceeding with creating an answer session.
Read more at https://docs.orama.com/open-source/plugins/plugin-secure-proxy
`,PLUGIN_SECURE_PROXY_MISSING_CHAT_MODEL:`Could not find a chat model defined in the secure proxy plugin configuration.
Please provide a chat model before proceeding with creating an answer session.
Read more at https://docs.orama.com/open-source/plugins/plugin-secure-proxy
`,ANSWER_SESSION_LAST_MESSAGE_IS_NOT_ASSISTANT:"The last message in the session is not an assistant message. Cannot regenerate non-assistant messages."}});function y2t(t){return{raw:Number(t),formatted:pF(t)}}function b2t(t){if(t.id){if(typeof t.id!="string")throw Jt("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return oG()}function TBe(t,e){for(let[r,n]of Object.entries(e)){let o=t[r];if(!(typeof o>"u")&&!(n==="geopoint"&&typeof o=="object"&&typeof o.lon=="number"&&typeof o.lat=="number")&&!(n==="enum"&&(typeof o=="string"||typeof o=="number"))){if(n==="enum[]"&&Array.isArray(o)){let i=o.length;for(let a=0;a<i;a++)if(typeof o[a]!="string"&&typeof o[a]!="number")return r+"."+a;continue}if(HP(n)){let i=IBe(n);if(!Array.isArray(o)||o.length!==i)throw Jt("INVALID_INPUT_VECTOR",r,i,o.length);continue}if(o4(n)){if(!Array.isArray(o))return r;let i=ABe(n),a=o.length;for(let s=0;s<a;s++)if(typeof o[s]!==i)return r+"."+s;continue}if(typeof n=="object"){if(!o||typeof o!="object")return r;let i=TBe(o,n);if(i)return r+"."+i;continue}if(typeof o!==n)return r}}}function _2t(t){return t==="geopoint"}function HP(t){return typeof t=="string"&&/^vector\[\d+\]$/.test(t)}function o4(t){return typeof t=="string"&&_pn[t]}function ABe(t){return vpn[t]}function IBe(t){let e=Number(t.slice(7,-1));switch(!0){case isNaN(e):throw Jt("INVALID_VECTOR_VALUE",t);case e<=0:throw Jt("INVALID_VECTOR_SIZE",t);default:return e}}var _pn,vpn,iG=b(()=>{Jc();pu();pu();_pn={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},vpn={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"}});function v2t(){return{idToInternalId:new Map,internalIdToId:[],save:wpn,load:xpn}}function wpn(t){return{internalIdToId:t.internalIdToId}}function xpn(t,e){let{internalIdToId:r}=e;t.internalDocumentIDStore.idToInternalId.clear(),t.internalDocumentIDStore.internalIdToId=[];let n=r.length;for(let o=0;o<n;o++){let i=r[o];t.internalDocumentIDStore.idToInternalId.set(i,o+1),t.internalDocumentIDStore.internalIdToId.push(i)}}function zi(t,e){if(typeof e=="string"){let r=t.idToInternalId.get(e);if(r)return r;let n=t.idToInternalId.size+1;return t.idToInternalId.set(e,n),t.internalIdToId.push(e),n}return e>t.internalIdToId.length?zi(t,e.toString()):e}function Dy(t,e){if(t.internalIdToId.length<e)throw new Error(`Invalid internalId ${e}`);return t.internalIdToId[e-1]}var Ly=b(()=>{});function Cpn(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function Opn(t,e){let r=zi(t.sharedInternalDocumentStore,e);return t.docs[r]}function Epn(t,e){let r=e.length,n=Array.from({length:r});for(let o=0;o<r;o++){let i=zi(t.sharedInternalDocumentStore,e[o]);n[o]=t.docs[i]}return n}function Ppn(t){return t.docs}function Tpn(t,e,r){let n=zi(t.sharedInternalDocumentStore,e);return typeof t.docs[n]<"u"?!1:(t.docs[n]=r,t.count++,!0)}function Apn(t,e){let r=zi(t.sharedInternalDocumentStore,e);return typeof t.docs[r]>"u"?!1:(delete t.docs[r],t.count--,!0)}function Ipn(t){return t.count}function Mpn(t,e){let r=e;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:t}}function Rpn(t){return{docs:t.docs,count:t.count}}function w2t(){return{create:Cpn,get:Opn,getMultiple:Epn,getAll:Ppn,store:Tpn,remove:Apn,count:Ipn,load:Mpn,save:Rpn}}var MBe=b(()=>{Ly()});function S2t(t,e){let r=[],n=t.plugins?.length;if(!n)return r;for(let o=0;o<n;o++)try{let i=t.plugins[o];typeof i[e]=="function"&&r.push(i[e])}catch(i){throw console.error("Caught error in getAllPluginsByHook:",i),Jt("PLUGIN_CRASHED")}return r}var x2t,C2t=b(()=>{Jc();x2t=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"]});function x_(t,e,r,n){if(t.some(Nu))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function mF(t,e,r){if(t.some(Nu))return(async()=>{for(let o of t)await o(e,r)})();for(let o of t)o(e,r)}function i4(t,e,r,n,o){if(t.some(Nu))return(async()=>{for(let a of t)await a(e,r,n,o)})();for(let a of t)a(e,r,n,o)}function a4(t,e,r,n){if(t.some(Nu))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function E2t(t,e){if(t.some(Nu))return(async()=>{for(let n of t)await n(e)})();for(let n of t)n(e)}var O2t,RBe,fR=b(()=>{pu();O2t=["tokenizer","index","documentsStore","sorter"],RBe=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"]});function NBe(t){let e=t.r;return t.r=e.l,e.l=t,t.h=Math.max(Fy(t.l),Fy(t.r))+1,e.h=Math.max(Fy(e.l),Fy(e.r))+1,e}function jBe(t){let e=t.l;return t.l=e.r,e.r=t,t.h=Math.max(Fy(t.l),Fy(t.r))+1,e.h=Math.max(Fy(e.l),Fy(e.r))+1,e}function T2t(t,e,r){let n=[];function o(i){i!==null&&(e<i.k&&o(i.l),i.k>=e&&i.k<=r&&sa(n,i.v),r>i.k&&o(i.r))}return o(t.root),n}function DBe(t,e,r=!1){let n=[];if(t===null)return n;let o=[t.root];for(;o.length>0;){let i=o.pop();i&&(r&&i.k>=e&&sa(n,i.v),!r&&i.k>e&&sa(n,i.v),o.push(i.r),o.push(i.l))}return n}function LBe(t,e,r=!1){let n=[];if(t===null)return n;let o=[t.root];for(;o.length>0;){let i=o.pop();i&&(r&&i.k<=e&&sa(n,i.v),!r&&i.k<e&&sa(n,i.v),o.push(i.r),o.push(i.l))}return n}function A2t(t,e){for(;t!==null;)if(e<t.k)t=t.l;else if(e>t.k)t=t.r;else return t;return null}function I2t(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}function M2t(t,e,r,n=500){function o(i,a,s){if(i===null)return P2t++,{k:a,v:s,l:null,r:null,h:0};if(a<i.k)i.l=o(i.l,a,s);else if(a>i.k)i.r=o(i.r,a,s);else return i.v.push(...s),i;return P2t%n===0?jpn(i,a):i}t.root=o(t.root,e,r)}function jpn(t,e){t.h=1+Math.max(Fy(t.l),Fy(t.r));let r=Fy(t.l)-Fy(t.r);return r>1&&e<t.l.k?jBe(t):r<-1&&e>t.r.k?NBe(t):r>1&&e>t.l.k?(t.l=NBe(t.l),jBe(t)):r<-1&&e<t.r.k?(t.r=jBe(t.r),NBe(t)):t}function Fy(t){return t!==null?t.h:-1}function R2t(t,e){let r=A2t(t.root,e);return r===null?null:r.v}function Dpn(t,e){if(t===null||t.root===null)return;let r=t.root,n=null;for(;r!=null&&r.k!==e;)n=r,e<r.k?r=r.l:r=r.r;if(r===null)return;(()=>{if(r.l===null&&r.r===null)n===null?t.root=null:n.l===r?n.l=null:n.r=null;else if(r.l!=null&&r.r!=null){let i=r.r,a=r;for(;i.l!=null;)a=i,i=i.l;r.k=i.k,a===r?a.r=i.r:a.l=i.r}else{let i=r.l!=null?r.l:r.r;n===null?t.root=i:n.l===r?n.l=i:n.r=i}})()}function N2t(t,e,r){let n=A2t(t.root,r);if(n){if(n.v.length===1){Dpn(t,r);return}n.v.splice(n.v.indexOf(e),1)}}var P2t,j2t=b(()=>{pu();P2t=0});function D2t(){return{numberToDocumentId:new Map}}function L2t(t,e,r){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(r),t):(t.numberToDocumentId.set(e,[r]),t)}function F2t(t,e,r){t?.numberToDocumentId.set(r,t?.numberToDocumentId.get(r)?.filter(n=>n!==e)??[]),t?.numberToDocumentId.get(r)?.length===0&&t?.numberToDocumentId.delete(r)}function k2t(t,e){let r=Object.keys(e);if(r.length!==1)throw new Error("Invalid operation");let n=r[0];switch(n){case"eq":{let o=e[n];return t.numberToDocumentId.get(o)??[]}case"in":{let o=e[n],i=[];for(let a of o){let s=t.numberToDocumentId.get(a);s!=null&&sa(i,s)}return i}case"nin":{let o=e[n],i=[],a=t.numberToDocumentId.keys();for(let s of a){if(o.includes(s))continue;let u=t.numberToDocumentId.get(s);u!=null&&sa(i,u)}return i}}throw new Error("Invalid operation")}function $2t(t,e){let r=Object.keys(e);if(r.length!==1)throw new Error("Invalid operation");let n=r[0];switch(n){case"containsAll":{let i=e[n].map(a=>t.numberToDocumentId.get(a)??[]);return r4(i)}}throw new Error("Invalid operation")}var B2t=b(()=>{pu()});function Lpn(t,e,r){if(r<0)return-1;if(t===e)return 0;let n=t.length,o=e.length;if(n===0)return o<=r?o:-1;if(o===0)return n<=r?n:-1;if(t=t.toLowerCase(),e=e.toLowerCase(),e.startsWith(t)||t.startsWith(e))return 0;if(Math.abs(n-o)>r)return-1;let i=[];for(let a=0;a<=n;a++){i[a]=[a];for(let s=1;s<=o;s++)i[a][s]=a===0?s:0}for(let a=1;a<=n;a++){let s=1/0;for(let u=1;u<=o;u++)t[a-1]===e[u-1]?i[a][u]=i[a-1][u-1]:i[a][u]=Math.min(i[a-1][u]+1,i[a][u-1]+1,i[a-1][u-1]+1),s=Math.min(s,i[a][u]);if(s>r)return-1}return i[n][o]<=r?i[n][o]:-1}function FBe(t,e,r){let n=Lpn(t,e,r);return{distance:n,isBounded:n>=0}}var kBe=b(()=>{});function s4(t,e){t.w=e.w+t.s}function Lce(t,e){t.d.push(e)}function Fpn(t,e){let r=t.d.indexOf(e);return r===-1?!1:(t.d.splice(r,1),!0)}function BBe(t,e,r,n,o){if(t.e){let{w:i,d:a}=t;if(n&&i!==r)return{};if(t4(e,i)==null&&(o?Math.abs(r.length-i.length)<=o&&FBe(r,i,o).isBounded&&(e[i]=[]):e[i]=[]),t4(e,i)!=null&&a.length>0){let s=new Set(e[i]),u=a.length;for(let l=0;l<u;l++)s.add(a[l]);e[i]=Array.from(s)}}for(let i of Object.keys(t.c))BBe(t.c[i],e,r,n,o);return e}function z2t(t,e){let r="",n=Math.min(t.length,e.length);for(let o=0;o<n;o++){if(t[o]!==e[o])return r;r+=t[o]}return r}function hF(t=!1,e="",r=""){return new $Be(r,e,t)}function U2t(t,e,r){let n=e.length;for(let o=0;o<n;o++){let i=e[o],a=e.substring(o),s=t.c[i];if(s){let u=s.s,l=u.length,c=z2t(u,a),d=c.length;if(u===a){Lce(s,r),s.e=!0;return}let f=u[d];if(d<l&&d===a.length){let p=hF(!0,a,i);p.c[f]=s;let m=p.c[f];m.s=u.substring(d),m.k=f,t.c[i]=p,s4(p,t),s4(m,p),Lce(p,r);return}if(d<l&&d<a.length){let p=hF(!1,c,i);p.c[f]=s,t.c[i]=p;let m=p.c[f];m.s=u.substring(d),m.k=f;let h=a[d],y=hF(!0,e.substring(o+d),h);Lce(y,r),p.c[h]=y,s4(p,t),s4(y,p),s4(m,p);return}o+=l-1,t=s}else{let u=hF(!0,a,i);Lce(u,r),t.c[i]=u,s4(u,t);return}}}function aG(t,e,r,n,o,i){if(!(n<0)){if(t.w.startsWith(e)){BBe(t,i,e,!1,0);return}if(t.e){let{w:a,d:s}=t;if(a&&(FBe(e,a,o).isBounded&&(i[a]=[]),t4(i,a)!=null&&s.length>0)){let u=new Set(i[a]),l=s.length;for(let c=0;c<l;c++)u.add(s[c]);i[a]=Array.from(u)}}if(!(r>=e.length)){e[r]in t.c&&aG(t.c[e[r]],e,r+1,n,o,i),aG(t,e,r+1,n-1,o,i);for(let a in t.c)aG(t.c[a],e,r,n-1,o,i);for(let a in t.c)a!==e[r]&&aG(t.c[a],e,r+1,n-1,o,i)}}}function zBe(t,{term:e,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,aG(t,e,0,n||0,n,o),o}else{let o=e.length;for(let a=0;a<o;a++){let s=e[a];if(s in t.c){let u=t.c[s],l=u.s,c=e.substring(a),f=z2t(l,c).length;if(f!==l.length&&f!==c.length){if(n)break;return{}}a+=u.s.length-1,t=u}else return{}}let i={};return BBe(t,i,e,r,n),i}}function q2t(t,e,r,n=!0){if(!e)return!0;let o=e.length;for(let i=0;i<o;i++){let a=e[i];if(a in t.c){let s=t.c[a];i+=s.s.length-1,t=s,n&&t.w!==e||Fpn(t,r)}else return!1}return!0}var $Be,H2t=b(()=>{kBe();pu();$Be=class{constructor(e,r,n){bd(this,"k");bd(this,"s");bd(this,"c",{});bd(this,"d",[]);bd(this,"e");bd(this,"w","");this.k=e,this.s=r,this.e=n}toJSON(){return{w:this.w,s:this.s,c:this.c,d:this.d,e:this.e}}}});function V2t(){return{root:null}}function W2t(t,e,r){let n={point:e,docIDs:r};if(t.root==null){t.root=n;return}let o=t.root,i=0;for(;o!==null;){if(o.point.lon===e.lon&&o.point.lat===e.lat){let s=o.docIDs??[];o.docIDs=Array.from(new Set([...s,...r||[]]));return}if(i%2===0)if(e.lon<o.point.lon){if(o.left==null){o.left=n;return}o=o.left}else{if(o.right==null){o.right=n;return}o=o.right}else if(e.lat<o.point.lat){if(o.left==null){o.left=n;return}o=o.left}else{if(o.right==null){o.right=n;return}o=o.right}i++}}function K2t(t,e,r){let n=t.root,o=0,i=null,a=null;for(;n!==null;){if(n?.point.lon===e.lon&&n.point.lat===e.lat){let u=n.docIDs?.indexOf(r);if(u!==void 0&&u>-1){n.docIDs?.splice(u,1),(n.docIDs==null||n.docIDs.length===0)&&(i!=null?a==="left"?i.left=n.left!==null?n.left:n.right:a==="right"&&(i.right=n.right!==null?n.right:n.left):t.root=n.left!==null?n.left:n.right);return}}let s=o%2;i=n,s===0?e.lon<n.point.lon?(n=n?.left,a="left"):(n=n?.right,a="right"):e.lat<n.point.lat?(n=n?.left,a="left"):(n=n?.right,a="right"),o++}}function G2t(t,e,r,n=!0,o="asc",i=!1){let a=i?Y2t:Z2t,s=[{node:t,depth:0}],u=[];for(;s.length>0;){let{node:l,depth:c}=s.pop();if(l===null)continue;let d=a(e,l.point);(n?d<=r:d>r)&&u.push({point:l.point,docIDs:l.docIDs??[]}),l.left!=null&&s.push({node:l.left,depth:c+1}),l.right!=null&&s.push({node:l.right,depth:c+1})}return o&&u.sort((l,c)=>{let d=a(e,l.point),f=a(e,c.point);return o.toLowerCase()==="asc"?d-f:f-d}),u}function J2t(t,e,r=!0,n=null,o=!1){let i=[{node:t,depth:0}],a=[];for(;i.length>0;){let u=i.pop();if(u==null||u.node==null)continue;let{node:l,depth:c}=u,d=c+1;l.left!=null&&i.push({node:l.left,depth:d}),l.right!=null&&i.push({node:l.right,depth:d});let f=$pn(e,l.point);f&&r?a.push({point:l.point,docIDs:l.docIDs??[]}):!f&&!r&&a.push({point:l.point,docIDs:l.docIDs??[]})}let s=kpn(e);if(n){let u=o?Y2t:Z2t;a.sort((l,c)=>{let d=u(s,l.point),f=u(s,c.point);return n.toLowerCase()==="asc"?d-f:f-d})}return a}function kpn(t){let e=0,r=0,n=0,o=t.length;for(let a=0,s=o-1;a<o;s=a++){let u=t[a].lon,l=t[a].lat,c=t[s].lon,d=t[s].lat,f=u*d-c*l;e+=f,r+=(u+c)*f,n+=(l+d)*f}e/=2;let i=6*e;return r/=i,n/=i,{lon:r,lat:n}}function $pn(t,e){let r=!1,n=e.lon,o=e.lat,i=t.length;for(let a=0,s=i-1;a<i;s=a++){let u=t[a].lon,l=t[a].lat,c=t[s].lon,d=t[s].lat;l>o!=d>o&&n<(c-u)*(o-l)/(d-l)+u&&(r=!r)}return r}function Z2t(t,e){let r=Math.PI/180,n=t.lat*r,o=e.lat*r,i=(e.lat-t.lat)*r,a=(e.lon-t.lon)*r,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(o)*Math.sin(a/2)*Math.sin(a/2);return 6371e3*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}function Y2t(t,e){let n=.0033528106647474805,o=(1-n)*6378137,i=Math.PI/180,a=t.lat*i,s=e.lat*i,u=(e.lon-t.lon)*i,l=Math.atan((1-n)*Math.tan(a)),c=Math.atan((1-n)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(c),m=Math.cos(c),h=u,y,g=1e3,_,w,S,C,E;do{let D=Math.sin(h),k=Math.cos(h);S=Math.sqrt(m*D*(m*D)+(f*p-d*m*k)*(f*p-d*m*k)),C=d*p+f*m*k,E=Math.atan2(S,C),_=f*m*D/S,w=1-_*_;let L=C-2*d*p/w,H=n/16*w*(4+n*(4-3*w));y=h,h=u+(1-H)*n*_*(E+H*S*(L+H*C*(-1+2*L*L)))}while(Math.abs(h-y)>1e-12&&--g>0);let P=w*(6378137*6378137-o*o)/(o*o),T=1+P/16384*(4096+P*(-768+P*(320-175*P))),I=P/1024*(256+P*(-128+P*(74-47*P))),N=I*S*(C-2*d*p/w+I/4*(C*(-1+2*S*S)-I/6*E*(-3+4*S*S)*(-3+4*E*E)));return o*T*(E-N)}var X2t=b(()=>{});function Fce(t,e,r=0,n){if(e===0)throw Jt("INVALID_BOOST_VALUE");let o=new Map,i=t.length;for(let h=0;h<i;h++){let y=t[h],g=y.length;for(let _=0;_<g;_++){let[w,S]=y[_],C=S*e,E=o.get(w)?.[0];E!==void 0?o.set(w,[E*1.5+C,(o?.get(w)?.[1]||0)+1]):o.set(w,[C,1])}}let a=[];for(let h of o.entries())a.push([h[0],h[1][0]]);let s=a.sort((h,y)=>y[1]-h[1]);if(r===1)return s;let u=s.length,l=[];for(let h of o.entries())l.push([h[0],h[1][0],h[1][1]]);let c=l.sort((h,y)=>h[2]>y[2]?-1:h[2]<y[2]?1:h[1]>y[1]?-1:h[1]<y[1]?1:0),d;for(let h=0;h<u&&c[h][2]===n;h++)d=h;if(typeof d>"u"){if(r===0)return[];d=0}let f=c.length,p=new Array(f);for(let h=0;h<f;h++)p[h]=[c[h][0],c[h][1]];if(r===0)return p.slice(0,d+1);let m=d+Math.ceil(r*100*(u-d)/100);return p.slice(0,u+m)}function UBe(t,e,r,n,o,{k:i,b:a,d:s}){return Math.log(1+(r-e+.5)/(e+.5))*(s+t*(i+1))/(t+i*(1-a+a*n/o))}var sG=b(()=>{Jc()});function qBe(t,e){let r=0;for(let n=0;n<e;n++)r+=t[n]*t[n];return Math.sqrt(r)}function kce(t,e,r,n=.8){let o=qBe(t,r),i=[];for(let[a,[s,u]]of Object.entries(e)){let l=0;for(let d=0;d<r;d++)l+=t[d]*u[d];let c=l/(o*s);c>=n&&i.push([a,c])}return i.sort((a,s)=>s[1]-a[1])}var $ce=b(()=>{});function Bpn(t,e,r,n,o){let i=zi(t.sharedInternalDocumentStore,r);t.avgFieldLength[e]=((t.avgFieldLength[e]??0)*(o-1)+n.length)/o,t.fieldLengths[e][i]=n.length,t.frequencies[e][i]={}}function zpn(t,e,r,n,o){let i=0;for(let u of n)u===o&&i++;let a=zi(t.sharedInternalDocumentStore,r),s=i/n.length;t.frequencies[e][a][o]=s,o in t.tokenOccurrences[e]||(t.tokenOccurrences[e][o]=0),t.tokenOccurrences[e][o]=(t.tokenOccurrences[e][o]??0)+1}function Upn(t,e,r,n){let o=zi(t.sharedInternalDocumentStore,r);n>1?t.avgFieldLength[e]=(t.avgFieldLength[e]*n-t.fieldLengths[e][o])/(n-1):t.avgFieldLength[e]=void 0,t.fieldLengths[e][o]=void 0,t.frequencies[e][o]=void 0}function qpn(t,e,r){t.tokenOccurrences[e][r]--}function Hpn(t,e,r,n,o){let i=Array.from(o),a=e.avgFieldLength[r],s=e.fieldLengths[r],u=e.tokenOccurrences[r],l=e.frequencies[r],c=typeof u[n]=="number"?u[n]??0:0,d=[],f=i.length;for(let p=0;p<f;p++){let m=zi(e.sharedInternalDocumentStore,i[p]),h=l?.[m]?.[n]??0,y=UBe(h,c,t.docsCount,s[m],a,t.params.relevance);d.push([m,y])}return d}function e4t(t,e,r,n,o=""){n||(n={sharedInternalDocumentStore:e,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}});for(let[i,a]of Object.entries(r)){let s=`${o}${o?".":""}${i}`;if(typeof a=="object"&&!Array.isArray(a)){e4t(t,e,a,n,s);continue}if(HP(a))n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a,n.vectorIndexes[s]={size:IBe(a),vectors:{}};else{let u=/\[/.test(a);switch(a){case"boolean":case"boolean[]":n.indexes[s]={type:"Bool",node:{true:[],false:[]},isArray:u};break;case"number":case"number[]":n.indexes[s]={type:"AVL",node:I2t(0,[]),isArray:u};break;case"string":case"string[]":n.indexes[s]={type:"Radix",node:hF(),isArray:u},n.avgFieldLength[s]=0,n.frequencies[s]={},n.tokenOccurrences[s]={},n.fieldLengths[s]={};break;case"enum":case"enum[]":n.indexes[s]={type:"Flat",node:D2t(),isArray:u};break;case"geopoint":n.indexes[s]={type:"BKD",node:V2t(),isArray:u};break;default:throw Jt("INVALID_SCHEMA_TYPE",Array.isArray(a)?"array":a,s)}n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a}}return n}function Vpn(t,e,r,n,o,i,a,s){return u=>{let l=zi(e.sharedInternalDocumentStore,n),{type:c,node:d}=e.indexes[r];switch(c){case"Bool":{d[u?"true":"false"].push(l);break}case"AVL":{let f=s?.avlRebalanceThreshold??1;M2t(d,u,[l],f);break}case"Radix":{let f=i.tokenize(u,o,r);t.insertDocumentScoreParameters(e,r,l,f,a);for(let p of f)t.insertTokenScoreParameters(e,r,l,f,p),U2t(d,p,l);break}case"Flat":{L2t(d,u,l);break}case"BKD":{W2t(d,u,[l]);break}}}}function Wpn(t,e,r,n,o,i,a,s,u,l){if(HP(i))return Kpn(e,r,o,n);let c=Vpn(t,e,r,n,a,s,u,l);if(!o4(i))return c(o);let d=o,f=d.length;for(let p=0;p<f;p++)c(d[p])}function Kpn(t,e,r,n){r instanceof Float32Array||(r=new Float32Array(r));let o=t.vectorIndexes[e].size,i=qBe(r,o);t.vectorIndexes[e].vectors[n]=[i,r]}function Q2t(t,e,r,n,o,i,a,s,u){let l=zi(e.sharedInternalDocumentStore,n);if(HP(i))return delete e.vectorIndexes[r].vectors[n],!0;let{type:c,node:d}=e.indexes[r];switch(c){case"AVL":return N2t(d,l,o),!0;case"Bool":{let p=d[o?"true":"false"].indexOf(l);return d[o?"true":"false"].splice(p,1),!0}case"Radix":{let f=s.tokenize(o,a,r);t.removeDocumentScoreParameters(e,r,n,u);for(let p of f)t.removeTokenScoreParameters(e,r,p),q2t(d,p,l);return!0}case"Flat":return F2t(d,l,o),!0;case"BKD":return K2t(d,o,l),!1}}function Gpn(t,e,r,n,o,i,a,s,u){if(!o4(i))return Q2t(t,e,r,n,o,i,a,s,u);let l=ABe(i),c=o,d=c.length;for(let f=0;f<d;f++)Q2t(t,e,r,n,c[f],l,a,s,u);return!0}function Jpn(t,e,r,n){if(!(r in e.tokenOccurrences))return[];let{node:o,type:i}=e.indexes[r];if(i!=="Radix")throw Jt("WRONG_SEARCH_PROPERTY_TYPE",r);let{exact:a,tolerance:s}=t.params,u=zBe(o,{term:n,exact:a,tolerance:s}),l=new Set;for(let c in u)if(t4(u,c))for(let f of u[c])l.add(f);return t.index.calculateResultScores(t,e,r,n,Array.from(l))}function Zpn(t,e,r){let n=Object.keys(r),o=n.reduce((i,a)=>({[a]:[],...i}),{});for(let i of n){let a=r[i];if(typeof e.indexes[i]>"u")throw Jt("UNKNOWN_FILTER_PROPERTY",i);let{node:s,type:u,isArray:l}=e.indexes[i];if(u==="Bool"){let f=s[a.toString()];sa(o[i],f);continue}if(u==="BKD"){let d;if("radius"in a)d="radius";else if("polygon"in a)d="polygon";else throw new Error(`Invalid operation ${a}`);if(d==="radius"){let{value:f,coordinates:p,unit:m="m",inside:h=!0,highPrecision:y=!1}=a[d],g=PBe(f,m),_=G2t(s.root,p,g,h,void 0,y);sa(o[i],_.flatMap(({docIDs:w})=>w))}else{let{coordinates:f,inside:p=!0,highPrecision:m=!1}=a[d],h=J2t(s.root,f,p,void 0,m);sa(o[i],h.flatMap(({docIDs:y})=>y))}continue}if(u==="Radix"&&(typeof a=="string"||Array.isArray(a))){for(let d of[a].flat()){let f=t.tokenizer.tokenize(d,t.language,i);for(let p of f){let m=zBe(s,{term:p,exact:!0});sa(o[i],Object.values(m).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw Jt("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?$2t:k2t;sa(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=DBe(s,f,!1);break}case"gte":{p=DBe(s,f,!0);break}case"lt":{p=LBe(s,f,!1);break}case"lte":{p=LBe(s,f,!0);break}case"eq":{p=R2t(s,f)??[];break}case"between":{let[m,h]=f;p=T2t(s,m,h);break}}sa(o[i],p)}}return r4(Object.values(o))}function Ypn(t){return t.searchableProperties}function Xpn(t){return t.searchablePropertiesWithTypes}function t4t(t){let e=hF(t.e,t.s,t.k);e.d=t.d,e.w=t.w;for(let r of Object.keys(t.c))e.c[r]=t4t(t.c[r]);return e}function Qpn(t){return{numberToDocumentId:new Map(t)}}function emn(t){return Array.from(t.numberToDocumentId.entries())}function tmn(t,e){let{indexes:r,vectorIndexes:n,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}=e,c={},d={};for(let f of Object.keys(r)){let{node:p,type:m,isArray:h}=r[f];switch(m){case"Radix":c[f]={type:"Radix",node:t4t(p),isArray:h};break;case"Flat":c[f]={type:"Flat",node:Qpn(p),isArray:h};break;default:c[f]=r[f]}}for(let f of Object.keys(n)){let p=n[f].vectors;for(let m in p)p[m]=[p[m][0],new Float32Array(p[m][1])];d[f]={size:n[f].size,vectors:p}}return{sharedInternalDocumentStore:t,indexes:c,vectorIndexes:d,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}}function rmn(t){let{indexes:e,vectorIndexes:r,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}=t,l={};for(let d of Object.keys(r)){let f=r[d].vectors;for(let p in f)f[p]=[f[p][0],Array.from(f[p][1])];l[d]={size:r[d].size,vectors:f}}let c={};for(let d of Object.keys(e)){let{type:f,node:p,isArray:m}=e[d];if(f!=="Flat"){c[d]=e[d];continue}c[d]={type:"Flat",node:emn(p),isArray:m}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function r4t(){return{create:e4t,insert:Wpn,remove:Gpn,insertDocumentScoreParameters:Bpn,insertTokenScoreParameters:zpn,removeDocumentScoreParameters:Upn,removeTokenScoreParameters:qpn,calculateResultScores:Hpn,search:Jpn,searchByWhereClause:Zpn,getSearchableProperties:Ypn,getSearchablePropertiesWithTypes:Xpn,load:tmn,save:rmn}}var HBe=b(()=>{Jc();j2t();B2t();H2t();X2t();pu();sG();$ce();iG();Ly()});function n4t(t,e,r,n,o){let i={language:t.tokenizer.language,sharedInternalDocumentStore:e,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(let[a,s]of Object.entries(r)){let u=`${o}${o?".":""}${a}`;if(!n.includes(u)){if(typeof s=="object"&&!Array.isArray(s)){let l=n4t(t,e,s,n,u);sa(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!HP(s))switch(s){case"boolean":case"number":case"string":i.sortableProperties.push(u),i.sortablePropertiesWithTypes[u]=s,i.sorts[u]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:s};break;case"geopoint":case"enum":continue;case"enum[]":case"boolean[]":case"number[]":case"string[]":continue;default:throw Jt("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function omn(t,e,r,n){return n?.enabled!==!1?n4t(t,e,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function imn(t,e,r,n){if(!t.enabled)return;t.isSorted=!1;let o=zi(t.sharedInternalDocumentStore,r),i=t.sorts[e];i.orderedDocsToRemove.has(o)&&VBe(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function o4t(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let r of e)lmn(t,r);t.isSorted=!0}function amn(t,e,r){return e[1].localeCompare(r[1],c2t(t))}function smn(t,e){return t[1]-e[1]}function umn(t,e){return e[1]?-1:1}function lmn(t,e){let r=t.sorts[e],n;switch(r.type){case"string":n=amn.bind(null,t.language);break;case"number":n=smn.bind(null);break;case"boolean":n=umn.bind(null);break}r.orderedDocs.sort(n);let o=r.orderedDocs.length;for(let i=0;i<o;i++){let a=r.orderedDocs[i][0];r.docs.set(a,i)}}function cmn(t){let e=Object.keys(t.sorts);for(let r of e)VBe(t,r)}function VBe(t,e){let r=t.sorts[e];r.orderedDocsToRemove.size&&(r.orderedDocs=r.orderedDocs.filter(n=>!r.orderedDocsToRemove.has(n[0])),r.orderedDocsToRemove.clear())}function dmn(t,e,r){if(!t.enabled)return;let n=t.sorts[e],o=zi(t.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function fmn(t,e,r){if(!t.enabled)throw Jt("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=t.sorts[n];if(!i)throw Jt("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,t.sortableProperties.join(", "));return VBe(t,n),o4t(t),e.sort((a,s)=>{let u=i.docs.get(zi(t.sharedInternalDocumentStore,a[0])),l=i.docs.get(zi(t.sharedInternalDocumentStore,s[0])),c=typeof u<"u",d=typeof l<"u";return!c&&!d?0:c?d?o?l-u:u-l:-1:1}),e}function pmn(t){return t.enabled?t.sortableProperties:[]}function mmn(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function hmn(t,e){let r=e;if(!r.enabled)return{enabled:!1};let n=Object.keys(r.sorts).reduce((o,i)=>{let{docs:a,orderedDocs:s,type:u}=r.sorts[i];return o[i]={docs:new Map(Object.entries(a).map(([l,c])=>[+l,c])),orderedDocsToRemove:new Map,orderedDocs:s,type:u},o},{});return{sharedInternalDocumentStore:t,language:r.language,sortableProperties:r.sortableProperties,sortablePropertiesWithTypes:r.sortablePropertiesWithTypes,sorts:n,enabled:!0,isSorted:r.isSorted}}function gmn(t){if(!t.enabled)return{enabled:!1};cmn(t),o4t(t);let e=Object.keys(t.sorts).reduce((r,n)=>{let{docs:o,orderedDocs:i,type:a}=t.sorts[n];return r[n]={docs:Object.fromEntries(o.entries()),orderedDocs:i,type:a},r},{});return{language:t.language,sortableProperties:t.sortableProperties,sortablePropertiesWithTypes:t.sortablePropertiesWithTypes,sorts:e,enabled:t.enabled,isSorted:t.isSorted}}function i4t(){return{create:omn,insert:imn,remove:dmn,save:gmn,load:hmn,sortBy:fmn,getSortableProperties:pmn,getSortablePropertiesWithTypes:mmn}}var WBe=b(()=>{Jc();iG();Ly();pu();Nce()});function _mn(t){return t<192||t>383?t:bmn[t-192]||t}function a4t(t){let e=[];for(let r=0;r<t.length;r++)e[r]=_mn(t.charCodeAt(r));return String.fromCharCode(...e)}var bmn,s4t=b(()=>{bmn=[65,65,65,65,65,65,65,67,69,69,69,69,73,73,73,73,69,78,79,79,79,79,79,null,79,85,85,85,85,89,80,115,97,97,97,97,97,97,97,99,101,101,101,101,105,105,105,105,101,110,111,111,111,111,111,null,111,117,117,117,117,121,112,121,65,97,65,97,65,97,67,99,67,99,67,99,67,99,68,100,68,100,69,101,69,101,69,101,69,101,69,101,71,103,71,103,71,103,71,103,72,104,72,104,73,105,73,105,73,105,73,105,73,105,73,105,74,106,75,107,107,76,108,76,108,76,108,76,108,76,108,78,110,78,110,78,110,110,78,110,79,111,79,111,79,111,79,111,82,114,82,114,82,114,83,115,83,115,83,115,83,115,84,116,84,116,84,116,85,117,85,117,85,117,85,117,85,117,85,117,87,119,89,121,89,90,122,90,122,90,122,115]});function l4t(t){let e,r,n,o,i,a;if(t.length<3)return t;let s=t.substring(0,1);if(s=="y"&&(t=s.toUpperCase()+t.substring(1)),n=/^(.+?)(ss|i)es$/,o=/^(.+?)([^s])s$/,n.test(t)?t=t.replace(n,"$1$2"):o.test(t)&&(t=t.replace(o,"$1$2")),n=/^(.+?)eed$/,o=/^(.+?)(ed|ing)$/,n.test(t)){let u=n.exec(t);n=new RegExp(KBe),n.test(u[1])&&(n=/.$/,t=t.replace(n,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(u4t),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+cO+zce+"[^aeiouwxy]$"),o.test(t)?t=t+"e":i.test(t)?(n=/.$/,t=t.replace(n,"")):a.test(t)&&(t=t+"e")));if(n=/^(.+?)y$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(u4t),e&&n.test(e)&&(t=e+"i")),n=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,n.test(t)){let u=n.exec(t);e=u?.[1],r=u?.[2],n=new RegExp(KBe),e&&n.test(e)&&(t=e+vmn[r])}if(n=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,n.test(t)){let u=n.exec(t);e=u?.[1],r=u?.[2],n=new RegExp(KBe),e&&n.test(e)&&(t=e+wmn[r])}if(n=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,o=/^(.+?)(s|t)(ion)$/,n.test(t))e=n.exec(t)?.[1],n=new RegExp(Bce),e&&n.test(e)&&(t=e);else if(o.test(t)){let u=o.exec(t);e=u?.[1]??""+u?.[2]??"",o=new RegExp(Bce),o.test(e)&&(t=e)}return n=/^(.+?)e$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(Bce),o=new RegExp(Smn),i=new RegExp("^"+cO+zce+"[^aeiouwxy]$"),e&&(n.test(e)||o.test(e)&&!i.test(e))&&(t=e)),n=/ll$/,o=new RegExp(Bce),n.test(t)&&o.test(t)&&(n=/.$/,t=t.replace(n,"")),s=="y"&&(t=s.toLowerCase()+t.substring(1)),t}var vmn,wmn,xmn,zce,cO,uG,KBe,Smn,Bce,u4t,c4t=b(()=>{vmn={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},wmn={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},xmn="[^aeiou]",zce="[aeiouy]",cO=xmn+"[^aeiouy]*",uG=zce+"[aeiou]*",KBe="^("+cO+")?"+uG+cO,Smn="^("+cO+")?"+uG+cO+"("+uG+")?$",Bce="^("+cO+")?"+uG+cO+uG+cO,u4t="^("+cO+")?"+zce});function GBe(t,e){let r=`${this.language}:${t}:${e}`;return this.normalizationCache.has(r)?this.normalizationCache.get(r):this.stopWords?.includes(e)?(this.normalizationCache.set(r,""),""):(this.stemmer&&!this.stemmerSkipProperties.has(t)&&(e=this.stemmer(e)),e=a4t(e),this.normalizationCache.set(r,e),e)}function Cmn(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function d4t(t,e,r){if(e&&e!==this.language)throw Jt("LANGUAGE_NOT_SUPPORTED",e);if(typeof t!="string")return[t];let n;if(r&&this.tokenizeSkipProperties.has(r))n=[this.normalizeToken.bind(this,r??"")(t)];else{let i=l2t[this.language];n=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=Cmn(n);return this.allowDuplicates?o:Array.from(new Set(o))}function JBe(t={}){if(!t.language)t.language="english";else if(!nG.includes(t.language))throw Jt("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw Jt("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=l4t;else throw Jt("MISSING_STEMMER",t.language);let r;if(t.stopWords!==!1){if(r=[],Array.isArray(t.stopWords))r=t.stopWords;else if(typeof t.stopWords=="function")r=t.stopWords(r);else if(t.stopWords)throw Jt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw Jt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw Jt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:d4t,language:t.language,stemmer:e,stemmerSkipProperties:new Set(t.stemmerSkipProperties?[t.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(t.tokenizeSkipProperties?[t.tokenizeSkipProperties].flat():[]),stopWords:r,allowDuplicates:!!t.allowDuplicates,normalizeToken:GBe,normalizationCache:new Map};return n.tokenize=d4t.bind(n),n.normalizeToken=GBe,n}var Uce=b(()=>{Jc();s4t();Nce();c4t()});function Emn(t){let e={formatElapsedTime:y2t,getDocumentIndexId:b2t,getDocumentProperties:jce,validateSchema:TBe};for(let r of RBe){let n=r;if(t[n]){if(typeof t[n]!="function")throw Jt("COMPONENT_MUST_BE_FUNCTION",n)}else t[n]=e[n]}for(let r of Object.keys(t))if(!O2t.includes(r)&&!RBe.includes(r))throw Jt("UNSUPPORTED_COMPONENT",r)}function u4({schema:t,sort:e,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=oG());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=JBe(a):a=JBe({language:r??"english"}),n.tokenizer&&r)throw Jt("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=v2t();s||(s=r4t()),l||(l=i4t()),u||(u=w2t()),Emn(n);let{getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,formatElapsedTime:m}=n,h={data:{},caches:{},schema:t,tokenizer:a,index:s,sorter:l,documentsStore:u,internalDocumentIDStore:c,getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],afterUpdateMultiple:[],beforeUpdateMultiple:[],afterCreate:[],formatElapsedTime:m,id:o,plugins:i,version:Pmn()};h.data={index:h.index.create(h,c,t),docs:h.documentsStore.create(h,c),sorting:h.sorter.create(h,c,t,e)};for(let g of x2t)h[g]=(h[g]??[]).concat(S2t(h,g));let y=h.afterCreate;return y&&E2t(y,h),h}function Pmn(){return"{{VERSION}}"}var f4t=b(()=>{iG();MBe();C2t();fR();HBe();Ly();WBe();Uce();Jc();pu()});var p4t=b(()=>{});var ZBe=b(()=>{iG();MBe();HBe();Uce();WBe();Ly()});var qce,YBe,XBe,QBe=b(()=>{qce="fulltext",YBe="hybrid",XBe="vector"});var pR,mR,eze=b(()=>{QBe();pR=Symbol("orama.insertions"),mR=Symbol("orama.removals")});function tze(t){typeof t[pR]!="number"&&(queueMicrotask(()=>{t[pR]=void 0}),t[pR]=0),t[pR]>1e3?(m4t("Orama's insert operation is synchronous. Please avoid inserting a large number of document in a single operation in order not to block the main thread or, in alternative, please use insertMultiple.",{code:"ORAMA0001"}),t[pR]=-1):t[pR]>=0&&t[pR]++}function rze(t){typeof t[mR]!="number"&&(queueMicrotask(()=>{t[mR]=void 0}),t[mR]=0),t[mR]>1e3?(m4t("Orama's remove operation is synchronous. Please avoid removing a large number of document in a single operation in order not to block the main thread, in alternative, please use updateMultiple.",{code:"ORAMA0002"}),t[mR]=-1):t[mR]>=0&&t[mR]++}var m4t,nze=b(()=>{eze();m4t=globalThis.process?.emitWarning??function(e,r){console.warn(`[WARNING] [${r.code}] ${e}`)}});function lG(t,e,r,n,o){let i=t.validateSchema(e,t.schema);if(i)throw Jt("SCHEMA_VALIDATION_FAILURE",i);return Nu(t.index.beforeInsert)||Nu(t.index.insert)||Nu(t.index.afterInsert)?Mmn(t,e,r,n,o):Rmn(t,e,r,n,o)}async function Mmn(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Jt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Jt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||await x_(t.beforeInsert,t,s,e);let l=t.index.getSearchableProperties(i),c=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let m=typeof p,h=c[f];h4t(m,h,f,p)}return await Nmn(t,s,l,d,u,r,e,o),n||await x_(t.afterInsert,t,s,e),tze(t),s}function Rmn(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Jt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Jt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||x_(t.beforeInsert,t,s,e);let l=t.index.getSearchableProperties(i),c=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let m=typeof p,h=c[f];h4t(m,h,f,p)}return jmn(t,s,l,d,u,r,e,o),n||x_(t.afterInsert,t,s,e),tze(t),s}function h4t(t,e,r,n){if(!(_2t(e)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(HP(e)&&Array.isArray(n))&&!(o4(e)&&Array.isArray(n))&&!(Amn.has(e)&&Imn.has(t))&&t!==e)throw Jt("INVALID_DOCUMENT_PROPERTY",r,e,t)}async function Nmn(t,e,r,n,o,i,a,s){for(let c of r){let d=n[c];if(typeof d>"u")continue;let f=t.index.getSearchablePropertiesWithTypes(t.data.index)[c];await t.index.beforeInsert?.(t.data.index,c,e,d,f,i,t.tokenizer,o),await t.index.insert(t.index,t.data.index,c,e,d,f,i,t.tokenizer,o,s),await t.index.afterInsert?.(t.data.index,c,e,d,f,i,t.tokenizer,o)}let u=t.sorter.getSortableProperties(t.data.sorting),l=t.getDocumentProperties(a,u);for(let c of u){let d=l[c];if(typeof d>"u")continue;let f=t.sorter.getSortablePropertiesWithTypes(t.data.sorting)[c];t.sorter.insert(t.data.sorting,c,e,d,f,i)}}function jmn(t,e,r,n,o,i,a,s){for(let c of r){let d=n[c];if(typeof d>"u")continue;let f=t.index.getSearchablePropertiesWithTypes(t.data.index)[c];t.index.beforeInsert?.(t.data.index,c,e,d,f,i,t.tokenizer,o),t.index.insert(t.index,t.data.index,c,e,d,f,i,t.tokenizer,o,s),t.index.afterInsert?.(t.data.index,c,e,d,f,i,t.tokenizer,o)}let u=t.sorter.getSortableProperties(t.data.sorting),l=t.getDocumentProperties(a,u);for(let c of u){let d=l[c];if(typeof d>"u")continue;let f=t.sorter.getSortablePropertiesWithTypes(t.data.sorting)[c];t.sorter.insert(t.data.sorting,c,e,d,f,i)}}var Amn,Imn,oze=b(()=>{ZBe();pu();fR();nze();Jc();Amn=new Set(["enum","enum[]"]),Imn=new Set(["string","number"])});function gF(t,e,r,n){return Nu(t.index.beforeRemove)||Nu(t.index.remove)||Nu(t.index.afterRemove)?Dmn(t,e,r,n):Lmn(t,e,r,n)}async function Dmn(t,e,r,n){let o=!0,{index:i,docs:a}=t.data,s=t.documentsStore.get(a,e);if(!s)return!1;let u=Dy(t.internalDocumentIDStore,zi(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||await x_(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let h of c){let y=f[h];if(typeof y>"u")continue;let g=d[h];await t.index.beforeRemove?.(t.data.index,h,u,y,g,r,t.tokenizer,l),await t.index.remove(t.index,t.data.index,h,e,y,g,r,t.tokenizer,l)||(o=!1),await t.index.afterRemove?.(t.data.index,h,u,y,g,r,t.tokenizer,l)}let p=await t.sorter.getSortableProperties(t.data.sorting),m=await t.getDocumentProperties(s,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return n||await x_(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),rze(t),o}function Lmn(t,e,r,n){let o=!0,{index:i,docs:a}=t.data,s=t.documentsStore.get(a,e);if(!s)return!1;let u=Dy(t.internalDocumentIDStore,zi(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||x_(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let h of c){let y=f[h];if(typeof y>"u")continue;let g=d[h];t.index.beforeRemove?.(t.data.index,h,u,y,g,r,t.tokenizer,l),t.index.remove(t.index,t.data.index,h,e,y,g,r,t.tokenizer,l)||(o=!1),t.index.afterRemove?.(t.data.index,h,u,y,g,r,t.tokenizer,l)}let p=t.sorter.getSortableProperties(t.data.sorting),m=t.getDocumentProperties(s,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return n||x_(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),rze(t),o}function cG(t,e,r,n,o){return Nu(t.index.beforeRemove)||Nu(t.index.remove)||Nu(t.index.afterRemove)||Nu(t.beforeRemoveMultiple)||Nu(t.afterRemoveMultiple)?Fmn(t,e,r,n,o):kmn(t,e,r,n,o)}async function Fmn(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(s=>Dy(t.internalDocumentIDStore,zi(t.internalDocumentIDStore,s)));return o||await mF(t.beforeRemoveMultiple,t,a),await new Promise((s,u)=>{let l=0;async function c(){let d=e.slice(l*r,++l*r);if(!d.length)return s();for(let f of d)try{await gF(t,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await mF(t.afterRemoveMultiple,t,a),i}function kmn(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(l=>Dy(t.internalDocumentIDStore,zi(t.internalDocumentIDStore,l)));o||mF(t.beforeRemoveMultiple,t,a);let s=0;function u(){let l=e.slice(s*r,++s*r);if(l.length){for(let c of l)gF(t,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||mF(t.afterRemoveMultiple,t,a),i}var ize=b(()=>{fR();Ly();nze();pu()});function $mn(t,e){return t[1]-e[1]}function Bmn(t,e){return e[1]-t[1]}function zmn(t="desc"){return t.toLowerCase()==="asc"?$mn:Bmn}function l4(t,e,r){let n={},o=e.map(([l])=>l),i=t.documentsStore.getMultiple(t.data.docs,o),a=Object.keys(r),s=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let l of a){let c;if(s[l]==="number"){let{ranges:d}=r[l],f=d.length,p=Array.from({length:f});for(let m=0;m<f;m++){let h=d[m];p[m]=[`${h.from}-${h.to}`,0]}c=Object.fromEntries(p)}n[l]={count:0,values:c??{}}}let u=i.length;for(let l=0;l<u;l++){let c=i[l];for(let d of a){let f=d.includes(".")?n4(c,d):c[d],p=s[d],m=n[d].values;switch(p){case"number":{let h=r[d].ranges;g4t(h,m)(f);break}case"number[]":{let h=new Set,y=r[d].ranges,g=g4t(y,m,h);for(let _ of f)g(_);break}case"boolean":case"enum":case"string":{y4t(m,p)(f);break}case"boolean[]":case"enum[]":case"string[]":{let g=y4t(m,p==="boolean[]"?"boolean":"string",new Set);for(let _ of f)g(_);break}default:throw Jt("FACET_NOT_SUPPORTED",p)}}}for(let l of a){let c=n[l];if(c.count=Object.keys(c.values).length,s[l]==="string"){let d=r[l],f=zmn(d.sort);c.values=Object.fromEntries(Object.entries(c.values).sort(f).slice(d.offset??0,d.limit??10))}}return n}function g4t(t,e,r){return n=>{for(let o of t){let i=`${o.from}-${o.to}`;r?.has(i)||n>=o.from&&n<=o.to&&(e[i]===void 0?e[i]=1:(e[i]++,r?.add(i)))}}}function y4t(t,e,r){let n=e==="boolean"?"false":"";return o=>{let i=o?.toString()??n;r?.has(i)||(t[i]=(t[i]??0)+1,r?.add(i))}}var Hce=b(()=>{Jc();pu()});function c4(t,e){let r=new Map,n=[];for(let o of t)r.set(o,!0);for(let o of e){let[i]=o;r.has(i)&&(n.push(o),r.delete(i))}return n}var Vce=b(()=>{});function d4(t,e,r){let n=r.properties,o=n.length,i=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let g=0;g<o;g++){let _=n[g];if(typeof i[_]>"u")throw Jt("UNKNOWN_GROUP_BY_PROPERTY",_);if(!b4t.includes(i[_]))throw Jt("INVALID_GROUP_BY_PROPERTY",_,b4t.join(", "),i[_])}let a=e.map(([g])=>Dy(t.internalDocumentIDStore,g)),s=t.documentsStore.getMultiple(t.data.docs,a),u=s.length,l=r.maxResult||Number.MAX_SAFE_INTEGER,c=[],d={};for(let g=0;g<o;g++){let _=n[g],w={property:_,perValue:{}},S=new Set;for(let C=0;C<u;C++){let E=s[C],P=n4(E,_);if(typeof P>"u")continue;let T=typeof P!="boolean"?P:""+P,I=w.perValue[T]??{indexes:[],count:0};I.count>=l||(I.indexes.push(C),I.count++,w.perValue[T]=I,S.add(P))}c.push(Array.from(S)),d[_]=w}let f=_4t(c),p=f.length,m=[];for(let g=0;g<p;g++){let _=f[g],w=_.length,S={values:[],indexes:[]},C=[];for(let E=0;E<w;E++){let P=_[E],T=n[E];C.push(d[T].perValue[typeof P!="boolean"?P:""+P].indexes),S.values.push(P)}S.indexes=r4(C).sort((E,P)=>E-P),S.indexes.length!==0&&m.push(S)}let h=m.length,y=Array.from({length:h});for(let g=0;g<h;g++){let _=m[g],w=r.reduce||Umn,S=_.indexes.map(T=>({id:a[T],score:e[T][1],document:s[T]})),C=w.reducer.bind(null,_.values),E=w.getInitialValue(_.indexes.length),P=S.reduce(C,E);y[g]={values:_.values,result:P}}return y}function _4t(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let r=t[e],n=_4t(t,e+1),o=[];for(let i of r)for(let a of n){let s=[i];sa(s,a),o.push(s)}return o}var Umn,b4t,Wce=b(()=>{Jc();pu();Ly();Umn={reducer:(t,e,r,n)=>(e[n]=r,e),getInitialValue:t=>Array.from({length:t})},b4t=["string","number","boolean"]});function v4t(t,e,r){let n=w_(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign(Kce,e.relevance??{});let s=Object.keys(t.data.index.vectorIndexes),u=e.facets&&Object.keys(e.facets).length>0,{limit:l=10,offset:c=0,term:d,properties:f,threshold:p=0,distinctOn:m,includeVectors:h=!1}=e,y=e.preflight===!0,{index:g,docs:_}=t.data,w=t.tokenizer.tokenize(d??"",r),S=t.caches.propertiesToSearch;if(!S){let D=t.index.getSearchablePropertiesWithTypes(g);S=t.index.getSearchableProperties(g),S=S.filter(k=>D[k].startsWith("string")),t.caches.propertiesToSearch=S}if(f&&f!=="*"){for(let D of f)if(!S.includes(D))throw Jt("UNKNOWN_INDEX",D,S.join(", "));S=S.filter(D=>f.includes(D))}let C=yF(t.tokenizer,t.index,t.documentsStore,r,e,S,w,t.documentsStore.count(_),n),E=Object.keys(e.where??{}).length>0,P=[];E&&(P=t.index.searchByWhereClause(C,g,e.where));let T=w.length;if(T||f?.length){let D=S.length;for(let k=0;k<D;k++){let L=S[k],H=C.indexMap[L];if(T!==0)for(let F=0;F<T;F++){let Q=w[F],ee=t.index.search(C,g,L,Q);sa(H[Q],ee)}else{H[""]=[];let F=t.index.search(C,g,L,"");sa(H[""],F)}let K=Object.values(H);C.docsIntersection[L]=Fce(K,e?.boost?.[L]??1,p,T);let G=C.docsIntersection[L],X=G.length;for(let F=0;F<X;F++){let[Q,ee]=G[F],U=C.uniqueDocsIDs[Q];U?C.uniqueDocsIDs[Q]=U+ee+.5:C.uniqueDocsIDs[Q]=ee}}}else w.length===0&&d?C.uniqueDocsIDs={}:C.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(D=>[D,0]));let I=Object.entries(C.uniqueDocsIDs).map(([D,k])=>[+D,k]);if(E&&(I=c4(P,I)),e.sortBy)if(typeof e.sortBy=="function"){let D=I.map(([H])=>H),L=t.documentsStore.getMultiple(t.data.docs,D).map((H,K)=>[I[K][0],I[K][1],H]);L.sort(e.sortBy),I=L.map(([H,K])=>[H,K])}else I=t.sorter.sortBy(t.data.sorting,I,e.sortBy).map(([D,k])=>[zi(t.internalDocumentIDStore,D),k]);else I=I.sort(g2t);let N;y||(N=m?x4t(t,I,c,l,m):Gce(t,I,c,l));let M={elapsed:{formatted:"",raw:0},hits:[],count:I.length};if(typeof N<"u"&&(M.hits=N.filter(Boolean),h||Dce(M,s)),u){let D=l4(t,I,e.facets);M.facets=D}return e.groupBy&&(M.groups=d4(t,I,e.groupBy)),M.elapsed=t.formatElapsedTime(w_()-C.timeStart),M}async function a(){t.beforeSearch&&await a4(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await i4(t.afterSearch,t,e,r,s),s}return o?a():i()}var w4t=b(()=>{sG();Hce();Vce();Wce();fR();Ly();Jc();pu();bF()});function aze(t,e,r="english"){let n=w_(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:s}=e;if(s&&(!("value"in s)||!("property"in s)))throw Jt("INVALID_VECTOR_INPUT",Object.keys(s).join(", "));let{limit:u=10,offset:l=0,includeVectors:c=!1}=e,d=t.data.index.vectorIndexes[s.property],f=d.size,p=d.vectors,m=e.facets&&Object.keys(e.facets).length>0,h=Object.keys(e.where??{}).length>0,{index:y,docs:g}=t.data;if(s?.value.length!==f)throw s?.property===void 0||s?.value.length===void 0?Jt("INVALID_INPUT_VECTOR","undefined",f,"undefined"):Jt("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let _=kce(s.value,p,f,e.similarity).map(([D,k])=>[zi(t.internalDocumentIDStore,D),k]),w=t.caches.propertiesToSearch;if(!w){let D=t.index.getSearchablePropertiesWithTypes(y);w=t.index.getSearchableProperties(y),w=w.filter(k=>D[k].startsWith("string")),t.caches.propertiesToSearch=w}let S=[],C=yF(t.tokenizer,t.index,t.documentsStore,r,e,w,S,t.documentsStore.count(g),n),E=[];h&&(E=t.index.searchByWhereClause(C,y,e.where),_=c4(E,_));let P=[];m&&(P=l4(t,_,e.facets));let T=Array.from({length:u});for(let D=0;D<u;D++){let k=_[D+l];if(!k)break;let L=t.data.docs.docs[k[0]];if(L){c||(L[s.property]=null);let H={id:Dy(t.internalDocumentIDStore,k[0]),score:k[1],document:L};T[D]=H}}let I=[];e.groupBy&&(I=d4(t,_,e.groupBy));let M=w_()-n;return{count:_.length,hits:T.filter(Boolean),elapsed:{raw:Number(M),formatted:pF(M)},...P?{facets:P}:{},...I?{groups:I}:{}}}async function a(){t.beforeSearch&&await a4(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await i4(t.afterSearch,t,e,r,s),s}return o?a():i()}var sze=b(()=>{bF();pu();Hce();Jc();$ce();Vce();Wce();Ly();fR()});function C4t(t,e,r){let n=w_(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{offset:s=0,limit:u=10,includeVectors:l=!1}=e,c=e.facets&&Object.keys(e.facets).length>0,d=qmn(t,e,r),f=Hmn(t,e),{index:p,docs:m}=t.data,h=e.hybridWeights,y=Wmn(d,f,e.term??"",h),g=t.tokenizer.tokenize(e.term??"",r),_=t.caches.propertiesToSearch;if(!_){let M=t.index.getSearchablePropertiesWithTypes(p);_=t.index.getSearchableProperties(p),_=_.filter(D=>M[D].startsWith("string")),t.caches.propertiesToSearch=_}if(e.properties&&e.properties!=="*"){for(let M of e.properties)if(!_.includes(M))throw Jt("UNKNOWN_INDEX",M,_.join(", "));_=_.filter(M=>e.properties.includes(M))}let w=yF(t.tokenizer,t.index,t.documentsStore,r,e,_,g,t.documentsStore.count(m),n),S=Object.keys(e.where??{}).length>0,C=[];S&&(C=t.index.searchByWhereClause(w,p,e.where),y=c4(C,y));let E;c&&(E=l4(t,y,e.facets));let P;e.groupBy&&(P=d4(t,y,e.groupBy));let T=Gce(t,y,s,u).filter(Boolean),I=w_(),N={count:y.length,elapsed:{raw:Number(I-n),formatted:pF(I-n)},hits:T,...E?{facets:E}:{},...P?{groups:P}:{}};if(!l){let M=Object.keys(t.data.index.vectorIndexes);Dce(N,M)}return N}async function a(){t.beforeSearch&&await a4(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await i4(t.afterSearch,t,e,r,s),s}return o?a():i()}function qmn(t,e,r){let n=w_();e.relevance=Object.assign(Kce,e.relevance??{});let{term:o="",properties:i,threshold:a=0}=e,{index:s,docs:u}=t.data,l=t.tokenizer.tokenize(o,r),c=t.caches.propertiesToSearch;if(!c){let m=t.index.getSearchablePropertiesWithTypes(s);c=t.index.getSearchableProperties(s),c=c.filter(h=>m[h].startsWith("string")),t.caches.propertiesToSearch=c}if(i&&i!=="*"){let m=new Set(c),h=new Set(i);for(let y of i)if(!m.has(y))throw Jt("UNKNOWN_INDEX",y,c.join(", "));c=c.filter(y=>h.has(y))}let d=yF(t.tokenizer,t.index,t.documentsStore,r,e,c,l,t.documentsStore.count(u),n),f=l.length;if(f||i&&i.length>0){let m=c.length;for(let h=0;h<m;h++){let y=c[h];if(f!==0)for(let C=0;C<f;C++){let E=l[C],P=t.index.search(d,s,y,E);sa(d.indexMap[y][E],P)}else{let C=[];d.indexMap[y][""]=C;let E=t.index.search(d,s,y,"");sa(C,E)}let g=d.indexMap[y],_=Object.values(g);d.docsIntersection[y]=Fce(_,e?.boost?.[y]??1,a,f);let w=d.docsIntersection[y],S=w.length;for(let C=0;C<S;C++){let[E,P]=w[C],T=d.uniqueDocsIDs[E];d.uniqueDocsIDs[E]=T?T+P+.5:P}}}else l.length===0&&o?d.uniqueDocsIDs={}:d.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(m=>[m,0]));let p=Object.entries(d.uniqueDocsIDs).map(([m,h])=>[+m,h]).sort((m,h)=>h[1]-m[1]);return O4t(p)}function Hmn(t,e){let r=e.vector,n=t.data.index.vectorIndexes[r?.property],o=n.size,i=n.vectors;if(r&&(!r.value||!r.property))throw Jt("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw Jt("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=kce(r.value,i,o,e.similarity).map(([s,u])=>[zi(t.internalDocumentIDStore,s),u]);return O4t(a)}function uze([,t]){return t}function O4t(t){let e=Math.max.apply(Math,t.map(uze));return t.map(([r,n])=>[r,n/e])}function S4t(t,e){return t/e}function Vmn(t,e){return(r,n)=>r*t+n*e}function Wmn(t,e,r,n){let o=Math.max.apply(Math,t.map(uze)),i=Math.max.apply(Math,e.map(uze)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:Kmn(r),l=new Map,c=t.length,d=Vmn(s,u);for(let p=0;p<c;p++){let[m,h]=t[p],y=S4t(h,o),g=d(y,0);l.set(m,g)}let f=e.length;for(let p=0;p<f;p++){let[m,h]=e[p],y=S4t(h,i),g=l.get(m)??0;l.set(m,g+d(0,y))}return[...l].sort((p,m)=>m[1]-p[1])}function Kmn(t){return{text:.5,vector:.5}}var E4t=b(()=>{pu();Vce();sG();Jc();bF();Hce();Wce();$ce();Ly();bF();fR()});function yF(t,e,r,n,o,i,a,s,u){let l={},c={};for(let d of i){let f={};for(let p of a)f[p]=[];l[d]=f,c[d]=[]}return{timeStart:u,tokenizer:t,index:e,documentsStore:r,language:n,params:o,docsCount:s,uniqueDocsIDs:{},indexMap:l,docsIntersection:c}}function Zp(t,e,r){let n=e.mode??qce;if(n===qce)return v4t(t,e,r);if(n===XBe)return aze(t,e);if(n===YBe)return C4t(t,e);throw Jt("INVALID_SEARCH_MODE",n)}function x4t(t,e,r,n,o){let i=t.data.docs,a=new Map,s=[],u=new Set,l=e.length,c=0;for(let d=0;d<l;d++){let f=e[d];if(typeof f>"u")continue;let[p,m]=f;if(u.has(p))continue;let h=t.documentsStore.get(i,p),y=n4(h,o);if(!(typeof y>"u"||a.has(y))&&(a.set(y,!0),c++,!(c<=r)&&(s.push({id:Dy(t.internalDocumentIDStore,p),score:m,document:h}),u.add(p),c>=r+n)))break}return s}function Gce(t,e,r,n){let o=t.data.docs,i=Array.from({length:n}),a=new Set;for(let s=r;s<n+r;s++){let u=e[s];if(typeof u>"u")break;let[l,c]=u;if(!a.has(l)){let d=t.documentsStore.get(o,l);i[s]={id:Dy(t.internalDocumentIDStore,l),score:c,document:d},a.add(l)}}return i}var Kce,bF=b(()=>{Ly();Jc();pu();QBe();w4t();sze();E4t();Kce={k:1.2,b:.75,d:.5}});function Jce(t,e){t.internalDocumentIDStore.load(t,e.internalDocumentIDStore),t.data.index=t.index.load(t.internalDocumentIDStore,e.index),t.data.docs=t.documentsStore.load(t.internalDocumentIDStore,e.docs),t.data.sorting=t.sorter.load(t.internalDocumentIDStore,e.sorting),t.tokenizer.language=e.language}function lze(t){return{internalDocumentIDStore:t.internalDocumentIDStore.save(t.internalDocumentIDStore),index:t.index.save(t.data.index),docs:t.documentsStore.save(t.data.docs),sorting:t.sorter.save(t.data.sorting),language:t.tokenizer.language}}var P4t=b(()=>{});var T4t=b(()=>{fR();Jc();oze();ize();pu()});var A4t=b(()=>{Jc();bF()});var I4t=b(()=>{kBe();pu();sG();Uce()});var Zce=b(()=>{f4t();p4t();oze();ize();bF();sze();P4t();T4t();A4t();eze();ZBe();I4t()});function Ymn(t,e){let r=M4t(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function M4t(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var Ali,Ili,Jmn,Zmn,cze,Xmn,_F,dze=b(()=>{Ali=new Error("timeout while waiting for mutex to become available"),Ili=new Error("mutex already locked"),Jmn=new Error("request for lock canceled"),Zmn=function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},cze=class{constructor(e,r=Jmn){this._value=e,this._cancelError=r,this._queue=[],this._weightedWaiters=[]}acquire(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((n,o)=>{let i={resolve:n,reject:o,weight:e,priority:r},a=M4t(this._queue,s=>r<=s.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return Zmn(this,arguments,void 0,function*(r,n=1,o=0){let[i,a]=yield this.acquire(n,o);try{return yield r(i)}finally{a()}})}waitForUnlock(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,r)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),Ymn(this._weightedWaiters[e-1],{resolve:n,priority:r})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){let r=this._value;this._value-=e.weight,e.resolve([r,this._newReleaser(e.weight)])}_newReleaser(e){let r=!1;return()=>{r||(r=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){let r=this._weightedWaiters[e-1];r&&(r.forEach(n=>n.resolve()),this._weightedWaiters[e-1]=[])}else{let e=this._queue[0].priority;for(let r=this._value;r>0;r--){let n=this._weightedWaiters[r-1];if(!n)continue;let o=n.findIndex(i=>i.priority<=e);(o===-1?n:n.splice(0,o)).forEach(i=>i.resolve())}}}_couldLockImmediately(e,r){return(this._queue.length===0||this._queue[0].priority<r)&&e<=this._value}};Xmn=function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},_F=class{constructor(e){this._semaphore=new cze(1,e)}acquire(){return Xmn(this,arguments,void 0,function*(e=0){let[,r]=yield this._semaphore.acquire(1,e);return r})}runExclusive(e,r=0){return this._semaphore.runExclusive(()=>e(),1,r)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}});var R4t=x(()=>{});var oo=x((Yce,N4t)=>{(function(t,e){typeof Yce=="object"?N4t.exports=Yce=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(Yce,function(){var t=t||function(e,r){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof window<"u"&&window.crypto&&(n=window.crypto),!n&&typeof require=="function")try{n=R4t()}catch{}var o=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function g(){}return function(_){var w;return g.prototype=_,w=new g,g.prototype=null,w}}(),a={},s=a.lib={},u=s.Base=function(){return{extend:function(g){var _=i(this);return g&&_.mixIn(g),(!_.hasOwnProperty("init")||this.init===_.init)&&(_.init=function(){_.$super.init.apply(this,arguments)}),_.init.prototype=_,_.$super=this,_},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var _ in g)g.hasOwnProperty(_)&&(this[_]=g[_]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=s.WordArray=u.extend({init:function(g,_){g=this.words=g||[],_!=r?this.sigBytes=_:this.sigBytes=g.length*4},toString:function(g){return(g||d).stringify(this)},concat:function(g){var _=this.words,w=g.words,S=this.sigBytes,C=g.sigBytes;if(this.clamp(),S%4)for(var E=0;E<C;E++){var P=w[E>>>2]>>>24-E%4*8&255;_[S+E>>>2]|=P<<24-(S+E)%4*8}else for(var T=0;T<C;T+=4)_[S+T>>>2]=w[T>>>2];return this.sigBytes+=C,this},clamp:function(){var g=this.words,_=this.sigBytes;g[_>>>2]&=4294967295<<32-_%4*8,g.length=e.ceil(_/4)},clone:function(){var g=u.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var _=[],w=0;w<g;w+=4)_.push(o());return new l.init(_,g)}}),c=a.enc={},d=c.Hex={stringify:function(g){for(var _=g.words,w=g.sigBytes,S=[],C=0;C<w;C++){var E=_[C>>>2]>>>24-C%4*8&255;S.push((E>>>4).toString(16)),S.push((E&15).toString(16))}return S.join("")},parse:function(g){for(var _=g.length,w=[],S=0;S<_;S+=2)w[S>>>3]|=parseInt(g.substr(S,2),16)<<24-S%8*4;return new l.init(w,_/2)}},f=c.Latin1={stringify:function(g){for(var _=g.words,w=g.sigBytes,S=[],C=0;C<w;C++){var E=_[C>>>2]>>>24-C%4*8&255;S.push(String.fromCharCode(E))}return S.join("")},parse:function(g){for(var _=g.length,w=[],S=0;S<_;S++)w[S>>>2]|=(g.charCodeAt(S)&255)<<24-S%4*8;return new l.init(w,_)}},p=c.Utf8={stringify:function(g){try{return decodeURIComponent(escape(f.stringify(g)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(g){return f.parse(unescape(encodeURIComponent(g)))}},m=s.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(g){typeof g=="string"&&(g=p.parse(g)),this._data.concat(g),this._nDataBytes+=g.sigBytes},_process:function(g){var _,w=this._data,S=w.words,C=w.sigBytes,E=this.blockSize,P=E*4,T=C/P;g?T=e.ceil(T):T=e.max((T|0)-this._minBufferSize,0);var I=T*E,N=e.min(I*4,C);if(I){for(var M=0;M<I;M+=E)this._doProcessBlock(S,M);_=S.splice(0,I),w.sigBytes-=N}return new l.init(_,N)},clone:function(){var g=u.clone.call(this);return g._data=this._data.clone(),g},_minBufferSize:0}),h=s.Hasher=m.extend({cfg:u.extend(),init:function(g){this.cfg=this.cfg.extend(g),this.reset()},reset:function(){m.reset.call(this),this._doReset()},update:function(g){return this._append(g),this._process(),this},finalize:function(g){g&&this._append(g);var _=this._doFinalize();return _},blockSize:512/32,_createHelper:function(g){return function(_,w){return new g.init(w).finalize(_)}},_createHmacHelper:function(g){return function(_,w){return new y.HMAC.init(g,w).finalize(_)}}}),y=a.algo={};return a}(Math);return t})});var dG=x((Xce,j4t)=>{(function(t,e){typeof Xce=="object"?j4t.exports=Xce=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Xce,function(t){return function(e){var r=t,n=r.lib,o=n.Base,i=n.WordArray,a=r.x64={},s=a.Word=o.extend({init:function(l,c){this.high=l,this.low=c}}),u=a.WordArray=o.extend({init:function(l,c){l=this.words=l||[],c!=e?this.sigBytes=c:this.sigBytes=l.length*8},toX32:function(){for(var l=this.words,c=l.length,d=[],f=0;f<c;f++){var p=l[f];d.push(p.high),d.push(p.low)}return i.create(d,this.sigBytes)},clone:function(){for(var l=o.clone.call(this),c=l.words=this.words.slice(0),d=c.length,f=0;f<d;f++)c[f]=c[f].clone();return l}})}(),t})});var L4t=x((Qce,D4t)=>{(function(t,e){typeof Qce=="object"?D4t.exports=Qce=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Qce,function(t){return function(){if(typeof ArrayBuffer=="function"){var e=t,r=e.lib,n=r.WordArray,o=n.init,i=n.init=function(a){if(a instanceof ArrayBuffer&&(a=new Uint8Array(a)),(a instanceof Int8Array||typeof Uint8ClampedArray<"u"&&a instanceof Uint8ClampedArray||a instanceof Int16Array||a instanceof Uint16Array||a instanceof Int32Array||a instanceof Uint32Array||a instanceof Float32Array||a instanceof Float64Array)&&(a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength)),a instanceof Uint8Array){for(var s=a.byteLength,u=[],l=0;l<s;l++)u[l>>>2]|=a[l]<<24-l%4*8;o.call(this,u,s)}else o.apply(this,arguments)};i.prototype=n}}(),t.lib.WordArray})});var k4t=x((ede,F4t)=>{(function(t,e){typeof ede=="object"?F4t.exports=ede=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(ede,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Utf16=o.Utf16BE={stringify:function(s){for(var u=s.words,l=s.sigBytes,c=[],d=0;d<l;d+=2){var f=u[d>>>2]>>>16-d%4*8&65535;c.push(String.fromCharCode(f))}return c.join("")},parse:function(s){for(var u=s.length,l=[],c=0;c<u;c++)l[c>>>1]|=s.charCodeAt(c)<<16-c%2*16;return n.create(l,u*2)}};o.Utf16LE={stringify:function(s){for(var u=s.words,l=s.sigBytes,c=[],d=0;d<l;d+=2){var f=a(u[d>>>2]>>>16-d%4*8&65535);c.push(String.fromCharCode(f))}return c.join("")},parse:function(s){for(var u=s.length,l=[],c=0;c<u;c++)l[c>>>1]|=a(s.charCodeAt(c)<<16-c%2*16);return n.create(l,u*2)}};function a(s){return s<<8&4278255360|s>>>8&16711935}}(),t.enc.Utf16})});var hR=x((tde,$4t)=>{(function(t,e){typeof tde=="object"?$4t.exports=tde=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(tde,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Base64={stringify:function(s){var u=s.words,l=s.sigBytes,c=this._map;s.clamp();for(var d=[],f=0;f<l;f+=3)for(var p=u[f>>>2]>>>24-f%4*8&255,m=u[f+1>>>2]>>>24-(f+1)%4*8&255,h=u[f+2>>>2]>>>24-(f+2)%4*8&255,y=p<<16|m<<8|h,g=0;g<4&&f+g*.75<l;g++)d.push(c.charAt(y>>>6*(3-g)&63));var _=c.charAt(64);if(_)for(;d.length%4;)d.push(_);return d.join("")},parse:function(s){var u=s.length,l=this._map,c=this._reverseMap;if(!c){c=this._reverseMap=[];for(var d=0;d<l.length;d++)c[l.charCodeAt(d)]=d}var f=l.charAt(64);if(f){var p=s.indexOf(f);p!==-1&&(u=p)}return a(s,u,c)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function a(s,u,l){for(var c=[],d=0,f=0;f<u;f++)if(f%4){var p=l[s.charCodeAt(f-1)]<<f%4*2,m=l[s.charCodeAt(f)]>>>6-f%4*2,h=p|m;c[d>>>2]|=h<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64})});var z4t=x((rde,B4t)=>{(function(t,e){typeof rde=="object"?B4t.exports=rde=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(rde,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Base64url={stringify:function(s,u){u===void 0&&(u=!0);var l=s.words,c=s.sigBytes,d=u?this._safe_map:this._map;s.clamp();for(var f=[],p=0;p<c;p+=3)for(var m=l[p>>>2]>>>24-p%4*8&255,h=l[p+1>>>2]>>>24-(p+1)%4*8&255,y=l[p+2>>>2]>>>24-(p+2)%4*8&255,g=m<<16|h<<8|y,_=0;_<4&&p+_*.75<c;_++)f.push(d.charAt(g>>>6*(3-_)&63));var w=d.charAt(64);if(w)for(;f.length%4;)f.push(w);return f.join("")},parse:function(s,u){u===void 0&&(u=!0);var l=s.length,c=u?this._safe_map:this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var f=0;f<c.length;f++)d[c.charCodeAt(f)]=f}var p=c.charAt(64);if(p){var m=s.indexOf(p);m!==-1&&(l=m)}return a(s,l,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function a(s,u,l){for(var c=[],d=0,f=0;f<u;f++)if(f%4){var p=l[s.charCodeAt(f-1)]<<f%4*2,m=l[s.charCodeAt(f)]>>>6-f%4*2,h=p|m;c[d>>>2]|=h<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64url})});var gR=x((nde,U4t)=>{(function(t,e){typeof nde=="object"?U4t.exports=nde=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(nde,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[];(function(){for(var p=0;p<64;p++)s[p]=e.abs(e.sin(p+1))*4294967296|0})();var u=a.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,m){for(var h=0;h<16;h++){var y=m+h,g=p[y];p[y]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var _=this._hash.words,w=p[m+0],S=p[m+1],C=p[m+2],E=p[m+3],P=p[m+4],T=p[m+5],I=p[m+6],N=p[m+7],M=p[m+8],D=p[m+9],k=p[m+10],L=p[m+11],H=p[m+12],K=p[m+13],G=p[m+14],X=p[m+15],F=_[0],Q=_[1],ee=_[2],U=_[3];F=l(F,Q,ee,U,w,7,s[0]),U=l(U,F,Q,ee,S,12,s[1]),ee=l(ee,U,F,Q,C,17,s[2]),Q=l(Q,ee,U,F,E,22,s[3]),F=l(F,Q,ee,U,P,7,s[4]),U=l(U,F,Q,ee,T,12,s[5]),ee=l(ee,U,F,Q,I,17,s[6]),Q=l(Q,ee,U,F,N,22,s[7]),F=l(F,Q,ee,U,M,7,s[8]),U=l(U,F,Q,ee,D,12,s[9]),ee=l(ee,U,F,Q,k,17,s[10]),Q=l(Q,ee,U,F,L,22,s[11]),F=l(F,Q,ee,U,H,7,s[12]),U=l(U,F,Q,ee,K,12,s[13]),ee=l(ee,U,F,Q,G,17,s[14]),Q=l(Q,ee,U,F,X,22,s[15]),F=c(F,Q,ee,U,S,5,s[16]),U=c(U,F,Q,ee,I,9,s[17]),ee=c(ee,U,F,Q,L,14,s[18]),Q=c(Q,ee,U,F,w,20,s[19]),F=c(F,Q,ee,U,T,5,s[20]),U=c(U,F,Q,ee,k,9,s[21]),ee=c(ee,U,F,Q,X,14,s[22]),Q=c(Q,ee,U,F,P,20,s[23]),F=c(F,Q,ee,U,D,5,s[24]),U=c(U,F,Q,ee,G,9,s[25]),ee=c(ee,U,F,Q,E,14,s[26]),Q=c(Q,ee,U,F,M,20,s[27]),F=c(F,Q,ee,U,K,5,s[28]),U=c(U,F,Q,ee,C,9,s[29]),ee=c(ee,U,F,Q,N,14,s[30]),Q=c(Q,ee,U,F,H,20,s[31]),F=d(F,Q,ee,U,T,4,s[32]),U=d(U,F,Q,ee,M,11,s[33]),ee=d(ee,U,F,Q,L,16,s[34]),Q=d(Q,ee,U,F,G,23,s[35]),F=d(F,Q,ee,U,S,4,s[36]),U=d(U,F,Q,ee,P,11,s[37]),ee=d(ee,U,F,Q,N,16,s[38]),Q=d(Q,ee,U,F,k,23,s[39]),F=d(F,Q,ee,U,K,4,s[40]),U=d(U,F,Q,ee,w,11,s[41]),ee=d(ee,U,F,Q,E,16,s[42]),Q=d(Q,ee,U,F,I,23,s[43]),F=d(F,Q,ee,U,D,4,s[44]),U=d(U,F,Q,ee,H,11,s[45]),ee=d(ee,U,F,Q,X,16,s[46]),Q=d(Q,ee,U,F,C,23,s[47]),F=f(F,Q,ee,U,w,6,s[48]),U=f(U,F,Q,ee,N,10,s[49]),ee=f(ee,U,F,Q,G,15,s[50]),Q=f(Q,ee,U,F,T,21,s[51]),F=f(F,Q,ee,U,H,6,s[52]),U=f(U,F,Q,ee,E,10,s[53]),ee=f(ee,U,F,Q,k,15,s[54]),Q=f(Q,ee,U,F,S,21,s[55]),F=f(F,Q,ee,U,M,6,s[56]),U=f(U,F,Q,ee,X,10,s[57]),ee=f(ee,U,F,Q,I,15,s[58]),Q=f(Q,ee,U,F,K,21,s[59]),F=f(F,Q,ee,U,P,6,s[60]),U=f(U,F,Q,ee,L,10,s[61]),ee=f(ee,U,F,Q,C,15,s[62]),Q=f(Q,ee,U,F,D,21,s[63]),_[0]=_[0]+F|0,_[1]=_[1]+Q|0,_[2]=_[2]+ee|0,_[3]=_[3]+U|0},_doFinalize:function(){var p=this._data,m=p.words,h=this._nDataBytes*8,y=p.sigBytes*8;m[y>>>5]|=128<<24-y%32;var g=e.floor(h/4294967296),_=h;m[(y+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,m[(y+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,p.sigBytes=(m.length+1)*4,this._process();for(var w=this._hash,S=w.words,C=0;C<4;C++){var E=S[C];S[C]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}return w},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});function l(p,m,h,y,g,_,w){var S=p+(m&h|~m&y)+g+w;return(S<<_|S>>>32-_)+m}function c(p,m,h,y,g,_,w){var S=p+(m&y|h&~y)+g+w;return(S<<_|S>>>32-_)+m}function d(p,m,h,y,g,_,w){var S=p+(m^h^y)+g+w;return(S<<_|S>>>32-_)+m}function f(p,m,h,y,g,_,w){var S=p+(h^(m|~y))+g+w;return(S<<_|S>>>32-_)+m}r.MD5=i._createHelper(u),r.HmacMD5=i._createHmacHelper(u)}(Math),t.MD5})});var fze=x((ode,q4t)=>{(function(t,e){typeof ode=="object"?q4t.exports=ode=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(ode,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.Hasher,i=e.algo,a=[],s=i.SHA1=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,l){for(var c=this._hash.words,d=c[0],f=c[1],p=c[2],m=c[3],h=c[4],y=0;y<80;y++){if(y<16)a[y]=u[l+y]|0;else{var g=a[y-3]^a[y-8]^a[y-14]^a[y-16];a[y]=g<<1|g>>>31}var _=(d<<5|d>>>27)+h+a[y];y<20?_+=(f&p|~f&m)+1518500249:y<40?_+=(f^p^m)+1859775393:y<60?_+=(f&p|f&m|p&m)-1894007588:_+=(f^p^m)-899497514,h=m,m=p,p=f<<30|f>>>2,f=d,d=_}c[0]=c[0]+d|0,c[1]=c[1]+f|0,c[2]=c[2]+p|0,c[3]=c[3]+m|0,c[4]=c[4]+h|0},_doFinalize:function(){var u=this._data,l=u.words,c=this._nDataBytes*8,d=u.sigBytes*8;return l[d>>>5]|=128<<24-d%32,l[(d+64>>>9<<4)+14]=Math.floor(c/4294967296),l[(d+64>>>9<<4)+15]=c,u.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var u=o.clone.call(this);return u._hash=this._hash.clone(),u}});e.SHA1=o._createHelper(s),e.HmacSHA1=o._createHmacHelper(s)}(),t.SHA1})});var ade=x((ide,H4t)=>{(function(t,e){typeof ide=="object"?H4t.exports=ide=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(ide,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[],u=[];(function(){function d(h){for(var y=e.sqrt(h),g=2;g<=y;g++)if(!(h%g))return!1;return!0}function f(h){return(h-(h|0))*4294967296|0}for(var p=2,m=0;m<64;)d(p)&&(m<8&&(s[m]=f(e.pow(p,1/2))),u[m]=f(e.pow(p,1/3)),m++),p++})();var l=[],c=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(d,f){for(var p=this._hash.words,m=p[0],h=p[1],y=p[2],g=p[3],_=p[4],w=p[5],S=p[6],C=p[7],E=0;E<64;E++){if(E<16)l[E]=d[f+E]|0;else{var P=l[E-15],T=(P<<25|P>>>7)^(P<<14|P>>>18)^P>>>3,I=l[E-2],N=(I<<15|I>>>17)^(I<<13|I>>>19)^I>>>10;l[E]=T+l[E-7]+N+l[E-16]}var M=_&w^~_&S,D=m&h^m&y^h&y,k=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),L=(_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25),H=C+L+M+u[E]+l[E],K=k+D;C=S,S=w,w=_,_=g+H|0,g=y,y=h,h=m,m=H+K|0}p[0]=p[0]+m|0,p[1]=p[1]+h|0,p[2]=p[2]+y|0,p[3]=p[3]+g|0,p[4]=p[4]+_|0,p[5]=p[5]+w|0,p[6]=p[6]+S|0,p[7]=p[7]+C|0},_doFinalize:function(){var d=this._data,f=d.words,p=this._nDataBytes*8,m=d.sigBytes*8;return f[m>>>5]|=128<<24-m%32,f[(m+64>>>9<<4)+14]=e.floor(p/4294967296),f[(m+64>>>9<<4)+15]=p,d.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var d=i.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA256=i._createHelper(c),r.HmacSHA256=i._createHmacHelper(c)}(Math),t.SHA256})});var W4t=x((sde,V4t)=>{(function(t,e,r){typeof sde=="object"?V4t.exports=sde=e(oo(),ade()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(sde,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.algo,i=o.SHA256,a=o.SHA224=i.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var s=i._doFinalize.call(this);return s.sigBytes-=4,s}});e.SHA224=i._createHelper(a),e.HmacSHA224=i._createHmacHelper(a)}(),t.SHA224})});var pze=x((ude,K4t)=>{(function(t,e,r){typeof ude=="object"?K4t.exports=ude=e(oo(),dG()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(ude,function(t){return function(){var e=t,r=e.lib,n=r.Hasher,o=e.x64,i=o.Word,a=o.WordArray,s=e.algo;function u(){return i.create.apply(i,arguments)}var l=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],c=[];(function(){for(var f=0;f<80;f++)c[f]=u()})();var d=s.SHA512=n.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(f,p){for(var m=this._hash.words,h=m[0],y=m[1],g=m[2],_=m[3],w=m[4],S=m[5],C=m[6],E=m[7],P=h.high,T=h.low,I=y.high,N=y.low,M=g.high,D=g.low,k=_.high,L=_.low,H=w.high,K=w.low,G=S.high,X=S.low,F=C.high,Q=C.low,ee=E.high,U=E.low,z=P,V=T,q=I,W=N,J=M,se=D,be=k,ce=L,pe=H,Me=K,Ue=G,Et=X,pr=F,$r=Q,On=ee,Br=U,Tr=0;Tr<80;Tr++){var Ie,Ge,Ne=c[Tr];if(Tr<16)Ge=Ne.high=f[p+Tr*2]|0,Ie=Ne.low=f[p+Tr*2+1]|0;else{var le=c[Tr-15],oe=le.high,fe=le.low,_e=(oe>>>1|fe<<31)^(oe>>>8|fe<<24)^oe>>>7,ge=(fe>>>1|oe<<31)^(fe>>>8|oe<<24)^(fe>>>7|oe<<25),Le=c[Tr-2],dr=Le.high,Ii=Le.low,bi=(dr>>>19|Ii<<13)^(dr<<3|Ii>>>29)^dr>>>6,_f=(Ii>>>19|dr<<13)^(Ii<<3|dr>>>29)^(Ii>>>6|dr<<26),yp=c[Tr-7],Vi=yp.high,gd=yp.low,yd=c[Tr-16],vf=yd.high,Wn=yd.low;Ie=ge+gd,Ge=_e+Vi+(Ie>>>0<ge>>>0?1:0),Ie=Ie+_f,Ge=Ge+bi+(Ie>>>0<_f>>>0?1:0),Ie=Ie+Wn,Ge=Ge+vf+(Ie>>>0<Wn>>>0?1:0),Ne.high=Ge,Ne.low=Ie}var MA=pe&Ue^~pe&pr,WN=Me&Et^~Me&$r,RA=z&q^z&J^q&J,Ms=V&W^V&se^W&se,bu=(z>>>28|V<<4)^(z<<30|V>>>2)^(z<<25|V>>>7),is=(V>>>28|z<<4)^(V<<30|z>>>2)^(V<<25|z>>>7),bp=(pe>>>14|Me<<18)^(pe>>>18|Me<<14)^(pe<<23|Me>>>9),wf=(Me>>>14|pe<<18)^(Me>>>18|pe<<14)^(Me<<23|pe>>>9),Zs=l[Tr],pm=Zs.high,_p=Zs.low,Qn=Br+wf,Ye=On+bp+(Qn>>>0<Br>>>0?1:0),Qn=Qn+WN,Ye=Ye+MA+(Qn>>>0<WN>>>0?1:0),Qn=Qn+_p,Ye=Ye+pm+(Qn>>>0<_p>>>0?1:0),Qn=Qn+Ie,Ye=Ye+Ge+(Qn>>>0<Ie>>>0?1:0),vp=is+Ms,Th=bu+RA+(vp>>>0<is>>>0?1:0);On=pr,Br=$r,pr=Ue,$r=Et,Ue=pe,Et=Me,Me=ce+Qn|0,pe=be+Ye+(Me>>>0<ce>>>0?1:0)|0,be=J,ce=se,J=q,se=W,q=z,W=V,V=Qn+vp|0,z=Ye+Th+(V>>>0<Qn>>>0?1:0)|0}T=h.low=T+V,h.high=P+z+(T>>>0<V>>>0?1:0),N=y.low=N+W,y.high=I+q+(N>>>0<W>>>0?1:0),D=g.low=D+se,g.high=M+J+(D>>>0<se>>>0?1:0),L=_.low=L+ce,_.high=k+be+(L>>>0<ce>>>0?1:0),K=w.low=K+Me,w.high=H+pe+(K>>>0<Me>>>0?1:0),X=S.low=X+Et,S.high=G+Ue+(X>>>0<Et>>>0?1:0),Q=C.low=Q+$r,C.high=F+pr+(Q>>>0<$r>>>0?1:0),U=E.low=U+Br,E.high=ee+On+(U>>>0<Br>>>0?1:0)},_doFinalize:function(){var f=this._data,p=f.words,m=this._nDataBytes*8,h=f.sigBytes*8;p[h>>>5]|=128<<24-h%32,p[(h+128>>>10<<5)+30]=Math.floor(m/4294967296),p[(h+128>>>10<<5)+31]=m,f.sigBytes=p.length*4,this._process();var y=this._hash.toX32();return y},clone:function(){var f=n.clone.call(this);return f._hash=this._hash.clone(),f},blockSize:1024/32});e.SHA512=n._createHelper(d),e.HmacSHA512=n._createHmacHelper(d)}(),t.SHA512})});var J4t=x((lde,G4t)=>{(function(t,e,r){typeof lde=="object"?G4t.exports=lde=e(oo(),dG(),pze()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(lde,function(t){return function(){var e=t,r=e.x64,n=r.Word,o=r.WordArray,i=e.algo,a=i.SHA512,s=i.SHA384=a.extend({_doReset:function(){this._hash=new o.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var u=a._doFinalize.call(this);return u.sigBytes-=16,u}});e.SHA384=a._createHelper(s),e.HmacSHA384=a._createHmacHelper(s)}(),t.SHA384})});var Y4t=x((cde,Z4t)=>{(function(t,e,r){typeof cde=="object"?Z4t.exports=cde=e(oo(),dG()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(cde,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.x64,s=a.Word,u=r.algo,l=[],c=[],d=[];(function(){for(var m=1,h=0,y=0;y<24;y++){l[m+5*h]=(y+1)*(y+2)/2%64;var g=h%5,_=(2*m+3*h)%5;m=g,h=_}for(var m=0;m<5;m++)for(var h=0;h<5;h++)c[m+5*h]=h+(2*m+3*h)%5*5;for(var w=1,S=0;S<24;S++){for(var C=0,E=0,P=0;P<7;P++){if(w&1){var T=(1<<P)-1;T<32?E^=1<<T:C^=1<<T-32}w&128?w=w<<1^113:w<<=1}d[S]=s.create(C,E)}})();var f=[];(function(){for(var m=0;m<25;m++)f[m]=s.create()})();var p=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var m=this._state=[],h=0;h<25;h++)m[h]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(m,h){for(var y=this._state,g=this.blockSize/2,_=0;_<g;_++){var w=m[h+2*_],S=m[h+2*_+1];w=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,S=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360;var C=y[_];C.high^=S,C.low^=w}for(var E=0;E<24;E++){for(var P=0;P<5;P++){for(var T=0,I=0,N=0;N<5;N++){var C=y[P+5*N];T^=C.high,I^=C.low}var M=f[P];M.high=T,M.low=I}for(var P=0;P<5;P++)for(var D=f[(P+4)%5],k=f[(P+1)%5],L=k.high,H=k.low,T=D.high^(L<<1|H>>>31),I=D.low^(H<<1|L>>>31),N=0;N<5;N++){var C=y[P+5*N];C.high^=T,C.low^=I}for(var K=1;K<25;K++){var T,I,C=y[K],G=C.high,X=C.low,F=l[K];F<32?(T=G<<F|X>>>32-F,I=X<<F|G>>>32-F):(T=X<<F-32|G>>>64-F,I=G<<F-32|X>>>64-F);var Q=f[c[K]];Q.high=T,Q.low=I}var ee=f[0],U=y[0];ee.high=U.high,ee.low=U.low;for(var P=0;P<5;P++)for(var N=0;N<5;N++){var K=P+5*N,C=y[K],z=f[K],V=f[(P+1)%5+5*N],q=f[(P+2)%5+5*N];C.high=z.high^~V.high&q.high,C.low=z.low^~V.low&q.low}var C=y[0],W=d[E];C.high^=W.high,C.low^=W.low}},_doFinalize:function(){var m=this._data,h=m.words,y=this._nDataBytes*8,g=m.sigBytes*8,_=this.blockSize*32;h[g>>>5]|=1<<24-g%32,h[(e.ceil((g+1)/_)*_>>>5)-1]|=128,m.sigBytes=h.length*4,this._process();for(var w=this._state,S=this.cfg.outputLength/8,C=S/8,E=[],P=0;P<C;P++){var T=w[P],I=T.high,N=T.low;I=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,N=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,E.push(N),E.push(I)}return new o.init(E,S)},clone:function(){for(var m=i.clone.call(this),h=m._state=this._state.slice(0),y=0;y<25;y++)h[y]=h[y].clone();return m}});r.SHA3=i._createHelper(p),r.HmacSHA3=i._createHmacHelper(p)}(Math),t.SHA3})});var Q4t=x((dde,X4t)=>{(function(t,e){typeof dde=="object"?X4t.exports=dde=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(dde,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=o.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=o.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=o.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=o.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=o.create([0,1518500249,1859775393,2400959708,2840853838]),f=o.create([1352829926,1548603684,1836072691,2053994217,0]),p=a.RIPEMD160=i.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(S,C){for(var E=0;E<16;E++){var P=C+E,T=S[P];S[P]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360}var I=this._hash.words,N=d.words,M=f.words,D=s.words,k=u.words,L=l.words,H=c.words,K,G,X,F,Q,ee,U,z,V,q;ee=K=I[0],U=G=I[1],z=X=I[2],V=F=I[3],q=Q=I[4];for(var W,E=0;E<80;E+=1)W=K+S[C+D[E]]|0,E<16?W+=m(G,X,F)+N[0]:E<32?W+=h(G,X,F)+N[1]:E<48?W+=y(G,X,F)+N[2]:E<64?W+=g(G,X,F)+N[3]:W+=_(G,X,F)+N[4],W=W|0,W=w(W,L[E]),W=W+Q|0,K=Q,Q=F,F=w(X,10),X=G,G=W,W=ee+S[C+k[E]]|0,E<16?W+=_(U,z,V)+M[0]:E<32?W+=g(U,z,V)+M[1]:E<48?W+=y(U,z,V)+M[2]:E<64?W+=h(U,z,V)+M[3]:W+=m(U,z,V)+M[4],W=W|0,W=w(W,H[E]),W=W+q|0,ee=q,q=V,V=w(z,10),z=U,U=W;W=I[1]+X+V|0,I[1]=I[2]+F+q|0,I[2]=I[3]+Q+ee|0,I[3]=I[4]+K+U|0,I[4]=I[0]+G+z|0,I[0]=W},_doFinalize:function(){var S=this._data,C=S.words,E=this._nDataBytes*8,P=S.sigBytes*8;C[P>>>5]|=128<<24-P%32,C[(P+64>>>9<<4)+14]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,S.sigBytes=(C.length+1)*4,this._process();for(var T=this._hash,I=T.words,N=0;N<5;N++){var M=I[N];I[N]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}return T},clone:function(){var S=i.clone.call(this);return S._hash=this._hash.clone(),S}});function m(S,C,E){return S^C^E}function h(S,C,E){return S&C|~S&E}function y(S,C,E){return(S|~C)^E}function g(S,C,E){return S&E|C&~E}function _(S,C,E){return S^(C|~E)}function w(S,C){return S<<C|S>>>32-C}r.RIPEMD160=i._createHelper(p),r.HmacRIPEMD160=i._createHmacHelper(p)}(Math),t.RIPEMD160})});var pde=x((fde,e3t)=>{(function(t,e){typeof fde=="object"?e3t.exports=fde=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(fde,function(t){(function(){var e=t,r=e.lib,n=r.Base,o=e.enc,i=o.Utf8,a=e.algo,s=a.HMAC=n.extend({init:function(u,l){u=this._hasher=new u.init,typeof l=="string"&&(l=i.parse(l));var c=u.blockSize,d=c*4;l.sigBytes>d&&(l=u.finalize(l)),l.clamp();for(var f=this._oKey=l.clone(),p=this._iKey=l.clone(),m=f.words,h=p.words,y=0;y<c;y++)m[y]^=1549556828,h[y]^=909522486;f.sigBytes=p.sigBytes=d,this.reset()},reset:function(){var u=this._hasher;u.reset(),u.update(this._iKey)},update:function(u){return this._hasher.update(u),this},finalize:function(u){var l=this._hasher,c=l.finalize(u);l.reset();var d=l.finalize(this._oKey.clone().concat(c));return d}})})()})});var r3t=x((mde,t3t)=>{(function(t,e,r){typeof mde=="object"?t3t.exports=mde=e(oo(),ade(),pde()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(mde,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.SHA256,s=i.HMAC,u=i.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:25e4}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,c){for(var d=this.cfg,f=s.create(d.hasher,l),p=o.create(),m=o.create([1]),h=p.words,y=m.words,g=d.keySize,_=d.iterations;h.length<g;){var w=f.update(c).finalize(m);f.reset();for(var S=w.words,C=S.length,E=w,P=1;P<_;P++){E=f.finalize(E),f.reset();for(var T=E.words,I=0;I<C;I++)S[I]^=T[I]}p.concat(w),y[0]++}return p.sigBytes=g*4,p}});e.PBKDF2=function(l,c,d){return u.create(d).compute(l,c)}}(),t.PBKDF2})});var VP=x((hde,n3t)=>{(function(t,e,r){typeof hde=="object"?n3t.exports=hde=e(oo(),fze(),pde()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(hde,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.MD5,s=i.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:1}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,l){for(var c,d=this.cfg,f=d.hasher.create(),p=o.create(),m=p.words,h=d.keySize,y=d.iterations;m.length<h;){c&&f.update(c),c=f.update(u).finalize(l),f.reset();for(var g=1;g<y;g++)c=f.finalize(c),f.reset();p.concat(c)}return p.sigBytes=h*4,p}});e.EvpKDF=function(u,l,c){return s.create(c).compute(u,l)}}(),t.EvpKDF})});var xc=x((gde,o3t)=>{(function(t,e,r){typeof gde=="object"?o3t.exports=gde=e(oo(),VP()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(gde,function(t){t.lib.Cipher||function(e){var r=t,n=r.lib,o=n.Base,i=n.WordArray,a=n.BufferedBlockAlgorithm,s=r.enc,u=s.Utf8,l=s.Base64,c=r.algo,d=c.EvpKDF,f=n.Cipher=a.extend({cfg:o.extend(),createEncryptor:function(M,D){return this.create(this._ENC_XFORM_MODE,M,D)},createDecryptor:function(M,D){return this.create(this._DEC_XFORM_MODE,M,D)},init:function(M,D,k){this.cfg=this.cfg.extend(k),this._xformMode=M,this._key=D,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(M){return this._append(M),this._process()},finalize:function(M){M&&this._append(M);var D=this._doFinalize();return D},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function M(D){return typeof D=="string"?N:P}return function(D){return{encrypt:function(k,L,H){return M(L).encrypt(D,k,L,H)},decrypt:function(k,L,H){return M(L).decrypt(D,k,L,H)}}}}()}),p=n.StreamCipher=f.extend({_doFinalize:function(){var M=this._process(!0);return M},blockSize:1}),m=r.mode={},h=n.BlockCipherMode=o.extend({createEncryptor:function(M,D){return this.Encryptor.create(M,D)},createDecryptor:function(M,D){return this.Decryptor.create(M,D)},init:function(M,D){this._cipher=M,this._iv=D}}),y=m.CBC=function(){var M=h.extend();M.Encryptor=M.extend({processBlock:function(k,L){var H=this._cipher,K=H.blockSize;D.call(this,k,L,K),H.encryptBlock(k,L),this._prevBlock=k.slice(L,L+K)}}),M.Decryptor=M.extend({processBlock:function(k,L){var H=this._cipher,K=H.blockSize,G=k.slice(L,L+K);H.decryptBlock(k,L),D.call(this,k,L,K),this._prevBlock=G}});function D(k,L,H){var K,G=this._iv;G?(K=G,this._iv=e):K=this._prevBlock;for(var X=0;X<H;X++)k[L+X]^=K[X]}return M}(),g=r.pad={},_=g.Pkcs7={pad:function(M,D){for(var k=D*4,L=k-M.sigBytes%k,H=L<<24|L<<16|L<<8|L,K=[],G=0;G<L;G+=4)K.push(H);var X=i.create(K,L);M.concat(X)},unpad:function(M){var D=M.words[M.sigBytes-1>>>2]&255;M.sigBytes-=D}},w=n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:y,padding:_}),reset:function(){var M;f.reset.call(this);var D=this.cfg,k=D.iv,L=D.mode;this._xformMode==this._ENC_XFORM_MODE?M=L.createEncryptor:(M=L.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==M?this._mode.init(this,k&&k.words):(this._mode=M.call(L,this,k&&k.words),this._mode.__creator=M)},_doProcessBlock:function(M,D){this._mode.processBlock(M,D)},_doFinalize:function(){var M,D=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(D.pad(this._data,this.blockSize),M=this._process(!0)):(M=this._process(!0),D.unpad(M)),M},blockSize:128/32}),S=n.CipherParams=o.extend({init:function(M){this.mixIn(M)},toString:function(M){return(M||this.formatter).stringify(this)}}),C=r.format={},E=C.OpenSSL={stringify:function(M){var D,k=M.ciphertext,L=M.salt;return L?D=i.create([1398893684,1701076831]).concat(L).concat(k):D=k,D.toString(l)},parse:function(M){var D,k=l.parse(M),L=k.words;return L[0]==1398893684&&L[1]==1701076831&&(D=i.create(L.slice(2,4)),L.splice(0,4),k.sigBytes-=16),S.create({ciphertext:k,salt:D})}},P=n.SerializableCipher=o.extend({cfg:o.extend({format:E}),encrypt:function(M,D,k,L){L=this.cfg.extend(L);var H=M.createEncryptor(k,L),K=H.finalize(D),G=H.cfg;return S.create({ciphertext:K,key:k,iv:G.iv,algorithm:M,mode:G.mode,padding:G.padding,blockSize:M.blockSize,formatter:L.format})},decrypt:function(M,D,k,L){L=this.cfg.extend(L),D=this._parse(D,L.format);var H=M.createDecryptor(k,L).finalize(D.ciphertext);return H},_parse:function(M,D){return typeof M=="string"?D.parse(M,this):M}}),T=r.kdf={},I=T.OpenSSL={execute:function(M,D,k,L,H){if(L||(L=i.random(64/8)),H)var K=d.create({keySize:D+k,hasher:H}).compute(M,L);else var K=d.create({keySize:D+k}).compute(M,L);var G=i.create(K.words.slice(D),k*4);return K.sigBytes=D*4,S.create({key:K,iv:G,salt:L})}},N=n.PasswordBasedCipher=P.extend({cfg:P.cfg.extend({kdf:I}),encrypt:function(M,D,k,L){L=this.cfg.extend(L);var H=L.kdf.execute(k,M.keySize,M.ivSize,L.salt,L.hasher);L.iv=H.iv;var K=P.encrypt.call(this,M,D,H.key,L);return K.mixIn(H),K},decrypt:function(M,D,k,L){L=this.cfg.extend(L),D=this._parse(D,L.format);var H=L.kdf.execute(k,M.keySize,M.ivSize,D.salt,L.hasher);L.iv=H.iv;var K=P.decrypt.call(this,M,D,H.key,L);return K}})}()})});var a3t=x((yde,i3t)=>{(function(t,e,r){typeof yde=="object"?i3t.exports=yde=e(oo(),xc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(yde,function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();e.Encryptor=e.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize;r.call(this,n,o,a,i),this._prevBlock=n.slice(o,o+a)}}),e.Decryptor=e.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize,s=n.slice(o,o+a);r.call(this,n,o,a,i),this._prevBlock=s}});function r(n,o,i,a){var s,u=this._iv;u?(s=u.slice(0),this._iv=void 0):s=this._prevBlock,a.encryptBlock(s,0);for(var l=0;l<i;l++)n[o+l]^=s[l]}return e}(),t.mode.CFB})});var u3t=x((bde,s3t)=>{(function(t,e,r){typeof bde=="object"?s3t.exports=bde=e(oo(),xc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(bde,function(t){return t.mode.CTR=function(){var e=t.lib.BlockCipherMode.extend(),r=e.Encryptor=e.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize,s=this._iv,u=this._counter;s&&(u=this._counter=s.slice(0),this._iv=void 0);var l=u.slice(0);i.encryptBlock(l,0),u[a-1]=u[a-1]+1|0;for(var c=0;c<a;c++)n[o+c]^=l[c]}});return e.Decryptor=r,e}(),t.mode.CTR})});var c3t=x((_de,l3t)=>{(function(t,e,r){typeof _de=="object"?l3t.exports=_de=e(oo(),xc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(_de,function(t){return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();function r(i){if((i>>24&255)===255){var a=i>>16&255,s=i>>8&255,u=i&255;a===255?(a=0,s===255?(s=0,u===255?u=0:++u):++s):++a,i=0,i+=a<<16,i+=s<<8,i+=u}else i+=1<<24;return i}function n(i){return(i[0]=r(i[0]))===0&&(i[1]=r(i[1])),i}var o=e.Encryptor=e.extend({processBlock:function(i,a){var s=this._cipher,u=s.blockSize,l=this._iv,c=this._counter;l&&(c=this._counter=l.slice(0),this._iv=void 0),n(c);var d=c.slice(0);s.encryptBlock(d,0);for(var f=0;f<u;f++)i[a+f]^=d[f]}});return e.Decryptor=o,e}(),t.mode.CTRGladman})});var f3t=x((vde,d3t)=>{(function(t,e,r){typeof vde=="object"?d3t.exports=vde=e(oo(),xc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(vde,function(t){return t.mode.OFB=function(){var e=t.lib.BlockCipherMode.extend(),r=e.Encryptor=e.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize,s=this._iv,u=this._keystream;s&&(u=this._keystream=s.slice(0),this._iv=void 0),i.encryptBlock(u,0);for(var l=0;l<a;l++)n[o+l]^=u[l]}});return e.Decryptor=r,e}(),t.mode.OFB})});var m3t=x((wde,p3t)=>{(function(t,e,r){typeof wde=="object"?p3t.exports=wde=e(oo(),xc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(wde,function(t){return t.mode.ECB=function(){var e=t.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(r,n){this._cipher.encryptBlock(r,n)}}),e.Decryptor=e.extend({processBlock:function(r,n){this._cipher.decryptBlock(r,n)}}),e}(),t.mode.ECB})});var g3t=x((xde,h3t)=>{(function(t,e,r){typeof xde=="object"?h3t.exports=xde=e(oo(),xc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(xde,function(t){return t.pad.AnsiX923={pad:function(e,r){var n=e.sigBytes,o=r*4,i=o-n%o,a=n+i-1;e.clamp(),e.words[a>>>2]|=i<<24-a%4*8,e.sigBytes+=i},unpad:function(e){var r=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=r}},t.pad.Ansix923})});var b3t=x((Sde,y3t)=>{(function(t,e,r){typeof Sde=="object"?y3t.exports=Sde=e(oo(),xc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Sde,function(t){return t.pad.Iso10126={pad:function(e,r){var n=r*4,o=n-e.sigBytes%n;e.concat(t.lib.WordArray.random(o-1)).concat(t.lib.WordArray.create([o<<24],1))},unpad:function(e){var r=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=r}},t.pad.Iso10126})});var v3t=x((Cde,_3t)=>{(function(t,e,r){typeof Cde=="object"?_3t.exports=Cde=e(oo(),xc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Cde,function(t){return t.pad.Iso97971={pad:function(e,r){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,r)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971})});var x3t=x((Ode,w3t)=>{(function(t,e,r){typeof Ode=="object"?w3t.exports=Ode=e(oo(),xc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Ode,function(t){return t.pad.ZeroPadding={pad:function(e,r){var n=r*4;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){for(var r=e.words,n=e.sigBytes-1,n=e.sigBytes-1;n>=0;n--)if(r[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},t.pad.ZeroPadding})});var C3t=x((Ede,S3t)=>{(function(t,e,r){typeof Ede=="object"?S3t.exports=Ede=e(oo(),xc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Ede,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var E3t=x((Pde,O3t)=>{(function(t,e,r){typeof Pde=="object"?O3t.exports=Pde=e(oo(),xc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Pde,function(t){return function(e){var r=t,n=r.lib,o=n.CipherParams,i=r.enc,a=i.Hex,s=r.format,u=s.Hex={stringify:function(l){return l.ciphertext.toString(a)},parse:function(l){var c=a.parse(l);return o.create({ciphertext:c})}}}(),t.format.Hex})});var T3t=x((Tde,P3t)=>{(function(t,e,r){typeof Tde=="object"?P3t.exports=Tde=e(oo(),hR(),gR(),VP(),xc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Tde,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo,i=[],a=[],s=[],u=[],l=[],c=[],d=[],f=[],p=[],m=[];(function(){for(var g=[],_=0;_<256;_++)_<128?g[_]=_<<1:g[_]=_<<1^283;for(var w=0,S=0,_=0;_<256;_++){var C=S^S<<1^S<<2^S<<3^S<<4;C=C>>>8^C&255^99,i[w]=C,a[C]=w;var E=g[w],P=g[E],T=g[P],I=g[C]*257^C*16843008;s[w]=I<<24|I>>>8,u[w]=I<<16|I>>>16,l[w]=I<<8|I>>>24,c[w]=I;var I=T*16843009^P*65537^E*257^w*16843008;d[C]=I<<24|I>>>8,f[C]=I<<16|I>>>16,p[C]=I<<8|I>>>24,m[C]=I,w?(w=E^g[g[g[T^E]]],S^=g[g[S]]):w=S=1}})();var h=[0,1,2,4,8,16,32,64,128,27,54],y=o.AES=n.extend({_doReset:function(){var g;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var _=this._keyPriorReset=this._key,w=_.words,S=_.sigBytes/4,C=this._nRounds=S+6,E=(C+1)*4,P=this._keySchedule=[],T=0;T<E;T++)T<S?P[T]=w[T]:(g=P[T-1],T%S?S>6&&T%S==4&&(g=i[g>>>24]<<24|i[g>>>16&255]<<16|i[g>>>8&255]<<8|i[g&255]):(g=g<<8|g>>>24,g=i[g>>>24]<<24|i[g>>>16&255]<<16|i[g>>>8&255]<<8|i[g&255],g^=h[T/S|0]<<24),P[T]=P[T-S]^g);for(var I=this._invKeySchedule=[],N=0;N<E;N++){var T=E-N;if(N%4)var g=P[T];else var g=P[T-4];N<4||T<=4?I[N]=g:I[N]=d[i[g>>>24]]^f[i[g>>>16&255]]^p[i[g>>>8&255]]^m[i[g&255]]}}},encryptBlock:function(g,_){this._doCryptBlock(g,_,this._keySchedule,s,u,l,c,i)},decryptBlock:function(g,_){var w=g[_+1];g[_+1]=g[_+3],g[_+3]=w,this._doCryptBlock(g,_,this._invKeySchedule,d,f,p,m,a);var w=g[_+1];g[_+1]=g[_+3],g[_+3]=w},_doCryptBlock:function(g,_,w,S,C,E,P,T){for(var I=this._nRounds,N=g[_]^w[0],M=g[_+1]^w[1],D=g[_+2]^w[2],k=g[_+3]^w[3],L=4,H=1;H<I;H++){var K=S[N>>>24]^C[M>>>16&255]^E[D>>>8&255]^P[k&255]^w[L++],G=S[M>>>24]^C[D>>>16&255]^E[k>>>8&255]^P[N&255]^w[L++],X=S[D>>>24]^C[k>>>16&255]^E[N>>>8&255]^P[M&255]^w[L++],F=S[k>>>24]^C[N>>>16&255]^E[M>>>8&255]^P[D&255]^w[L++];N=K,M=G,D=X,k=F}var K=(T[N>>>24]<<24|T[M>>>16&255]<<16|T[D>>>8&255]<<8|T[k&255])^w[L++],G=(T[M>>>24]<<24|T[D>>>16&255]<<16|T[k>>>8&255]<<8|T[N&255])^w[L++],X=(T[D>>>24]<<24|T[k>>>16&255]<<16|T[N>>>8&255]<<8|T[M&255])^w[L++],F=(T[k>>>24]<<24|T[N>>>16&255]<<16|T[M>>>8&255]<<8|T[D&255])^w[L++];g[_]=K,g[_+1]=G,g[_+2]=X,g[_+3]=F},keySize:256/32});e.AES=n._createHelper(y)}(),t.AES})});var I3t=x((Ade,A3t)=>{(function(t,e,r){typeof Ade=="object"?A3t.exports=Ade=e(oo(),hR(),gR(),VP(),xc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Ade,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.BlockCipher,i=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=i.DES=o.extend({_doReset:function(){for(var h=this._key,y=h.words,g=[],_=0;_<56;_++){var w=a[_]-1;g[_]=y[w>>>5]>>>31-w%32&1}for(var S=this._subKeys=[],C=0;C<16;C++){for(var E=S[C]=[],P=u[C],_=0;_<24;_++)E[_/6|0]|=g[(s[_]-1+P)%28]<<31-_%6,E[4+(_/6|0)]|=g[28+(s[_+24]-1+P)%28]<<31-_%6;E[0]=E[0]<<1|E[0]>>>31;for(var _=1;_<7;_++)E[_]=E[_]>>>(_-1)*4+3;E[7]=E[7]<<5|E[7]>>>27}for(var T=this._invSubKeys=[],_=0;_<16;_++)T[_]=S[15-_]},encryptBlock:function(h,y){this._doCryptBlock(h,y,this._subKeys)},decryptBlock:function(h,y){this._doCryptBlock(h,y,this._invSubKeys)},_doCryptBlock:function(h,y,g){this._lBlock=h[y],this._rBlock=h[y+1],f.call(this,4,252645135),f.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),f.call(this,1,1431655765);for(var _=0;_<16;_++){for(var w=g[_],S=this._lBlock,C=this._rBlock,E=0,P=0;P<8;P++)E|=l[P][((C^w[P])&c[P])>>>0];this._lBlock=C,this._rBlock=S^E}var T=this._lBlock;this._lBlock=this._rBlock,this._rBlock=T,f.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),h[y]=this._lBlock,h[y+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function f(h,y){var g=(this._lBlock>>>h^this._rBlock)&y;this._rBlock^=g,this._lBlock^=g<<h}function p(h,y){var g=(this._rBlock>>>h^this._lBlock)&y;this._lBlock^=g,this._rBlock^=g<<h}e.DES=o._createHelper(d);var m=i.TripleDES=o.extend({_doReset:function(){var h=this._key,y=h.words;if(y.length!==2&&y.length!==4&&y.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var g=y.slice(0,2),_=y.length<4?y.slice(0,2):y.slice(2,4),w=y.length<6?y.slice(0,2):y.slice(4,6);this._des1=d.createEncryptor(n.create(g)),this._des2=d.createEncryptor(n.create(_)),this._des3=d.createEncryptor(n.create(w))},encryptBlock:function(h,y){this._des1.encryptBlock(h,y),this._des2.decryptBlock(h,y),this._des3.encryptBlock(h,y)},decryptBlock:function(h,y){this._des3.decryptBlock(h,y),this._des2.encryptBlock(h,y),this._des1.decryptBlock(h,y)},keySize:192/32,ivSize:64/32,blockSize:64/32});e.TripleDES=o._createHelper(m)}(),t.TripleDES})});var R3t=x((Ide,M3t)=>{(function(t,e,r){typeof Ide=="object"?M3t.exports=Ide=e(oo(),hR(),gR(),VP(),xc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Ide,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=o.RC4=n.extend({_doReset:function(){for(var u=this._key,l=u.words,c=u.sigBytes,d=this._S=[],f=0;f<256;f++)d[f]=f;for(var f=0,p=0;f<256;f++){var m=f%c,h=l[m>>>2]>>>24-m%4*8&255;p=(p+d[f]+h)%256;var y=d[f];d[f]=d[p],d[p]=y}this._i=this._j=0},_doProcessBlock:function(u,l){u[l]^=a.call(this)},keySize:256/32,ivSize:0});function a(){for(var u=this._S,l=this._i,c=this._j,d=0,f=0;f<4;f++){l=(l+1)%256,c=(c+u[l])%256;var p=u[l];u[l]=u[c],u[c]=p,d|=u[(u[l]+u[c])%256]<<24-f*8}return this._i=l,this._j=c,d}e.RC4=n._createHelper(i);var s=o.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var u=this.cfg.drop;u>0;u--)a.call(this)}});e.RC4Drop=n._createHelper(s)}(),t.RC4})});var j3t=x((Mde,N3t)=>{(function(t,e,r){typeof Mde=="object"?N3t.exports=Mde=e(oo(),hR(),gR(),VP(),xc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Mde,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.Rabbit=n.extend({_doReset:function(){for(var c=this._key.words,d=this.cfg.iv,f=0;f<4;f++)c[f]=(c[f]<<8|c[f]>>>24)&16711935|(c[f]<<24|c[f]>>>8)&4278255360;var p=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],m=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var f=0;f<4;f++)l.call(this);for(var f=0;f<8;f++)m[f]^=p[f+4&7];if(d){var h=d.words,y=h[0],g=h[1],_=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,w=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,S=_>>>16|w&4294901760,C=w<<16|_&65535;m[0]^=_,m[1]^=S,m[2]^=w,m[3]^=C,m[4]^=_,m[5]^=S,m[6]^=w,m[7]^=C;for(var f=0;f<4;f++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],m=p&65535,h=p>>>16,y=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=y^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=n._createHelper(u)}(),t.Rabbit})});var L3t=x((Rde,D3t)=>{(function(t,e,r){typeof Rde=="object"?D3t.exports=Rde=e(oo(),hR(),gR(),VP(),xc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Rde,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.RabbitLegacy=n.extend({_doReset:function(){var c=this._key.words,d=this.cfg.iv,f=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],p=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var m=0;m<4;m++)l.call(this);for(var m=0;m<8;m++)p[m]^=f[m+4&7];if(d){var h=d.words,y=h[0],g=h[1],_=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,w=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,S=_>>>16|w&4294901760,C=w<<16|_&65535;p[0]^=_,p[1]^=S,p[2]^=w,p[3]^=C,p[4]^=_,p[5]^=S,p[6]^=w,p[7]^=C;for(var m=0;m<4;m++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],m=p&65535,h=p>>>16,y=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=y^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=n._createHelper(u)}(),t.RabbitLegacy})});var k3t=x((Nde,F3t)=>{(function(t,e,r){typeof Nde=="object"?F3t.exports=Nde=e(oo(),hR(),gR(),VP(),xc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Nde,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo;let i=16,a=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var u={pbox:[],sbox:[]};function l(m,h){let y=h>>24&255,g=h>>16&255,_=h>>8&255,w=h&255,S=m.sbox[0][y]+m.sbox[1][g];return S=S^m.sbox[2][_],S=S+m.sbox[3][w],S}function c(m,h,y){let g=h,_=y,w;for(let S=0;S<i;++S)g=g^m.pbox[S],_=l(m,g)^_,w=g,g=_,_=w;return w=g,g=_,_=w,_=_^m.pbox[i],g=g^m.pbox[i+1],{left:g,right:_}}function d(m,h,y){let g=h,_=y,w;for(let S=i+1;S>1;--S)g=g^m.pbox[S],_=l(m,g)^_,w=g,g=_,_=w;return w=g,g=_,_=w,_=_^m.pbox[1],g=g^m.pbox[0],{left:g,right:_}}function f(m,h,y){for(let C=0;C<4;C++){m.sbox[C]=[];for(let E=0;E<256;E++)m.sbox[C][E]=s[C][E]}let g=0;for(let C=0;C<i+2;C++)m.pbox[C]=a[C]^h[g],g++,g>=y&&(g=0);let _=0,w=0,S=0;for(let C=0;C<i+2;C+=2)S=c(m,_,w),_=S.left,w=S.right,m.pbox[C]=_,m.pbox[C+1]=w;for(let C=0;C<4;C++)for(let E=0;E<256;E+=2)S=c(m,_,w),_=S.left,w=S.right,m.sbox[C][E]=_,m.sbox[C][E+1]=w;return!0}var p=o.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var m=this._keyPriorReset=this._key,h=m.words,y=m.sigBytes/4;f(u,h,y)}},encryptBlock:function(m,h){var y=c(u,m[h],m[h+1]);m[h]=y.left,m[h+1]=y.right},decryptBlock:function(m,h){var y=d(u,m[h],m[h+1]);m[h]=y.left,m[h+1]=y.right},blockSize:64/32,keySize:128/32,ivSize:64/32});e.Blowfish=n._createHelper(p)}(),t.Blowfish})});var f4=x((jde,$3t)=>{(function(t,e,r){typeof jde=="object"?$3t.exports=jde=e(oo(),dG(),L4t(),k4t(),hR(),z4t(),gR(),fze(),ade(),W4t(),pze(),J4t(),Y4t(),Q4t(),pde(),r3t(),VP(),xc(),a3t(),u3t(),c3t(),f3t(),m3t(),g3t(),b3t(),v3t(),x3t(),C3t(),E3t(),T3t(),I3t(),R3t(),j3t(),L3t(),k3t()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./enc-base64url","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy","./blowfish"],e):t.CryptoJS=e(t.CryptoJS)})(jde,function(t){return t})});var mze,Qmn,Dde,B3t=b(()=>{IE();_t();Zce();mze="copilot-index-chunk-",Qmn=".json",Dde=class{constructor(e,r,n){this.app=e;this.baseDir=r;this.identifier=n}getChunkPath(e){return`${this.baseDir}/${mze}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${mze}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${Qmn}`}assignDocumentToPartition(e,r){let o=Array.from(e).reduce((i,a)=>(i<<5)-i+a.charCodeAt(0),0);return Math.abs(o)%r}distributeDocumentsToPartitions(e,r){let n=new Map,o={};for(let a=0;a<r;a++)n.set(a,[]);ne().debug&&console.log(`Total documents to distribute: ${e.length}`);for(let a of e){let s=this.assignDocumentToPartition(a.id,r),u=n.get(s);if(!u)throw new Error(`Invalid partition index: ${s}`);u.push(a),o[a.id]=s}let i=0;return n.forEach((a,s)=>{i+=a.length,ne().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),ne().debug&&(console.log(`Total documents distributed: ${i}`),i!==e.length&&console.error(`Document count mismatch! Original: ${e.length}, Distributed: ${i}`)),n}async ensureDirectoryExists(e){let r=e.substring(0,e.lastIndexOf("/"));await this.app.vault.adapter.exists(r)||await this.app.vault.adapter.mkdir(r)}async saveDatabase(e){try{let r=await lze(e),n=ne().numPartitions;if(n===1){let l=this.getLegacyPath();await this.ensureDirectoryExists(l),await this.app.vault.adapter.write(l,JSON.stringify({...r,schema:e.schema}));return}let o=r.docs?.docs,i=Array.isArray(o)?o:Object.values(o||{});if(ne().debug&&console.log(`Starting save with ${i.length??0} total documents`),!i||i.length===0){let l={numPartitions:n,vectorLength:e.schema.embedding.match(/\d+/)[0],schema:e.schema,lastModified:Date.now(),documentPartitions:{}},c=this.getMetadataPath();await this.ensureDirectoryExists(c),await this.app.vault.adapter.write(c,JSON.stringify(l)),ne().debug&&console.log("Saved empty database state");return}let a=this.distributeDocumentsToPartitions(i,n),s={numPartitions:n,vectorLength:e.schema.embedding.match(/\d+/)[0],schema:e.schema,lastModified:Date.now(),documentPartitions:Object.fromEntries(i.map(l=>[l.id,this.assignDocumentToPartition(l.id,n)]))};await this.saveMetadata(s);let u={...r,docs:{docs:{},count:0},index:{...r.index,vectorIndexes:void 0}};for(let[l,c]of a.entries()){let d={index:{vectorIndexes:{embedding:{size:r.index.vectorIndexes.embedding.size,vectors:Object.fromEntries(Object.entries(r.index.vectorIndexes.embedding.vectors).filter(([m])=>c.some(h=>h.id===m)))}}},docs:{docs:Object.fromEntries(c.map((m,h)=>[(h+1).toString(),m])),count:c.length}},f=l===0?{...u,docs:d.docs,index:{...u.index,vectorIndexes:d.index.vectorIndexes}}:d,p=this.getChunkPath(l);await this.ensureDirectoryExists(p),await this.app.vault.adapter.write(p,JSON.stringify(f)),ne().debug&&console.log(`Saved partition ${l+1}/${n}`)}ne().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new en(`Failed to save database: ${r.message}`)}}async loadDatabase(){try{let e=this.getLegacyPath();if(await this.app.vault.adapter.exists(e)){let u=JSON.parse(await this.app.vault.adapter.read(e));if(!u?.schema)throw new en("Invalid legacy database format");let l=await u4({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await Jce(l,u),l}let r=await this.loadMetadata(),n=await u4({schema:r.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}}),o=null,i=[];for(let u=0;u<r.numPartitions;u++){let l=this.getChunkPath(u);if(await this.app.vault.adapter.exists(l)){let c=JSON.parse(await this.app.vault.adapter.read(l));i.push(c),u===0&&(o=c)}}if(!o)throw new en("No data found in chunks");let a={},s=1;for(let u of o.internalDocumentIDStore.internalIdToId){let l=i.flatMap(c=>Object.values(c.docs.docs)).find(c=>c.id===u);l?(a[s.toString()]=l,s++):ne().debug&&console.warn(`Document ${u} not found in any chunk`)}return o.docs.docs=a,o.docs.count=Object.keys(a).length,o.index.vectorIndexes.embedding.vectors=Object.assign({},...i.map(u=>u.index?.vectorIndexes?.embedding?.vectors||{})),await Jce(n,o),n}catch(e){throw console.error("Error loading database:",e),new en(`Failed to load database: ${e.message}`)}}async clearStorage(){try{let e=this.getLegacyPath();await this.app.vault.adapter.exists(e)&&await this.app.vault.adapter.remove(e);let r=await this.app.vault.adapter.list(this.baseDir);for(let n of r.files)n.startsWith(`${this.baseDir}/${mze}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(e){throw console.error("Error clearing storage:",e),new en(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(ne().numPartitions===1)return await this.app.vault.adapter.exists(e);let r=this.getMetadataPath();return await this.app.vault.adapter.exists(r)||await this.app.vault.adapter.exists(e)}async loadMetadata(){let e=this.getMetadataPath();if(!await this.app.vault.adapter.exists(e))throw new en("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(e));if(!r?.schema)throw new en("Invalid metadata file: missing schema");return r}async saveMetadata(e){let r=this.getMetadataPath();await this.ensureDirectoryExists(r),await this.app.vault.adapter.write(r,JSON.stringify(e))}}});var H3t={};as(H3t,{categorizePatterns:()=>p4,createPatternSettingsValue:()=>m4,extractAppIgnoreSettings:()=>fG,getAllQAMarkdownContent:()=>yze,getDecodedPatterns:()=>ah,getExtensionPattern:()=>bze,getFilePattern:()=>h4,getInternalExcludePaths:()=>U3t,getMatchingPatterns:()=>mu,getTagPattern:()=>pG,getVectorLength:()=>gze,isInternalExcludedFile:()=>g4,isInternalExcludedPath:()=>q3t,previewPatternValue:()=>rhn,shouldIndexFile:()=>Ma});async function gze(t){if(!t)throw new en("Embedding instance not found.");try{let r=await t.embedQuery("Sample text for embedding");if(!r||r.length===0)throw new en("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${Ru.getModelName(t)}`),r.length}catch(e){throw console.error("Error getting vector length:",e),new en("Failed to determine embedding vector length. Please check your embedding model settings.")}}async function yze(t){let e="",{inclusions:r,exclusions:n}=mu(),o=t.vault.getMarkdownFiles().filter(i=>Ma(i,r,n));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(a=>e+=a+" ")),e}function ah(t){let e=[];return e.push(...t.split(",").map(r=>decodeURIComponent(r.trim())).filter(r=>r.length>0)),e}function ehn(){return ne().qaExclusions?ah(ne().qaExclusions):[]}function thn(){return ne().qaInclusions?ah(ne().qaInclusions):[]}function mu(t){let e=t?.inclusions?ah(t.inclusions):t?.isProject?[]:thn(),r=t?.exclusions?ah(t.exclusions):t?.isProject?[]:ehn();return{inclusions:e.length>0?p4(e):null,exclusions:r.length>0?p4(r):null}}function Ma(t,e,r,n){return!(g4(t)||r&&z3t(t.path,r)||e&&!z3t(t.path,e)||n&&!e)}function p4(t){let e=[],r=[],n=[],o=[],i=/^#[^\s#]+$/,a=/^\*\.([a-zA-Z0-9.]+)$/,s=/^\[\[(.*?)\]\]$/;return t.forEach(u=>{i.test(u)?e.push(u):a.test(u)?r.push(u):s.test(u)?o.push(u):n.push(u)}),{tagPatterns:e,extensionPatterns:r,folderPatterns:n,notePatterns:o}}function rhn(t){return ah(t).join(", ")}function m4({tagPatterns:t,extensionPatterns:e,folderPatterns:r,notePatterns:n}){return[...t??[],...e??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function nhn(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);if(r instanceof hze.TFile){let n=Fj(r);if(e.some(o=>n.includes(rz(o))))return!0}return!1}function ohn(t,e){if(e.length===0)return!1;let r=t.toLowerCase();return e.some(n=>{let o=n.slice(1).toLowerCase();return r.endsWith(o)})}function ihn(t,e){if(e.length===0)return!1;let r=t.replace(/\\/g,"/");return e.some(n=>{let o=n.replace(/\\/g,"/").replace(/\/$/,"");return r.startsWith(o)&&(r.length===o.length||r[o.length]==="/")})}function ahn(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);return!!(r instanceof hze.TFile&&e.some(n=>n.slice(2,-2)===r.basename))}function z3t(t,e){if(!e)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=e;return nhn(t,r??[])||ohn(t,n??[])||ihn(t,o??[])||ahn(t,i??[])}function fG(t){let e=[];try{if(typeof t.vault.getConfig=="function"){let r=t.vault.getConfig("userIgnoreFilters");r&&Array.isArray(r)&&r.forEach(n=>{typeof n=="string"&&e.push(n.endsWith("/")?n.slice(0,-1):n)})}}catch(r){console.warn("Error getting userIgnoreFilters from Obsidian config",r)}return e}function pG(t){return`#${t}`}function h4(t){return`[[${t.basename}]]`}function bze(t){return`*.${t}`}function U3t(){return[Nf.getLogPath()]}function q3t(t){return new Set(U3t()).has(t)}function g4(t){return q3t(t.path)}var hze,Yp=b(()=>{IE();fF();_t();ez();kt();hze=require("obsidian")});var V3t,dO,WP,Lde=b(()=>{fF();IE();$t();_t();kt();Zce();dze();V3t=j(f4()),dO=require("obsidian");B3t();Yp();WP=class t{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new _F;oa(async()=>{let r=ne();dO.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):dO.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await Ru.getInstance().getEmbeddingsAPI());let n=await this.getDbPath();this.dbPath&&n!==this.dbPath&&(B("Path change detected, reinitializing database..."),this.dbPath=n,await this.initializeChunkedStorage(),await this.initializeDB(await Ru.getInstance().getEmbeddingsAPI()),B("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new en("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new Dde(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),dO.Platform.isMobile&&ne().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new en("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),B("Loaded existing chunked semantic index database from disk."),this.oramaDb}catch(n){ie("Failed to load existing semantic index database, creating new one:",n)}let r=await this.createNewDb(e);return this.oramaDb=r,r}catch(r){ie("Error initializing semantic index database:",r),new dO.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(dO.Platform.isMobile&&ne().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await Ru.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new en("Semantic index database not found.")}catch(e){throw ie("Failed to initialize database during save:",e),new en("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,ne().debug&&B("Semantic index database saved successfully at:",this.dbPath)}catch(e){throw ie("Error saving semantic index database:",e),e}}}async clearIndex(e){try{this.oramaDb||await this.initializeDB(e),await this.chunkedStorage?.clearStorage(),await new Promise(r=>setTimeout(r,100)),this.oramaDb=await this.createNewDb(e),await this.saveDB(),new dO.Notice("Local Copilot index cleared successfully."),B("Local Copilot index cleared successfully, new instance created.")}catch(r){throw ie("Error clearing the local Copilot index:",r),new dO.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(e){if(!this.oramaDb)throw new en("Semantic index database not found.");try{let r=await Zp(this.oramaDb,{term:e,properties:["path"]});r.hits.length>0&&(await cG(this.oramaDb,r.hits.map(n=>n.id),500),ne().debug&&B(`Deleted document from local Copilot index: ${e}`)),this.markUnsavedChanges()}catch(r){ie("Error deleting document from local Copilotindex:",r)}}getDb(){return this.oramaDb||console.warn("Database not initialized. Some features may be limited."),this.oramaDb}async getIsIndexLoaded(){return this.isIndexLoaded}async waitForInitialization(){await this.initializationPromise}onunload(){this.hasUnsavedChanges&&this.saveDB()}getCurrentDbPath(){return this.dbPath}async getDbPath(){let e=this.app.vault.getRoot().path,r;if(ne().enableIndexSync)r=this.app.vault.configDir;else{let n=e==="/"?"":e;r=`${n===""||n.startsWith("/")?"":"/"}${n}/.copilot-index`,await this.app.vault.adapter.exists(r)||(await this.app.vault.adapter.mkdir(r),B("Created directory:",r))}return r}getVaultIdentifier(){let e=this.app.vault.getName();return(0,V3t.MD5)(e).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new en("Embedding instance not found.");let r=await gze(e);if(!r||r===0)throw new en("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await u4({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return B(`Created new semantic index database for ${this.dbPath}. Embedding model: ${Ru.getModelName(e)} with vector length ${r}.`),this.isIndexLoaded=!0,o}static async getDocsByPath(e,r){if(!e)throw new Error("DB not initialized");return r?(await Zp(e,{term:r,properties:["path"],exact:!0,includeVectors:!0})).hits:void 0}static async getDocsByEmbedding(e,r,n){return(await Zp(e,{mode:"vector",vector:{value:r,property:"embedding"},limit:n.limit,similarity:n.similarity,includeVectors:!0})).hits}static async getLatestFileMtime(e){if(!e)throw new Error("DB not initialized");try{let r=await Zp(e,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return r.hits.length>0?r.hits[0].document.mtime:0}catch(r){return ie("Error getting latest file mtime from VectorDB:",r),0}}createDynamicSchema(e){return{id:"string",title:"string",path:"string",content:"string",embedding:`vector[${e}]`,embeddingModel:"string",created_at:"number",ctime:"number",mtime:"number",tags:"string[]",extension:"string"}}async upsert(e){if(!this.oramaDb)throw new Error("DB not initialized");let r=this.oramaDb;return await this.upsertMutex.runExclusive(async()=>{try{let n=this.chunkedStorage?.assignDocumentToPartition(e.id,ne().numPartitions),o=await Zp(r,{term:e.id,properties:["id"],limit:1});o.hits.length>0&&await gF(r,o.hits[0].id);try{return await lG(r,e),B(`${o.hits.length>0?"Updated":"Inserted"} document ${e.id} in partition ${n}`),this.markUnsavedChanges(),e}catch(i){if(ie(`Failed to ${o.hits.length>0?"update":"insert"} document ${e.id}:`,i),o.hits.length>0)try{await lG(r,o.hits[0].document)}catch(a){ie("Failed to restore previous document version:",a)}return}}catch(n){ie(`Error upserting document ${e.id}:`,n);return}})}async getLatestFileMtime(){if(!this.oramaDb)throw new Error("DB not initialized");try{let e=await Zp(this.oramaDb,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return e.hits.length>0?e.hits[0].document.mtime:0}catch(e){return ie("Error getting latest file mtime from VectorDB:",e),0}}async checkAndHandleEmbeddingModelChange(e){if(!this.oramaDb){B("Embedding model change detected. Semantic index database not found. Initializing new database...");try{return await this.initializeDB(e),!0}catch(o){throw ie("Failed to initialize database:",o),new en("Failed to initialize semantic index database. Please check your embedding model settings.")}}let r=await Zp(this.oramaDb,{term:"",limit:1}),n;if(r.hits.length>0){let o=r.hits[0];typeof o=="object"&&o!==null&&"document"in o&&(n=o.document.embeddingModel)}if(n){let o=Ru.getModelName(e);if(!Zet(n,o))return new dO.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),B(`Detected change in embedding model from "${n}" to "${o}". Rebuilding Copilot index from scratch.`),this.oramaDb=await this.createNewDb(e),await this.saveDB(),!0}else B("No previous embedding model found in the database.");return!1}static async getAllDocuments(e){return(await Zp(e,{term:"",limit:1e5,includeVectors:!0})).hits.map(n=>n.document)}async garbageCollect(){if(!this.oramaDb){B("Semantic index database not found during garbage collection. Attempting to initialize...");try{let e=await Ru.getInstance().getEmbeddingsAPI();if(!e)throw new en("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new en("Failed to initialize database after attempt.")}catch(e){throw ie("Failed to initialize database during garbage collection:",e),new en("Failed to initialize database. Please check your embedding model settings.")}}try{let e=this.app.vault.getMarkdownFiles(),r=new Set(e.map(u=>u.path)),{inclusions:n,exclusions:o}=mu(),i=new Set(e.filter(u=>Ma(u,n,o)).map(u=>u.path)),s=(await t.getAllDocuments(this.oramaDb)).filter(u=>!r.has(u.path)||!i.has(u.path));return s.length===0?0:(B("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(s.map(u=>u.path))).join(", ")),s.length===1?await gF(this.oramaDb,s[0].id):await cG(this.oramaDb,s.map(u=>u.id),500),await this.saveDB(),s.length)}catch(e){throw ie("Error garbage collecting the Copilot index:",e),new en("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new en("Semantic index database not found.");try{let e=await t.getAllDocuments(this.oramaDb),r=new Set;return e.forEach(n=>{r.add(n.path)}),Array.from(r).sort()}catch(e){throw ie("Error getting indexed files:",e),new en("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await Zp(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw ie("Error checking if database is empty:",e),new en("Failed to check if database is empty.")}}async hasIndex(e){if(!this.oramaDb)return!1;let r=await t.getDocsByPath(this.oramaDb,e);return r!==void 0&&r.length>0}async hasEmbeddings(e){if(!this.oramaDb)return!1;let r=await t.getDocsByPath(this.oramaDb,e);return!r||r.length===0?!1:r.every(n=>n?.document?.embedding&&Array.isArray(n.document.embedding)&&n.document.embedding.length>0)}async getDocsJsonByPaths(e){if(!this.oramaDb)throw new en("Semantic index database not found.");let r={};for(let n of e){let o=await t.getDocsByPath(this.oramaDb,n);o&&o.length>0&&(r[n]=o.map(i=>({id:i.document.id,title:i.document.title,path:i.document.path,content:i.document.content,metadata:i.document.metadata,embedding:i.document.embedding,embeddingModel:i.document.embeddingModel,tags:i.document.tags,extension:i.document.extension,nchars:i.document.nchars})))}return r}markFileMissingEmbeddings(e){this.filesWithoutEmbeddings.add(e)}clearFilesMissingEmbeddings(){this.filesWithoutEmbeddings.clear()}getFilesMissingEmbeddings(){return Array.from(this.filesWithoutEmbeddings)}isFileMissingEmbeddings(e){return this.filesWithoutEmbeddings.has(e)}async checkIndexIntegrity(){if(!this.oramaDb)throw new en("Orama database not found.");try{let e=await this.getIndexedFiles();for(let n of e)await this.hasEmbeddings(n)||this.markFileMissingEmbeddings(n);let r=this.getFilesMissingEmbeddings();r.length>0?B("Files missing embeddings after integrity check:",r.join(", ")):B("Index integrity check completed. All documents have embeddings.")}catch(e){throw ie("Error checking index integrity:",e),new en("Failed to check index integrity.")}}}});var y4,shn,Fde,W3t=b(()=>{la();xu();$t();_t();y4=require("obsidian");Yp();shn=5e3,Fde=class{constructor(e,r,n){this.app=e;this.indexOps=r;this.dbOps=n;this.debounceTimer=null;this.lastActiveFile=null;this.lastActiveFileMtime=null;this.listenersActive=!1;this.handleActiveLeafChange=async e=>{if(!this.shouldHandleEvents()||y4.Platform.isMobile&&ne().disableIndexOnMobile||ry()!=="copilot_plus")return;let n=this.lastActiveFile,o=this.lastActiveFileMtime,i=e?.view;if(this.lastActiveFile=i instanceof y4.MarkdownView?i.file:null,this.lastActiveFileMtime=this.lastActiveFile?.stat?.mtime??null,!(!n||n===this.lastActiveFile)&&!(!n?.stat?.mtime||o===null)&&n.extension==="md"){let{inclusions:a,exclusions:s}=mu(),u=Ma(n,a,s),l=o!==null&&n.stat.mtime>o;u&&l&&this.debouncedReindexFile(n)}};this.debouncedReindexFile=e=>{this.shouldHandleEvents()&&(this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{ne().debug&&console.log("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e),this.debounceTimer=null},shn))};this.handleFileDelete=async e=>{this.shouldHandleEvents()&&e instanceof y4.TFile&&await this.dbOps.removeDocs(e.path)};this.syncEventListeners(),oa(()=>{this.syncEventListeners()})}shouldHandleEvents(){return ne().enableSemanticSearchV3}syncEventListeners(){let e=this.shouldHandleEvents();e&&!this.listenersActive?(B("Copilot Plus: Initializing semantic index event listeners"),this.app.workspace.on("active-leaf-change",this.handleActiveLeafChange),this.app.vault.on("delete",this.handleFileDelete),this.listenersActive=!0):!e&&this.listenersActive&&this.teardownEventListeners()}teardownEventListeners(){this.listenersActive&&(this.app.workspace.off("active-leaf-change",this.handleActiveLeafChange),this.app.vault.off("delete",this.handleFileDelete),this.debounceTimer!==null&&(window.clearTimeout(this.debounceTimer),this.debounceTimer=null),this.lastActiveFile=null,this.lastActiveFileMtime=null,this.listenersActive=!1)}cleanup(){this.teardownEventListeners()}unload(){this.teardownEventListeners()}}});var mG,K3t=b(()=>{mG=class{constructor(e){this.lastRequestTime=0;this.requestsPerMin=e}setRequestsPerMin(e){this.requestsPerMin=e}getRequestsPerMin(){return this.requestsPerMin}async wait(){let r=Date.now()-this.lastRequestTime,n=Math.max(0,6e4/this.requestsPerMin-r);n>0&&await new Promise(o=>setTimeout(o,n)),this.lastRequestTime=Date.now()}}});var sh,G3t=b(()=>{sh=class{constructor(e){Object.defineProperty(this,"pageContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.pageContent=e.pageContent!==void 0?e.pageContent.toString():"",this.metadata=e.metadata??{},this.id=e.id}}});var kde,J3t=b(()=>{Af();kde=class extends zn{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","documents","transformers"]})}invoke(e,r){return this.transformDocuments(e)}}});var Z3t=b(()=>{G3t();J3t()});var hG=b(()=>{Z3t()});var Y3t=b(()=>{bFe()});var _ze,b4,X3t=b(()=>{hG();Y3t();_ze=class extends kde{constructor(e){if(super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","document_transformers","text_splitters"]}),Object.defineProperty(this,"chunkSize",{enumerable:!0,configurable:!0,writable:!0,value:1e3}),Object.defineProperty(this,"chunkOverlap",{enumerable:!0,configurable:!0,writable:!0,value:200}),Object.defineProperty(this,"keepSeparator",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lengthFunction",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.chunkSize=e?.chunkSize??this.chunkSize,this.chunkOverlap=e?.chunkOverlap??this.chunkOverlap,this.keepSeparator=e?.keepSeparator??this.keepSeparator,this.lengthFunction=e?.lengthFunction??(r=>r.length),this.chunkOverlap>=this.chunkSize)throw new Error("Cannot have chunkOverlap >= chunkSize")}async transformDocuments(e,r={}){return this.splitDocuments(e,r)}splitOnSeparator(e,r){let n;if(r)if(this.keepSeparator){let o=r.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&");n=e.split(new RegExp(`(?=${o})`))}else n=e.split(r);else n=e.split("");return n.filter(o=>o!=="")}async createDocuments(e,r=[],n={}){let o=r.length>0?r:[...Array(e.length)].map(()=>({})),{chunkHeader:i="",chunkOverlapHeader:a="(cont'd) ",appendChunkOverlapHeader:s=!1}=n,u=new Array;for(let l=0;l<e.length;l+=1){let c=e[l],d=1,f=null,p=-1;for(let m of await this.splitText(c)){let h=i,y=c.indexOf(m,p+1);if(f===null){let S=this.numberOfNewLines(c,0,y);d+=S}else{let S=p+await this.lengthFunction(f);if(S<y){let C=this.numberOfNewLines(c,S,y);d+=C}else if(S>y){let C=this.numberOfNewLines(c,y,S);d-=C}s&&(h+=a)}let g=this.numberOfNewLines(m),_=o[l].loc&&typeof o[l].loc=="object"?{...o[l].loc}:{};_.lines={from:d,to:d+g};let w={...o[l],loc:_};h+=m,u.push(new sh({pageContent:h,metadata:w})),d+=g,f=m,p=y}}return u}numberOfNewLines(e,r,n){return(e.slice(r,n).match(/\n/g)||[]).length}async splitDocuments(e,r={}){let n=e.filter(a=>a.pageContent!==void 0),o=n.map(a=>a.pageContent),i=n.map(a=>a.metadata);return this.createDocuments(o,i,r)}joinDocs(e,r){let n=e.join(r).trim();return n===""?null:n}async mergeSplits(e,r){let n=[],o=[],i=0;for(let s of e){let u=await this.lengthFunction(s);if(i+u+o.length*r.length>this.chunkSize&&(i>this.chunkSize&&console.warn(`Created a chunk of size ${i}, +
which is longer than the specified ${this.chunkSize}`),o.length>0)){let l=this.joinDocs(o,r);for(l!==null&&n.push(l);i>this.chunkOverlap||i+u+o.length*r.length>this.chunkSize&&i>0;)i-=await this.lengthFunction(o[0]),o.shift()}o.push(s),i+=u}let a=this.joinDocs(o,r);return a!==null&&n.push(a),n}},b4=class t extends _ze{static lc_name(){return"RecursiveCharacterTextSplitter"}constructor(e){super(e),Object.defineProperty(this,"separators",{enumerable:!0,configurable:!0,writable:!0,value:[`
`,`
`," ",""]}),this.separators=e?.separators??this.separators,this.keepSeparator=e?.keepSeparator??!0}async _splitText(e,r){let n=[],o=r[r.length-1],i;for(let l=0;l<r.length;l+=1){let c=r[l];if(c===""){o=c;break}if(e.includes(c)){o=c,i=r.slice(l+1);break}}let a=this.splitOnSeparator(e,o),s=[],u=this.keepSeparator?"":o;for(let l of a)if(await this.lengthFunction(l)<this.chunkSize)s.push(l);else{if(s.length){let c=await this.mergeSplits(s,u);n.push(...c),s=[]}if(!i)n.push(l);else{let c=await this._splitText(l,i);n.push(...c)}}if(s.length){let l=await this.mergeSplits(s,u);n.push(...l)}return n}async splitText(e){return this._splitText(e,this.separators)}static fromLanguage(e,r){return new t({...r,separators:t.getSeparatorsForLanguage(e)})}static getSeparatorsForLanguage(e){if(e==="cpp")return[`
class `,`
void `,`
int `,`
float `,`
double `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="go")return[`
func `,`
var `,`
const `,`
type `,`
if `,`
for `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="java")return[`
class `,`
public `,`
protected `,`
private `,`
static `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="js")return[`
function `,`
const `,`
let `,`
var `,`
class `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
default `,`
`,`
`," ",""];if(e==="php")return[`
function `,`
class `,`
if `,`
foreach `,`
while `,`
do `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="proto")return[`
message `,`
service `,`
enum `,`
option `,`
import `,`
syntax `,`
`,`
`," ",""];if(e==="python")return[`
class `,`
def `,`
def `,`
`,`
`," ",""];if(e==="rst")return[`
===
`,`
---
`,`
***
`,`
.. `,`
`,`
`," ",""];if(e==="ruby")return[`
def `,`
class `,`
if `,`
unless `,`
while `,`
for `,`
do `,`
begin `,`
rescue `,`
`,`
`," ",""];if(e==="rust")return[`
fn `,`
const `,`
let `,`
if `,`
while `,`
for `,`
loop `,`
match `,`
const `,`
`,`
`," ",""];if(e==="scala")return[`
class `,`
object `,`
def `,`
val `,`
var `,`
if `,`
for `,`
while `,`
match `,`
case `,`
`,`
`," ",""];if(e==="swift")return[`
func `,`
class `,`
struct `,`
enum `,`
if `,`
for `,`
while `,`
do `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="markdown")return[`
## `,`
### `,`
#### `,`
##### `,`
###### `,"```\n\n",`
***
`,`
---
`,`
___
`,`
`,`
`," ",""];if(e==="latex")return[`
\\chapter{`,`
\\section{`,`
\\subsection{`,`
\\subsubsection{`,`
\\begin{enumerate}`,`
\\begin{itemize}`,`
\\begin{description}`,`
\\begin{list}`,`
\\begin{quote}`,`
\\begin{quotation}`,`
\\begin{verse}`,`
\\begin{verbatim}`,`
\\begin{align}`,"$$","$",`
`,`
`," ",""];if(e==="html")return["<body>","<div>","<p>","<br>","<li>","<h1>","<h2>","<h3>","<h4>","<h5>","<h6>","<span>","<table>","<tr>","<td>","<th>","<ul>","<ol>","<header>","<footer>","<nav>","<head>","<style>","<script>","<meta>","<title>"," ",""];if(e==="sol")return[`
pragma `,`
using `,`
contract `,`
interface `,`
library `,`
constructor `,`
type `,`
function `,`
event `,`
modifier `,`
error `,`
struct `,`
enum `,`
if `,`
for `,`
while `,`
do while `,`
assembly `,`
`,`
`," ",""];throw new Error(`Language ${e} is not supported.`)}}});var Q3t=b(()=>{X3t()});var eHt=b(()=>{Q3t()});var tHt=b(()=>{eHt()});var vze=b(()=>{tHt()});var rHt,fO,$de,nHt=b(()=>{er();fF();$t();K3t();_t();kt();rHt=j(f4());vze();fO=require("obsidian");Yp();$de=class{constructor(e,r,n){this.app=e;this.dbOps=r;this.embeddingsManager=n;this.state={isIndexingPaused:!1,isIndexingCancelled:!1,indexedCount:0,totalFilesToIndex:0,processedFiles:new Set,currentIndexingNotice:null,indexNoticeMessage:null};let o=ne();this.rateLimiter=new mG(o.embeddingRequestsPerMin),this.embeddingBatchSize=o.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize,oa(async()=>{let i=ne();this.rateLimiter=new mG(i.embeddingRequestsPerMin),this.embeddingBatchSize=i.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize})}async indexVaultToVectorStore(e){let r=[];try{let n=await this.embeddingsManager.getEmbeddingsAPI();if(!n)return console.error("Embedding instance not found."),0;await this.dbOps.checkAndHandleEmbeddingModelChange(n)&&(e=!0),e?(await this.dbOps.clearIndex(n),this.dbOps.clearFilesMissingEmbeddings()):await this.dbOps.garbageCollect();let i=await this.getFilesToIndex(e);if(i.length===0)return new fO.Notice("Copilot vault index is up-to-date."),0;this.initializeIndexingState(i.length),this.createIndexingNotice(),this.dbOps.clearFilesMissingEmbeddings();let a=await this.prepareAllChunks(i);if(a.length===0)return new fO.Notice("No valid content to index."),0;for(let s=0;s<a.length&&!this.state.isIndexingCancelled;s+=this.embeddingBatchSize){await this.handlePause();let u=a.slice(s,s+this.embeddingBatchSize);try{await this.rateLimiter.wait();let l=await n.embedDocuments(u.map(f=>f.content));if(!l||l.length!==u.length)throw new Error(`Embedding model returned ${l?.length??0} embeddings for ${u.length} documents`);for(let f=0;f<u.length;f++){let p=u[f],m=l[f];if(!m||!Array.isArray(m)||m.length===0){ie(`Invalid embedding for document ${p.fileInfo.path}: ${m}`),this.dbOps.markFileMissingEmbeddings(p.fileInfo.path);continue}try{await this.dbOps.upsert({...p.fileInfo,id:this.getDocHash(p.content),content:p.content,embedding:m,created_at:Date.now(),nchars:p.content.length}),this.state.processedFiles.add(p.fileInfo.path)}catch(h){this.handleError(h,{filePath:p.fileInfo.path,errors:r}),this.dbOps.markFileMissingEmbeddings(p.fileInfo.path);continue}}this.state.indexedCount=this.state.processedFiles.size,this.updateIndexingNoticeMessage();let c=Math.floor((this.state.indexedCount-u.length)/this.checkpointInterval);Math.floor(this.state.indexedCount/this.checkpointInterval)>c&&(await this.dbOps.saveDB(),console.log("Copilot index checkpoint save completed."))}catch(l){if(this.handleError(l,{filePath:u?.[0]?.fileInfo?.path,errors:r,batch:u}),this.isRateLimitError(l))break}}return this.finalizeIndexing(r),setTimeout(()=>{this.dbOps.saveDB().then(()=>{B("Copilot index final save completed."),this.dbOps.checkIndexIntegrity().catch(s=>{ie("Background integrity check failed:",s)})}).catch(s=>{ie("Background save failed:",s)})},100),this.state.indexedCount}catch(n){return this.handleError(n),0}}async prepareAllChunks(e){let r=await this.embeddingsManager.getEmbeddingsAPI();if(!r)return console.error("Embedding instance not found."),[];let n=Ru.getModelName(r),o=b4.fromLanguage("markdown",{chunkSize:Bj}),i=[];for(let a of e){let s=await this.app.vault.cachedRead(a);if(!s?.trim())continue;let u=this.app.metadataCache.getFileCache(a),l={title:a.basename,path:a.path,embeddingModel:n,ctime:a.stat.ctime,mtime:a.stat.mtime,tags:u?.tags?.map(d=>d.tag)??[],extension:a.extension,metadata:{...u?.frontmatter??{},created:nu(new Date(a.stat.ctime)).display,modified:nu(new Date(a.stat.mtime)).display}};(await o.createDocuments([s],[],{chunkHeader:`
NOTE TITLE: [[${l.title}]]
METADATA:${JSON.stringify(l.metadata)}
NOTE BLOCK CONTENT:
`,appendChunkOverlapHeader:!0})).forEach(d=>{d.pageContent.trim()&&i.push({content:d.pageContent,fileInfo:l})})}return i}getDocHash(e){return(0,rHt.MD5)(e).toString()}async getFilesToIndex(e){let{inclusions:r,exclusions:n}=mu(),o=this.app.vault.getMarkdownFiles();if(e)return o.filter(c=>Ma(c,r,n));let i=new Set(await this.dbOps.getIndexedFiles()),a=await this.dbOps.getLatestFileMtime(),s=new Set(this.dbOps.getFilesMissingEmbeddings()),u=new Set,l=new Set;for(let c of o){if(!Ma(c,r,n))continue;let d=await this.app.vault.cachedRead(c);if(!d||d.trim().length===0){l.add(c.path);continue}let f=i.has(c.path),p=s.has(c.path);(!f||p||c.stat.mtime>a)&&u.add(c)}return B([`Files to index: ${u.size}`,`Previously indexed: ${i.size}`,`Empty files skipped: ${l.size}`,`Files missing embeddings: ${s.size}`].join(`
`)),Array.from(u)}initializeIndexingState(e){this.state={isIndexingPaused:!1,isIndexingCancelled:!1,indexedCount:0,totalFilesToIndex:e,processedFiles:new Set,currentIndexingNotice:null,indexNoticeMessage:null}}createIndexingNotice(){let e=document.createDocumentFragment(),r=e.createEl("div",{cls:"copilot-notice-container"});this.state.indexNoticeMessage=r.createEl("div",{cls:"copilot-notice-message"}),this.updateIndexingNoticeMessage();let n=r.createEl("div",{cls:"copilot-notice-buttons"}),o=n.createEl("button");o.textContent="Pause",o.addEventListener("click",a=>{a.stopPropagation(),a.preventDefault(),this.state.isIndexingPaused?(this.resumeIndexing(),o.textContent="Pause"):(this.pauseIndexing(),o.textContent="Resume")});let i=n.createEl("button");return i.textContent="Stop",i.style.marginLeft="8px",i.addEventListener("click",a=>{a.stopPropagation(),a.preventDefault(),this.cancelIndexing()}),e.appendChild(this.state.indexNoticeMessage),e.appendChild(n),this.state.currentIndexingNotice=new fO.Notice(e,0),this.state.currentIndexingNotice}async handlePause(){if(this.state.isIndexingPaused){for(;this.state.isIndexingPaused&&!this.state.isIndexingCancelled;)await new Promise(e=>setTimeout(e,100));if(!this.state.isIndexingCancelled){let e=await this.getFilesToIndex();if(e.length===0){console.log("No files to index after filter change, stopping indexing"),this.cancelIndexing(),new fO.Notice("No files to index with current filters");return}this.state.totalFilesToIndex=e.length,console.log("Total files to index:",this.state.totalFilesToIndex),console.log("Files to index:",e),this.updateIndexingNoticeMessage()}}}pauseIndexing(){this.state.isIndexingPaused=!0}resumeIndexing(){this.state.isIndexingPaused=!1}updateIndexingNoticeMessage(){if(this.state.indexNoticeMessage){let e=this.state.isIndexingPaused?" (Paused)":"",r=["Copilot is indexing your vault...",`${this.state.indexedCount}/${this.state.totalFilesToIndex} files processed${e}`],n=ne(),o=ah(n.qaInclusions);o.length>0&&r.push(`Inclusions: ${o.join(", ")}`);let a=[...fG(this.app),...ah(n.qaExclusions)];a.length>0&&r.push(`Exclusions: ${a.join(", ")}`),this.state.indexNoticeMessage.textContent=r.join(`
`)}}isStringLengthError(e){if(!e)return!1;if(e instanceof RangeError&&e.message.toLowerCase().includes("string length"))return!0;let n=(e.message||e.toString()).toLowerCase();return n.includes("string length")||n.includes("rangeerror")}handleError(e,r){let n=r?.filePath;if(n?(r.batch?console.error("Batch processing error:",{error:e,batchSize:r.batch.length||0,firstChunk:r.batch[0]?{path:r.batch[0].fileInfo?.path,contentLength:r.batch[0].content?.length,hasFileInfo:!!r.batch[0].fileInfo}:"No chunks in batch",errorType:e?.constructor?.name,errorMessage:e?.message}):console.error(`Error indexing file ${n}:`,e),r.errors?.push(n)):console.error("Fatal error during indexing:",e),this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide(),this.isStringLengthError(e)){new fO.Notice("Vault is too large for 1 partition, please increase the number of partitions in your Copilot QA settings!",1e4);return}if(this.isRateLimitError(e))return;let o=n?`Error indexing file ${n}. Check console for details.`:"Fatal error during indexing. Check console for details.";new fO.Notice(o)}isRateLimitError(e){return e?.message?.includes?.("rate limit")||!1}finalizeIndexing(e){if(this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide(),this.state.isIndexingCancelled){new fO.Notice("Indexing cancelled");return}e.length>0?new fO.Notice(`Indexing completed with ${e.length} errors. Check console for details.`):new fO.Notice("Indexing completed successfully!")}async reindexFile(e){try{let r=await this.embeddingsManager.getEmbeddingsAPI();if(!r)return;if(await this.dbOps.removeDocs(e.path),await this.dbOps.checkAndHandleEmbeddingModelChange(r)){await this.indexVaultToVectorStore(!0);return}let o=await this.prepareAllChunks([e]);if(o.length===0)return;let i=await r.embedDocuments(o.map(a=>a.content));for(let a=0;a<o.length;a++){let s=o[a];await this.dbOps.upsert({...s.fileInfo,id:this.getDocHash(s.content),content:s.content,embedding:i[a],created_at:Date.now(),nchars:s.content.length})}this.dbOps.markUnsavedChanges(),ne().debug&&console.log(`Reindexed file: ${e.path}`)}catch(r){this.handleError(r,{filePath:e.path})}}async cancelIndexing(){console.log("Indexing cancelled by user"),this.state.isIndexingCancelled=!0,await new Promise(e=>setTimeout(e,100)),this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide()}}});var Vd={};as(Vd,{default:()=>KP});var gG,KP,Sc=b(()=>{IE();fF();_t();gG=require("obsidian");Lde();W3t();nHt();KP=class t{constructor(){this.embeddingsManager=Ru.getInstance(),this.dbOps=new WP(app),this.indexOps=new $de(app,this.dbOps,this.embeddingsManager),this.eventHandler=new Fde(app,this.indexOps,this.dbOps),this.initializationPromise=this.initialize(),this.setupSettingsSubscription()}static getInstance(){return t.instance||(t.instance=new t),t.instance}setupSettingsSubscription(){this.lastKnownSettings={...ne()};let e=async()=>{let r=ne(),n=this.lastKnownSettings;if(this.lastKnownSettings={...r},r.enableIndexSync!==n?.enableIndexSync){let o=await this.dbOps.getDbPath();this.dbOps.getCurrentDbPath()!==o&&await this.dbOps.initializeDB(await this.embeddingsManager.getEmbeddingsAPI())}};oa(()=>{this.initializationPromise=e()})}async initialize(){if(ne().enableSemanticSearchV3)try{let r=3;for(;r>0;)try{let n=await this.embeddingsManager.getEmbeddingsAPI();await this.dbOps.initializeDB(n);break}catch(n){if(n instanceof en&&n.message.includes("Vault adapter not available")&&(r--,r>0)){await new Promise(o=>setTimeout(o,100));continue}new gG.Notice("Failed to initialize vector store. Please make sure you have a valid API key for your embedding model and restart the plugin."),console.error("Failed to initialize vector store:",n);break}}catch(r){console.error("Failed to initialize vector store:",r)}}async waitForInitialization(){await this.initializationPromise}async indexVaultToVectorStore(e){return await this.waitForInitialization(),gG.Platform.isMobile&&ne().disableIndexOnMobile?(new gG.Notice("Indexing is disabled on mobile devices"),0):this.indexOps.indexVaultToVectorStore(e)}async clearIndex(){await this.waitForInitialization(),await this.dbOps.clearIndex(await this.embeddingsManager.getEmbeddingsAPI())}async garbageCollectVectorStore(){return await this.waitForInitialization(),this.dbOps.garbageCollect()}async getIndexedFiles(){return await this.waitForInitialization(),this.dbOps.getIndexedFiles()}async isIndexEmpty(){return await this.waitForInitialization(),await this.dbOps.isIndexEmpty()}async hasIndex(e){return await this.waitForInitialization(),this.dbOps.hasIndex(e)}onunload(){this.eventHandler.cleanup(),this.dbOps.onunload()}async getDbOps(){return await this.waitForInitialization(),this.dbOps}async getDb(){await this.waitForInitialization();let e=this.dbOps.getDb();if(!e)throw new Error("Database is not loaded. Please restart the plugin.");return e}async reindexFile(e){await this.waitForInitialization(),await this.indexOps.reindexFile(e)}}});function iPe(t){return t.split("|")[1]==="copilot-plus"}function _4(){return an().isPlusUser}async function pO(t){return ne().plusLicenseKey?(await Zi.getInstance().validateLicenseKey(t)).isValid:(Oze(),!1)}function iHt(){let t=uhn,e=Sze,r=ne().embeddingModelKey;B("applyPlusSettings: Changing embedding model",{from:r,to:e,changed:r!==e}),Mtt(t),Hj("copilot_plus"),AE({defaultModelKey:t,embeddingModelKey:e,defaultChainType:"copilot_plus"}),r!==e?(B("applyPlusSettings: Embedding model changed, triggering indexing"),Promise.resolve().then(()=>(Sc(),Vd)).then(async n=>{await n.default.getInstance().indexVaultToVectorStore()}).catch(n=>{ie("Failed to trigger indexing after Plus settings applied:",n),new oHt.Notice("Failed to update Copilot index. Please try force reindexing from the command palette.")})):B("applyPlusSettings: No embedding model change, skipping indexing")}function Cze(t){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${t}`}function fD(t){window.open(Cze(t),"_blank")}function aHt(){Xe("isPlusUser",!0)}function Oze(){let t=ne().isPlusUser;Xe("isPlusUser",!1),t&&new _re(app).open()}var oHt,wze,uhn,xze,Sze,ldi,cdi,fy=b(()=>{la();xu();Jat();er();jy();$t();_t();oHt=require("obsidian"),wze="copilot-plus-flash",uhn=wze+"|"+"copilot-plus",xze="copilot-plus-small",Sze=xze+"|"+"copilot-plus",ldi=za.defaultModelKey,cdi=za.embeddingModelKey});function yR(t){let e=new Uint8Array(t),r="";for(let n=0;n<e.byteLength;n++)r+=String.fromCharCode(e[n]);return globalThis.btoa(r)}var Bde=b(()=>{});var sHt,Zi,jy=b(()=>{er();qj();$t();fy();_t();Bde();sHt=require("obsidian"),Zi=class t{constructor(){this.pluginVersion="Unknown"}static getInstance(){return t.instance||(t.instance=new t),t.instance}checkLicenseKey(){if(!ne().plusLicenseKey)throw new sHt.Notice("Copilot Plus license key not found. Please enter your license key in the settings."),new Error("License key not initialized")}setPluginVersion(e){this.pluginVersion=e}async makeRequest(e,r,n="POST",o=!1,i=!1){i||this.checkLicenseKey(),r.user_id=ne().userId;let a=new URL(`${aI}${e}`);n==="GET"&&Object.entries(r).forEach(([l,c])=>{a.searchParams.append(l,c)});let s=await fetch(a.toString(),{method:n,headers:{"Content-Type":"application/json",...!o&&{Authorization:`Bearer ${await Co(ne().plusLicenseKey)}`},"X-Client-Version":this.pluginVersion},...n==="POST"&&{body:JSON.stringify(r)}}),u=await s.json();if(!s.ok)try{let l=u.detail,c=new Error(l.reason);return c.name=l.error,{data:null,error:c}}catch{return{data:null,error:new Error("Unknown error")}}return B(`[API ${e} request]:`,u),{data:u}}async makeFormDataRequest(e,r,n=!1){n||this.checkLicenseKey(),r.append("user_id",ne().userId);let o=new URL(`${aI}${e}`);try{let i=await fetch(o.toString(),{method:"POST",headers:{Authorization:`Bearer ${await Co(ne().plusLicenseKey)}`,"X-Client-Version":this.pluginVersion},body:r}),a=await i.json();if(!i.ok)try{let s=a.detail,u=new Error(s.reason);return u.name=s.error,{data:null,error:u}}catch{return{data:null,error:new Error(`HTTP error: ${i.status}`)}}return B(`[API ${e} form-data request]:`,a),{data:a}}catch(i){return{data:null,error:i instanceof Error?i:new Error(String(i))}}}async validateLicenseKey(e){let r={license_key:await Co(ne().plusLicenseKey)};if(e&&typeof e=="object"){let i=Object.fromEntries(Object.entries(e).filter(([s,u])=>u!=null)),a=new Set(["license_key","user_id"]);for(let s of a)s in i&&delete i[s];Object.assign(r,i)}let{data:n,error:o}=await this.makeRequest("/license",r,"POST",!0,!0);return o?o.message==="Invalid license key"?(Oze(),{isValid:!1}):{isValid:void 0}:(aHt(),{isValid:!0,plan:n?.plan})}async broca(e,r){let{data:n,error:o}=await this.makeRequest("/broca",{message:e,is_project_mode:r});if(o)throw o;if(!n)throw new Error("No data returned from broca");return n}async rerank(e,r){let{data:n,error:o}=await this.makeRequest("/rerank",{query:e,documents:r,model:"rerank-2"});if(o)throw o;if(!n)throw new Error("No data returned from rerank");return n}async url4llm(e){let{data:r,error:n}=await this.makeRequest("/url4llm",{url:e});if(n)throw n;if(!r)throw new Error("No data returned from url4llm");return r}async pdf4llm(e){let r=yR(e),{data:n,error:o}=await this.makeRequest("/pdf4llm",{pdf:r});if(o)throw o;if(!n)throw new Error("No data returned from pdf4llm");return n}async docs4llm(e,r){let n=new FormData,o=this.getMimeTypeFromExtension(r),i=new Blob([e],{type:o}),a=`file.${r}`,s=new File([i],a,{type:o});n.append("files",s),n.append("file_type",r);let{data:u,error:l}=await this.makeFormDataRequest("/docs4llm",n);if(l)throw l;if(!u)throw new Error("No data returned from docs4llm");return u}getMimeTypeFromExtension(e){return{pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",epub:"application/epub+zip",txt:"text/plain",rtf:"application/rtf",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",tiff:"image/tiff",webp:"image/webp",html:"text/html",htm:"text/html",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xls:"application/vnd.ms-excel",csv:"text/csv",mp3:"audio/mpeg",mp4:"video/mp4",wav:"audio/wav",webm:"video/webm"}[e.toLowerCase()]||"application/octet-stream"}async webSearch(e){let{data:r,error:n}=await this.makeRequest("/websearch",{query:e});if(n)throw n;if(!r)throw new Error("No data returned from websearch");return r}async youtube4llm(e){let{data:r,error:n}=await this.makeRequest("/youtube4llm",{url:e});if(n)throw n;if(!r)throw new Error("No data returned from youtube4llm");return r}async autocomplete(e,r="",n=""){let{data:o,error:i}=await this.makeRequest("/autocomplete",{prompt:e,note_context:r,relevant_notes:n,max_tokens:64});if(i)throw i;if(!o)throw new Error("No data returned from autocomplete");return o}async wordcomplete(e,r="",n){let{data:o,error:i}=await this.makeRequest("/wordcomplete",{prefix:e,suffix:r,suggestions:n});if(i)throw i;if(!o)throw new Error("No data returned from wordcomplete");return o}}});var uHt,v4,Eze=b(()=>{$t();uHt=j(f4()),v4=class t{constructor(e){this.memoryCache=new Map;this.cacheDir=e}static getInstance(e=".copilot/file-content-cache"){return t.instance||(t.instance=new t(e)),t.instance}async ensureCacheDir(){await app.vault.adapter.exists(this.cacheDir)||(B("Creating file cache directory:",this.cacheDir),await app.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e,r){let n=`${e.path}:${e.stat.size}:${e.stat.mtime}${r?`:${r}`:""}`;return(0,uHt.MD5)(n).toString()}getCachePath(e){return`${this.cacheDir}/${e}.md`}async get(e){try{let r=this.memoryCache.get(e);if(r)return B("Memory cache hit for file:",e),r.content;let n=this.getCachePath(e);if(await app.vault.adapter.exists(n)){B("File cache hit:",e);let o=await app.vault.adapter.read(n),i,a=o.trim();if(a.startsWith("{")&&a.endsWith("}")||a.startsWith("[")&&a.endsWith("]"))try{i=JSON.parse(o)}catch{i=o}else i=o;let s={content:i,timestamp:Date.now()};return this.memoryCache.set(e,s),s.content}return B("Cache miss for file:",e),null}catch(r){return ie("Error reading from file cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCachePath(e),o=Date.now(),i={content:r,timestamp:o};this.memoryCache.set(e,i);let a;typeof r=="string"?a=r:a=JSON.stringify(r,null,2),await app.vault.adapter.write(n,a),B("Cached file content:",e)}catch(n){ie("Error writing to file cache:",n)}}async remove(e){try{this.memoryCache.delete(e);let r=this.getCachePath(e);await app.vault.adapter.exists(r)&&(await app.vault.adapter.remove(r),B("Removed file from cache:",e))}catch(r){ie("Error removing file from cache:",r)}}async clear(){try{if(this.memoryCache.clear(),await app.vault.adapter.exists(this.cacheDir)){let e=await app.vault.adapter.list(this.cacheDir);B("Clearing file cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){ie("Error clearing file cache:",e)}}}});var Aze=x((xdi,dHt)=>{var lhn="Expected a function",lHt=NaN,chn="[object Symbol]",dhn=/^\s+|\s+$/g,fhn=/^[-+]0x[0-9a-f]+$/i,phn=/^0b[01]+$/i,mhn=/^0o[0-7]+$/i,hhn=parseInt,ghn=typeof window=="object"&&window&&window.Object===Object&&window,yhn=typeof self=="object"&&self&&self.Object===Object&&self,bhn=ghn||yhn||Function("return this")(),_hn=Object.prototype,vhn=_hn.toString,whn=Math.max,xhn=Math.min,Pze=function(){return bhn.Date.now()};function Shn(t,e,r){var n,o,i,a,s,u,l=0,c=!1,d=!1,f=!0;if(typeof t!="function")throw new TypeError(lhn);e=cHt(e)||0,Tze(r)&&(c=!!r.leading,d="maxWait"in r,i=d?whn(cHt(r.maxWait)||0,e):i,f="trailing"in r?!!r.trailing:f);function p(E){var P=n,T=o;return n=o=void 0,l=E,a=t.apply(T,P),a}function m(E){return l=E,s=setTimeout(g,e),c?p(E):a}function h(E){var P=E-u,T=E-l,I=e-P;return d?xhn(I,i-T):I}function y(E){var P=E-u,T=E-l;return u===void 0||P>=e||P<0||d&&T>=i}function g(){var E=Pze();if(y(E))return _(E);s=setTimeout(g,h(E))}function _(E){return s=void 0,f&&n?p(E):(n=o=void 0,a)}function w(){s!==void 0&&clearTimeout(s),l=0,n=u=o=s=void 0}function S(){return s===void 0?a:_(Pze())}function C(){var E=Pze(),P=y(E);if(n=arguments,o=this,u=E,P){if(s===void 0)return m(u);if(d)return s=setTimeout(g,e),p(u)}return s===void 0&&(s=setTimeout(g,e)),a}return C.cancel=w,C.flush=S,C}function Tze(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Chn(t){return!!t&&typeof t=="object"}function Ohn(t){return typeof t=="symbol"||Chn(t)&&vhn.call(t)==chn}function cHt(t){if(typeof t=="number")return t;if(Ohn(t))return lHt;if(Tze(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Tze(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(dhn,"");var r=phn.test(t);return r||mhn.test(t)?hhn(t.slice(2),r?2:8):fhn.test(t)?lHt:+t}dHt.exports=Shn});var fHt,zde,pHt,bR,S_,yG=b(()=>{Eze();$t();Yp();_t();fHt=j(f4()),zde=require("obsidian"),pHt=j(Aze());dze();bR=class bR{constructor(){this.cacheDir=".copilot/project-context-cache";this.memoryCache=new Map;this.projectMutexMap=new Map;this.mutexCreationMutex=new _F;this.handleFileEvent=e=>{e instanceof zde.TFile&&this.debouncedHandleFileChange(e)};this.handleFileChange=async e=>{try{if(e.extension!=="md")return;let n=ne().projectList||[];for(let o of n){let{inclusions:i,exclusions:a}=mu({inclusions:o.contextSource.inclusions,exclusions:o.contextSource.exclusions,isProject:!0});Ma(e,i,a,!0)&&(await this.invalidateMarkdownContext(o),B(`Invalidated markdown context for project ${o.name} due to file change: ${e.path}`))}}catch(r){ie("Error handling file change for project context cache:",r)}};this.debouncedHandleFileChange=(0,pHt.default)(e=>{this.handleFileChange(e)},bR.DEBOUNCE_DELAY,{leading:!0,trailing:!0});this.vault=app.vault,this.fileCache=v4.getInstance(),this.initializeEventListeners()}static getInstance(){return bR.instance||(bR.instance=new bR),bR.instance}cleanup(){this.debouncedHandleFileChange.cancel(),this.vault.off("create",this.handleFileEvent),this.vault.off("modify",this.handleFileEvent),this.vault.off("delete",this.handleFileEvent),this.vault.off("rename",this.handleFileEvent),this.projectMutexMap.clear()}initializeEventListeners(){this.vault.on("create",this.handleFileEvent),this.vault.on("modify",this.handleFileEvent),this.vault.on("delete",this.handleFileEvent),this.vault.on("rename",this.handleFileEvent)}async ensureCacheDir(){await this.vault.adapter.exists(this.cacheDir)||(B("Creating project context cache directory:",this.cacheDir),await this.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e){return(0,fHt.MD5)(e.id).toString()}getCachePath(e){return`${this.cacheDir}/${e}.json`}async getOrCreateProjectMutex(e){let r=e.id,n=this.projectMutexMap.get(r);return n||await this.mutexCreationMutex.runExclusive(async()=>{let o=this.projectMutexMap.get(r);if(o)return o;let i=new _F;return this.projectMutexMap.set(r,i),B(`Created new mutex for project: ${e.name} (ID: ${r})`),i})}async get(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);if(n)return B("Memory cache hit for project:",e.name),n;let o=this.getCachePath(r);if(await this.vault.adapter.exists(o)){B("File cache hit for project:",e.name);let i=await this.vault.adapter.read(o),a=JSON.parse(i);return this.memoryCache.set(r,a),a}return B("Cache miss for project:",e.name),null}catch(r){return ie("Error reading from project context cache:",r),null}}async getOrInitializeCache(e){let r=await this.get(e);if(r)return B(`[getOrInitializeCache] Project ${e.name}: Existing cache found. MarkdownNeedsReload: ${r.markdownNeedsReload}`),r;B(`[getOrInitializeCache] Project ${e.name}: No existing cache found, building fresh context.`);let n=this.createEmptyCache();return await this.setWithoutMutex(e,n),n}getSync(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);return n?(B("Memory cache hit for project:",e.name),n):(B("Memory cache miss for project:",e.name),null)}catch(r){return ie("Error reading from project context memory cache:",r),null}}async set(e,r){let n=await this.getOrCreateProjectMutex(e);return n.isLocked()&&B(`Waiting for project cache lock for project: ${e.name}`),await n.runExclusive(async()=>(B(`Acquired cache lock for project: ${e.name}`),await this.setWithoutMutex(e,r)))}async setWithoutMutex(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);B("Caching context for project:",e.name);let i=JSON.parse(JSON.stringify(r));this.memoryCache.set(n,i),await this.vault.adapter.write(o,JSON.stringify(i))}catch(n){throw ie("Error writing to project context cache:",n),n}}createEmptyCache(){return{markdownContext:"",webContexts:{},youtubeContexts:{},fileContexts:{},timestamp:Date.now(),markdownNeedsReload:!0}}async clearAllCache(){try{let e=new Set;for(let r of Array.from(this.memoryCache.values()))if(r?.fileContexts)for(let n in r.fileContexts)r.fileContexts[n]?.cacheKey&&e.add(r.fileContexts[n].cacheKey);if(this.memoryCache.clear(),await this.vault.adapter.exists(this.cacheDir)){let r=await this.vault.adapter.list(this.cacheDir);B("Clearing project context cache, removing files:",r.files.length),await Promise.all(r.files.map(n=>this.vault.adapter.remove(n)))}for(let r of e)await this.fileCache.remove(r);B(`Cleared ${e.size} file content cache entries associated with projects`)}catch(e){ie("Error clearing project context cache:",e)}}async clearForProject(e){try{B(`[clearForProject] Starting for project: ${e.name} (ID: ${e.id})`);let r=this.getCacheKey(e),n=await this.get(e),o=0;if(n?.fileContexts){let a=Object.keys(n.fileContexts);if(a.length>0){B(`[clearForProject] Project ${e.name}: Found ${a.length} file contexts to remove from FileCache.`);for(let s in n.fileContexts){let u=n.fileContexts[s];u&&u.cacheKey?(await this.fileCache.remove(u.cacheKey),o++):Ft(`[clearForProject] Project ${e.name}: Skipped removing FileCache entry for file ${s} due to missing cacheKey.`)}B(`[clearForProject] Project ${e.name}: Attempted to clear ${o} entries from FileCache.`)}}else B(`[clearForProject] Project ${e.name}: No fileContexts found in existing project cache to clear from FileCache.`);this.memoryCache.delete(r),B(`[clearForProject] Project ${e.name}: Removed from ProjectContextCache memory.`);let i=this.getCachePath(r);await this.vault.adapter.exists(i)?(await this.vault.adapter.remove(i),B(`[clearForProject] Project ${e.name}: Successfully removed main project cache file: ${i}`)):B(`[clearForProject] Project ${e.name}: Main project cache file not found (already deleted or never existed): ${i}`),this.projectMutexMap.delete(e.id),B(`[clearForProject] Cleaned up mutex for project: ${e.name}`),B(`[clearForProject] Completed for project: ${e.name}`)}catch(r){ie(`[clearForProject] Error for project ${e.name} (ID: ${e.id}):`,r)}}async invalidateMarkdownContext(e,r=!1){await this.updateCacheSafely(e,n=>{n.markdownContext="",n.markdownNeedsReload=!0,r&&(n.webContexts={},n.youtubeContexts={},B(`Flagged Web/YouTube contexts for full reload for project ${e.name}`));let o=this.cleanupFileReferencesInCache(e,n);return B(`Invalidated markdown context for project ${e.name}`),o},!0)}async updateMarkdownContext(e,r){return await this.updateCacheSafely(e,n=>(n.markdownContext=r,n.markdownNeedsReload=!1,B(`Updated markdown context for project ${e.name}`),n))}async clearMarkdownContext(e){await this.updateCacheSafely(e,r=>(r.markdownContext="",r.markdownNeedsReload=!0,r))}async getOrReuseFileContext(e,r){try{let n=await this.getFileContext(e,r);if(n)return n;let o=await this.searchOtherProjectsForFile(r);return o?(await this.associateCacheWithProject(e,r,o.cacheKey),B(`Reused cached content from other project for: ${r} in project ${e.name}`),o.content):null}catch(n){return ie(`Error in getOrReuseFileContext for ${r} in project ${e.name}:`,n),null}}async getFileContext(e,r){try{if(!r||typeof r!="string")return ie("Error getting file context: filePath is invalid.",{project:e.name,filePath:r}),null;let n=await this.get(e);if(!n||!n.fileContexts||!n.fileContexts[r])return null;let o=n.fileContexts[r];if(!o||!o.cacheKey||typeof o.cacheKey!="string"||o.cacheKey.trim()==="")return Ft(`Missing, invalid, or empty cacheKey for filePath: ${r} in project ${e.name}. Entry will be treated as a cache miss.`,{project:e.name,filePath:r,fileContextEntry:o}),null;let{cacheKey:i}=o;return typeof i!="string"?(Ft(`cacheKey is not a string for filePath: ${r} in project ${e.name}. Treating as cache miss.`,{project:e.name,filePath:r,cacheKey:i}),null):await this.fileCache.get(i)}catch(n){return ie(`Error getting file context for ${r} in project ${e.name}:`,n),null}}async setFileContext(e,r,n){return await this.updateCacheSafelyAsync(e,async o=>{o.fileContexts||(o.fileContexts={});let i=this.vault.getAbstractFileByPath(r);if(!(i instanceof zde.TFile))throw new Error(`File not found: ${r}`);let a=this.fileCache.getCacheKey(i,e.id);return await this.fileCache.set(a,n),o.fileContexts[r]={timestamp:Date.now(),cacheKey:a},B(`Added/updated file context for ${r} in project ${e.name}`),o})}async removeFileContext(e,r){return await this.updateCacheSafelyAsync(e,async n=>{if(n.fileContexts&&n.fileContexts[r]){let{cacheKey:o}=n.fileContexts[r];delete n.fileContexts[r],await this.fileCache.remove(o),B(`Removed file context for ${r} in project ${e.name}`)}return n})}async searchOtherProjectsForFile(e){try{let n=ne().projectList||[];if(n.length===0)return null;B(`Searching other projects for file: ${e}`);for(let o of n){let i=await this.get(o);if(!(!i||!i.fileContexts)&&i.fileContexts[e]){let{cacheKey:a}=i.fileContexts[e];if(!a)continue;let s=await this.fileCache.get(a);if(s)return B(`Found content for file ${e} in project ${o.name}`),{content:s,cacheKey:a}}}return B(`No content found in any project for file: ${e}`),null}catch(r){return ie(`Error searching other projects for file ${e}:`,r),null}}async associateCacheWithProject(e,r,n){return await this.updateCacheSafelyAsync(e,async o=>(o.fileContexts||(o.fileContexts={}),o.fileContexts[r]={timestamp:Date.now(),cacheKey:n},B(`Associated cache with project ${e.name} for file: ${r}`),o))}cleanupFileReferencesInCache(e,r){if(!r.fileContexts)return r;let{inclusions:n,exclusions:o}=mu({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=0,a={};for(let s in r.fileContexts){let u=this.vault.getAbstractFileByPath(s);!(u instanceof zde.TFile)||!Ma(u,n,o,!0)?i++:a[s]=r.fileContexts[s]}return i>0&&(r.fileContexts=a,B(`Removed ${i} file references from project ${e.name} that no longer match inclusion patterns`)),r}async cleanupProjectFileReferences(e){B(`[cleanupProjectFileReferences] Starting for project: ${e.name}`);try{await this.updateCacheSafely(e,r=>this.cleanupFileReferencesInCache(e,r),!0)}catch(r){ie(`Error cleaning up project file references for ${e.name}:`,r)}}async updateProjectFilesFromPatterns(e,r){try{B(`[updateProjectFilesFromPatterns] Starting for project: ${e.name}`),r.fileContexts||(r.fileContexts={});let{inclusions:n,exclusions:o}=mu({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=this.vault.getFiles(),a=0;for(let s of i)if(Ma(s,n,o,!0)){if(r.fileContexts[s.path])continue;let u=this.fileCache.getCacheKey(s,e.id);r.fileContexts[s.path]={timestamp:Date.now(),cacheKey:u},a++}a>0&&B(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${a} new file references to context (in memory).`),B(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(n){ie(`[updateProjectFilesFromPatterns] Error for project ${e.name}:`,n)}return r}updateProjectMarkdownFilesFromPatterns(e,r,n){try{r.fileContexts||(r.fileContexts={});let o=n.filter(a=>a.extension==="md"),i=0;for(let a of o){if(r.fileContexts[a.path])continue;let s=this.fileCache.getCacheKey(a,e.id);r.fileContexts[a.path]={timestamp:Date.now(),cacheKey:s},i++}i>0&&B(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${i} new file references to context (in memory).`),B(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total markdown fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(o){ie(`[updateProjectFilesFromPatterns] Error for project ${e.name}:`,o)}return r}async removeWebUrls(e,r){r.length&&await this.updateCacheSafely(e,n=>{if(n.webContexts){for(let o of r)n.webContexts[o]&&delete n.webContexts[o];B(`Removed web contexts for URLs ${r.join(", ")} in project ${e.name}`)}return n})}async updateWebUrl(e,r,n){return await this.updateCacheSafely(e,o=>(o.webContexts||(o.webContexts={}),o.webContexts[r]=n,B(`Updated web context for URL ${r} in project ${e.name}`),o))}async removeYoutubeUrls(e,r){r.length&&await this.updateCacheSafely(e,n=>{if(n.youtubeContexts){for(let o of r)n.youtubeContexts[o]&&delete n.youtubeContexts[o];B(`removeYoutubeUrls: Removed YouTube contexts for URLs ${r.join(", ")} in project ${e.name}`)}return n})}async updateYoutubeUrl(e,r,n){return await this.updateCacheSafely(e,o=>(o.youtubeContexts||(o.youtubeContexts={}),o.youtubeContexts[r]=n,B(`Updated YouTube context for URL ${r} in project ${e.name}`),o))}async updateCacheSafely(e,r,n=!1){return await(await this.getOrCreateProjectMutex(e)).runExclusive(async()=>{try{let i=await this.get(e);if(!i){if(n)return;throw new Error(`Project: ${e.name} context cache not found, please invoke getOrInitializeCache method before invoke update context cache`)}let a=r(i);await this.setWithoutMutex(e,a)}catch(i){throw ie(`Error updating cache for project ${e.name}:`,i),i}})}async updateCacheSafelyAsync(e,r,n=!1){return await(await this.getOrCreateProjectMutex(e)).runExclusive(async()=>{try{let i=await this.get(e);if(!i){if(n)return;throw new Error(`Project: ${e.name} context cache not found, please invoke getOrInitializeCache method before invoke update context cache`)}let a=await r(i);await this.setWithoutMutex(e,a)}catch(i){throw ie(`Error updating cache for project ${e.name}:`,i),i}})}async setCacheSafely(e,r){return await(await this.getOrCreateProjectMutex(e)).runExclusive(async()=>(B(`External safe set for project: ${e.name}`),await this.setWithoutMutex(e,r)))}};bR.DEBOUNCE_DELAY=5e3;S_=bR});var vF,mO,wF,Ize=b(()=>{$t();kt();Bde();vF=require("obsidian"),mO=class{static async isImageUrl(e,r){try{let n,o=!1;try{let i=new URL(e),a=i.pathname,s=a.lastIndexOf("."),u=a.lastIndexOf("/");if(s>u&&s>-1&&(n=a.substring(s+1).toLowerCase()),n&&!this.IMAGE_EXTENSIONS.some(c=>c.toLowerCase()===`.${n}`))return ie(`Unsupported image format from URL path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;try{let c=(await wu(e,{method:"HEAD",headers:{}})).headers.get("content-type");return c?.startsWith("image/")?!0:(console.warn(`HEAD request succeeded for ${e} but Content-Type (${c}) is not image/*.`),!1)}catch(l){console.warn(`HEAD request failed for URL: ${e}. Proceeding to heuristic check.`,l);let c=i.searchParams,f=[c.has("w")||c.has("width"),c.has("h")||c.has("height"),c.has("format"),c.has("fit"),c.has("quality"),i.pathname.includes("/image/"),i.pathname.includes("/images/"),i.pathname.includes("/img/"),c.has("auto"),c.has("crop")].filter(Boolean).length;return f>=2?(ie(`Identified as image based on URL heuristics (indicator count: ${f}): ${e}`),!0):!1}}catch{o=!0;let i=e.lastIndexOf(".");if(i>-1)n=e.substring(i+1).toLowerCase();else return!1}if(o)if(n&&this.IMAGE_EXTENSIONS.some(i=>i.toLowerCase()===`.${n}`)){let i=r.getAbstractFileByPath(e);return i instanceof vF.TFile?i.stat.size>this.MAX_IMAGE_SIZE?(ie(`Vault file too large: ${i.stat.size} bytes for path: ${e}`),!1):!0:(ie(`File with image extension not found in vault: ${e}.`),!1)}else return n&&ie(`Unsupported image format for potential vault path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;return ie(`Could not determine image status for URL/path: ${e}`),!1}catch(n){return ie(`Unexpected error in isImageUrl for "${e}":`,n),!1}}static async handleVaultImage(e,r){try{if(e.stat.size>this.MAX_IMAGE_SIZE)return ie(`Image too large: ${e.stat.size} bytes, skipping: ${e.path}`),null;let n=await r.readBinary(e),o=await this.getMimeType(n,e.extension);if(!o.startsWith("image/"))return ie(`Invalid MIME type: ${o}, skipping: ${e.path}`),null;let i=yR(n);return`data:${o};base64,${i}`}catch(n){return ie("Error processing vault image:",n),null}}static async handleWebImage(e){try{let r=await wu(e,{method:"GET",headers:{}});if(!r.ok)return ie(`Failed to fetch image: ${r.statusText}, URL: ${e}`),null;let n=r.headers.get("content-type");if(!n?.startsWith("image/"))return ie(`Invalid content type: ${n}, URL: ${e}`),null;let o=await r.arrayBuffer();if(o.byteLength>this.MAX_IMAGE_SIZE)return ie(`Image too large: ${o.byteLength} bytes, URL: ${e}`),null;let i=yR(o);return`data:${n};base64,${i}`}catch(r){return ie("Error converting web image to base64:",r),null}}static async handleLocalImage(e,r){try{let n=decodeURIComponent(e.replace("app://","")),o=r.getAbstractFileByPath(n);if(!o||!(o instanceof vF.TFile))return ie(`Local image not found: ${n}`),null;if(o.stat.size>this.MAX_IMAGE_SIZE)return ie(`Image too large: ${o.stat.size} bytes, path: ${n}`),null;let i=await r.readBinary(o),a=await this.getMimeType(i,o.extension);if(!a.startsWith("image/"))return ie(`Invalid MIME type: ${a}, path: ${n}`),null;let s=yR(i);return`data:${a};base64,${s}`}catch(n){return ie("Error processing local image:",n),null}}static async imageToBase64(e,r){if(e.startsWith("data:"))return e;if(e.startsWith("attachment:")){let o=e.substring(11),i=r.getAbstractFileByPath(o);return i instanceof vF.TFile?await this.handleVaultImage(i,r):(console.warn(`Could not find attachment file in vault: ${o}`),null)}if(e.startsWith("app://"))return await this.handleLocalImage(e,r);let n=r.getAbstractFileByPath(e);return n instanceof vF.TFile?await this.handleVaultImage(n,r):await this.handleWebImage(e)}static async convertToBase64(e,r){let n=await this.imageToBase64(e,r);return n?{type:"image_url",image_url:{url:n}}:(ie(`Failed to convert image to base64: ${e}`),null)}static async getMimeType(e,r){let n=new Uint8Array(e.slice(0,4));if(n[0]===255&&n[1]===216)return"image/jpeg";if(n[0]===137&&n[1]===80)return"image/png";if(n[0]===71&&n[1]===73)return"image/gif";if(n[0]===82&&n[1]===73)return"image/webp";if(n[0]===66&&n[1]===77)return"image/bmp";if(n[0]===60&&n[1]===115)throw new Error("SVG files are not supported");let o=this.MIME_TYPES[r.toLowerCase()];if(!o){let i=`Unsupported image extension: ${r}`;throw ie(i),new Error(i)}return o}};mO.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],mO.MAX_IMAGE_SIZE=3*1024*1024,mO.MIME_TYPES={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp"};wF=class t{static async processUrlBatch(e,r,n){try{let i=(await Promise.all(e.map(s=>t.processSingleUrl(s,r,n)))).filter(s=>s!==null),a=r.map(s=>`Image read failed for: ${s}`);return{successfulImages:i,failureDescriptions:a}}catch(o){return ie("Error processing URL batch:",o),{successfulImages:[],failureDescriptions:e.map(i=>`Image read failed for: ${i}`)}}}static async processSingleUrl(e,r,n){try{if(!await mO.isImageUrl(e,n))return null;let o=await mO.convertToBase64(e,n);return o||(r.push(e),null)}catch(o){return ie(`Failed to process image: ${e}`,o),r.push(e),null}}static async processChatImageBatch(e,r,n){try{let o=e.filter(u=>u.type==="image_url"&&!!u.image_url?.url),a=(await Promise.all(o.map(u=>t.processChatSingleImage(u,r,n)))).filter(u=>u!==null),s=r.map(u=>`Image read failed for: ${u}`);return{successfulImages:a,failureDescriptions:s}}catch(o){ie("Error processing chat image batch:",o);let i=e.filter(a=>a.type==="image_url"&&!!a.image_url?.url).map(a=>a.image_url.url);return{successfulImages:[],failureDescriptions:i.map(a=>`Image read failed for: ${a}`)}}}static async processChatSingleImage(e,r,n){try{let o=await mO.convertToBase64(e.image_url.url,n);return o||(r.push(e.image_url.url),null)}catch(o){return ie(`Failed to process chat image: ${e.image_url.url}`,o),r.push(e.image_url.url),null}}static showFailedImagesNotice(e){e.length>0&&new vF.Notice(`Failed to process images:
${e.join(`
`)}`)}}});var _R,Ude=b(()=>{Ize();jy();kt();$t();_R=class t{constructor(){this.mentions=new Map,this.brevilabsClient=Zi.getInstance()}static getInstance(){return t.instance||(t.instance=new t),t.instance}extractAllUrls(e){let r=/https?:\/\/[^\s"'<>]+/g;return(e.match(r)||[]).map(n=>n.replace(/,+$/,"")).filter((n,o,i)=>i.indexOf(n)===o)}extractUrls(e){let r=/https?:\/\/[^\s"'<>]+/g;return(e.match(r)||[]).map(n=>n.replace(/,+$/,"")).filter((n,o,i)=>i.indexOf(n)===o).filter(n=>!Qet(n))}async processUrl(e){try{return await this.brevilabsClient.url4llm(e)}catch(r){let n=Fn(r);return ie(`Error processing URL ${e}: ${n}`),{response:e,elapsed_time_ms:0,error:n}}}async processUrls(e){let r=this.extractUrls(e),n="",o=[],i={};if(r.length===0)return{urlContext:n,imageUrls:o,processedErrorUrls:i};let a=r.map(async u=>{if(await mO.isImageUrl(u,app.vault))return o.push(u),null;if(!this.mentions.has(u)){let l=await this.processUrl(u);this.mentions.set(u,{type:"url",original:u,processed:l.response,error:l.error})}return this.mentions.get(u)});return(await Promise.all(a)).forEach(u=>{u?.processed&&(n+=`
<url_content>
<url>${u.original}</url>
<content>
${u.processed}
</content>
</url_content>`),u?.error&&(i[u.original]=u.error)}),{urlContext:n,imageUrls:o,processedErrorUrls:i}}getMentions(){return this.mentions}clearMentions(){this.mentions.clear()}}});var mHt,qde,hHt=b(()=>{$t();mHt=j(f4()),qde=class t{constructor(){this.cacheDir=".copilot/pdf-cache"}static getInstance(){return t.instance||(t.instance=new t),t.instance}async ensureCacheDir(){await app.vault.adapter.exists(this.cacheDir)||(B("Creating PDF cache directory:",this.cacheDir),await app.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e){let r=`${e.path}:${e.stat.size}:${e.stat.mtime}`,n=(0,mHt.MD5)(r).toString();return B("Generated cache key for PDF:",{path:e.path,key:n}),n}getCachePath(e){return`${this.cacheDir}/${e}.json`}async get(e){try{let r=this.getCacheKey(e),n=this.getCachePath(r);if(await app.vault.adapter.exists(n)){B("Cache hit for PDF:",e.path);let o=await app.vault.adapter.read(n);return JSON.parse(o)}return B("Cache miss for PDF:",e.path),null}catch(r){return ie("Error reading from PDF cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);B("Caching PDF response for:",e.path),await app.vault.adapter.write(o,JSON.stringify(r))}catch(n){ie("Error writing to PDF cache:",n)}}async clear(){try{if(await app.vault.adapter.exists(this.cacheDir)){let e=await app.vault.adapter.list(this.cacheDir);B("Clearing PDF cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){ie("Error clearing PDF cache:",e)}}}});function GP(t){if(!t||typeof t!="object")return!1;let e=t.message||t.toString();return e.includes("Request rate limit exceeded")||e.includes("RATE_LIMIT_EXCEEDED")||e.includes("429")||t.status===429}function gHt(t){let r=(t?.message||t?.toString()||"").match(/Try again in ([\d\w\s]+)/);return r?r[1]:"some time"}var bG=b(()=>{});var yHt,Vde,bHt,Hde,_Ht=b(()=>{yHt=require("obsidian"),Hde=class{constructor(e){this.vault=e;Mwe(this,Vde)}async load(e){let r=await this.vault.read(e),{nodes:n=[],edges:o=[]}=JSON.parse(r),i=await Promise.all(n.map(async u=>{if(u.type==="file"&&u.file){let l=this.vault.getAbstractFileByPath(u.file),c=l instanceof yHt.TFile?await this.vault.cachedRead(l):"";return{...u,content:c}}return u.type==="text"?{...u,content:u.text??""}:{...u,content:""}})),a=[...o];$Ge(this,Vde,bHt).call(this,i,a);let s=Object.fromEntries(i.map(u=>[u.id,u]));return{nodes:i,edges:a,byId:s}}buildPrompt(e){let r=new Map,n=e.nodes.filter(s=>s.type==="group");for(let s of n){let u=e.nodes.filter(l=>{if(l.id===s.id)return!1;let c=l.x+l.width/2,d=l.y+l.height/2;return c>=s.x&&d>=s.y&&c<=s.x+s.width&&d<=s.y+s.height});r.set(s.label||s.id,u)}let o=`This canvas contains the following elements:
`,i=s=>{switch(s.type){case"file":return`- File: ${s.file}
Content:
${s.content}
`;case"text":return`- Text: "${s.text}"
`;case"link":return`- Link: ${s.url}
`;default:return""}};n.forEach(s=>{let u=s.label||s.id,l=r.get(u)||[];o+=`Group "${u}" contains:
`,l.forEach(c=>{o+=i(c)}),o+=`
`});let a=e.nodes.filter(s=>s.type==="group"?!1:!Array.from(r.values()).flat().some(u=>u.id===s.id));return a.length>0&&(o+=`Elements outside of groups:
`,a.forEach(s=>{o+=i(s)})),o+=`
When describing this canvas, please:
`,o+=`- Use the actual titles/names of elements instead of their IDs
`,o+=`- Pay attention to the content and relationships between elements
`,o+=`- Describe files by their names, links by their URLs, and text nodes by their content
`,o}};Vde=new WeakSet,bHt=function(e,r){let n=e.filter(o=>o.type==="group");for(let o of n)for(let i of e){if(i.id===o.id)continue;let a=i.x+i.width/2,s=i.y+i.height/2;a>=o.x&&s>=o.y&&a<=o.x+o.width&&s<=o.y+o.height&&r.push({id:crypto.randomUUID(),fromNode:o.id,toNode:i.id,label:"contains"})}}});var vHt,Mze,Wde,Rze,w4,_G,vR,Kde=b(()=>{hHt();yG();$t();bG();vHt=require("obsidian");_Ht();Mze=class{constructor(){this.supportedExtensions=["md"]}async parseFile(e,r){return await r.read(e)}},Wde=class{constructor(e){this.supportedExtensions=["pdf"];this.brevilabsClient=e,this.pdfCache=qde.getInstance()}async parseFile(e,r){try{B("Parsing PDF file:",e.path);let n=await this.pdfCache.get(e);if(n)return B("Using cached PDF content for:",e.path),n.response;let o=await r.readBinary(e);B("Calling pdf4llm API for:",e.path);let i=await this.brevilabsClient.pdf4llm(o);return await this.pdfCache.set(e,i),i.response}catch(n){return ie(`Error extracting content from PDF ${e.path}:`,n),`[Error: Could not extract content from PDF ${e.basename}]`}}async clearCache(){B("Clearing PDF cache"),await this.pdfCache.clear()}},Rze=class{constructor(){this.supportedExtensions=["canvas"]}async parseFile(e,r){try{B("Parsing Canvas file:",e.path);let n=new Hde(r),o=await n.load(e);return n.buildPrompt(o)}catch(n){return ie(`Error parsing Canvas file ${e.path}:`,n),`[Error: Could not parse Canvas file ${e.basename}]`}}},w4=class w4{constructor(e,r=null){this.supportedExtensions=["pdf","602","abw","cgm","cwk","doc","docx","docm","dot","dotm","hwp","key","lwp","mw","mcw","pages","pbd","ppt","pptm","pptx","pot","potm","potx","rtf","sda","sdd","sdp","sdw","sgl","sti","sxi","sxw","stw","sxg","txt","uof","uop","uot","vor","wpd","wps","xml","zabw","epub","jpg","jpeg","png","gif","bmp","svg","tiff","webp","web","htm","html","xlsx","xls","xlsm","xlsb","xlw","csv","dif","sylk","slk","prn","numbers","et","ods","fods","uos1","uos2","dbf","wk1","wk2","wk3","wk4","wks","123","wq1","wq2","wb1","wb2","wb3","qpw","xlr","eth","tsv","mp3","mp4","mpeg","mpga","m4a","wav","webm"];this.brevilabsClient=e,this.projectContextCache=S_.getInstance(),this.currentProject=r}static resetRateLimitNoticeTimer(){w4.lastRateLimitNoticeTime=0}async parseFile(e,r){try{if(B(`[Docs4LLMParser] Project ${this.currentProject?.name}: Parsing ${e.extension} file: ${e.path}`),!this.currentProject)throw ie("[Docs4LLMParser] No project context for parsing file: ",e.path),new Error("No project context provided for file parsing");let n=await this.projectContextCache.getOrReuseFileContext(this.currentProject,e.path);if(n)return B(`[Docs4LLMParser] Project ${this.currentProject.name}: Using cached content for: ${e.path}`),n;B(`[Docs4LLMParser] Project ${this.currentProject.name}: Cache miss for: ${e.path}. Proceeding to API call.`);let o=await r.readBinary(e);B(`[Docs4LLMParser] Project ${this.currentProject.name}: Calling docs4llm API for: ${e.path}`);let i=await this.brevilabsClient.docs4llm(o,e.extension);if(!i||!i.response)throw new Error("Empty response from docs4llm API");let a="";if(typeof i.response=="string")a=i.response;else if(Array.isArray(i.response)){let s=[];for(let u of i.response)u.content&&(u.content.md?s.push(u.content.md):u.content.text&&s.push(u.content.text));a=s.join(`
`)}else typeof i.response=="object"?i.response.md?a=i.response.md:i.response.text?a=i.response.text:i.response.content?a=i.response.content:a=JSON.stringify(i.response,null,2):a=String(i.response);return await this.projectContextCache.setFileContext(this.currentProject,e.path,a),B(`[Docs4LLMParser] Project ${this.currentProject.name}: Successfully processed and cached: ${e.path}`),a}catch(n){throw ie(`[Docs4LLMParser] Project ${this.currentProject?.name}: Error processing file ${e.path}:`,n),GP(n)&&this.showRateLimitNotice(n),n}}showRateLimitNotice(e){let r=Date.now();if(r-w4.lastRateLimitNoticeTime<6e4)return;w4.lastRateLimitNoticeTime=r;let n=gHt(e);new vHt.Notice(`\u26A0\uFE0F Rate limit exceeded for document processing. Please try again in ${n}. Having fewer non-markdown files in the project will help.`,1e4)}async clearCache(){B("Cache clearing is now handled at the project level")}};w4.lastRateLimitNoticeTime=0;_G=w4,vR=class{constructor(e,r,n=!1,o=null){this.parsers=new Map;this.isProjectMode=n,this.currentProject=o,this.registerParser(new Mze),this.registerParser(new _G(e,o)),n||this.registerParser(new Wde(e)),this.registerParser(new Rze)}registerParser(e){for(let r of e.supportedExtensions)this.parsers.set(r,e)}async parseFile(e,r){let n=this.parsers.get(e.extension);if(!n)throw new Error(`No parser found for file type: ${e.extension}`);return await n.parseFile(e,r)}supportsExtension(e){return this.parsers.has(e)}async clearPDFCache(){let e=this.parsers.get("pdf");e instanceof Wde&&await e.clearCache()}}});var Jde={};as(Jde,{createToolCallMarker:()=>Gde,decodeResultFromMarker:()=>jze,decodeToolCallMarkerResults:()=>Ehn,ensureEncodedToolCallMarkerResults:()=>Phn,parseToolCallMarkers:()=>Dze,updateToolCallMarker:()=>Lze});function Nze(t){try{return`ENC:${encodeURIComponent(t)}`}catch{return t}}function jze(t){if(typeof t!="string"||!t.startsWith("ENC:"))return t;try{return decodeURIComponent(t.slice(4))}catch{return t}}function Ehn(t){return!t||typeof t!="string"?t:t.replace(/<!--TOOL_CALL_END:([^:]+):(ENC:[\s\S]*?)-->/g,(e,r,n)=>{let o=jze(n)||n;return`<!--TOOL_CALL_END:${r}:${o}-->`})}function Phn(t){return!t||typeof t!="string"?t:t.replace(/<!--TOOL_CALL_END:([^:]+):([\s\S]*?)-->/g,(e,r,n)=>{if(n.startsWith("ENC:"))return e;let o=Nze(n);return`<!--TOOL_CALL_END:${r}:${o}-->`})}function Dze(t){let e=[],r=/<!--TOOL_CALL_START:([^:]+):([^:]+):([^:]+):([^:]+):([^:]*):([^:]+)-->([\s\S]*?)<!--TOOL_CALL_END:\1:([\s\S]*?)-->/g,n=0,o;for(;(o=r.exec(t))!==null;){o.index>n&&e.push({type:"text",content:t.slice(n,o.index)});let[i,a,s,u,l,c,d,f,p]=o;e.push({type:"toolCall",content:f,toolCall:{id:a,toolName:s,displayName:u,emoji:l,confirmationMessage:c||void 0,isExecuting:d==="true",result:jze(p)||void 0,startIndex:o.index,endIndex:o.index+i.length}}),n=o.index+i.length}return n<t.length&&e.push({type:"text",content:t.slice(n)}),e.length===0&&e.push({type:"text",content:t}),{segments:e}}function Gde(t,e,r,n,o="",i=!0,a="",s=""){let u=s&&Nze(s);return`<!--TOOL_CALL_START:${t}:${e}:${r}:${n}:${o}:${i}-->${a}<!--TOOL_CALL_END:${t}:${u}-->`}function Lze(t,e,r){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(<!--TOOL_CALL_START:${n}:[^:]+:[^:]+:[^:]+:[^:]*:)true(-->[\\s\\S]*?<!--TOOL_CALL_END:${n}:)[\\s\\S]*?-->`,"g"),i=Nze(r);return t.replace(o,`$1false$2${i}-->`)}var x4=b(()=>{});var wHt,JP,wG=b(()=>{er();$t();kt();wHt=require("obsidian"),JP=class{constructor(e){this.chainManager=e}async handleResponse(e,r,n,o,i,a,s){e&&!(n.signal.aborted&&n.signal.reason==="new-chat")?(await this.chainManager.memoryManager.getMemory().saveContext({input:r.message},{output:s||e}),o({message:e,sender:Yg,isVisible:!0,timestamp:nu(new Date),sources:a}),i("")):n.signal.reason==="new-chat"&&i("");let u=this.chainManager.memoryManager.getMemory().chatHistory.messages;B(`Chat memory updated:
`,{turns:Array.isArray(u)?u.length:0});let l=2e3;try{let{parseToolCallMarkers:c}=await Promise.resolve().then(()=>(x4(),Jde)),f=c(e).segments.map(m=>m.type==="text"?m.content:"").join("").trim();f||(f=e||"");let p=f.length>l?f.slice(0,l)+"... (truncated)":f;B(`Final AI response (truncated):
`,p)}catch{let c=typeof e=="string"?e:String(e??""),d=c.length>l?c.slice(0,l)+"... (truncated)":c;B(`Final AI response (truncated):
`,d)}return e}async handleError(e,r,n){let o=Fn(e);ie("Error during LLM invocation:",o);let i=e?.response?.data?.error||o,a=i?.code||o,s="";if(e?.message?.includes("Invalid license key")?s="Invalid Copilot Plus license key. Please check your license key in settings.":a==="model_not_found"?s="You do not have access to this model or the model does not exist, please check with your API provider.":s=`${a}`,ie(i),r&&n){n("");let u=s.search("Troubleshooting URL");s=u!==-1?s.slice(0,u):s,o.search(/401|invalid|not valid/gi)!==-1&&(s=`Something went wrong. Please check if you have set your API key.
Path: Settings > copilot plugin > Basic Tab > Set Keys.
Or check model config
Error Details: `+s),r({message:s,isErrorMessage:!0,sender:Yg,isVisible:!0,timestamp:nu(new Date)})}else new wHt.Notice(s),ie(i)}}});var C_,S4=b(()=>{C_=class{constructor(e,r){this.updateCurrentAiMessage=e;this.modelAdapter=r;this.hasOpenThinkBlock=!1;this.fullResponse="";this.shouldTruncate=!1}handleClaude37Chunk(e){let r="";for(let n of e)switch(n.type){case"text":r+=n.text;break;case"thinking":return this.hasOpenThinkBlock||(this.fullResponse+=`
<think>`,this.hasOpenThinkBlock=!0),n.thinking!==void 0&&(this.fullResponse+=n.thinking),this.updateCurrentAiMessage(this.fullResponse),!0}return r&&(this.fullResponse+=r),!1}handleDeepseekChunk(e){return typeof e.content=="string"&&(this.fullResponse+=e.content),e.additional_kwargs?.reasoning_content?(this.hasOpenThinkBlock||(this.fullResponse+=`
<think>`,this.hasOpenThinkBlock=!0),e.additional_kwargs.reasoning_content!==void 0&&(this.fullResponse+=e.additional_kwargs.reasoning_content),!0):!1}processChunk(e){if(this.shouldTruncate)return;let r=!1;Array.isArray(e.content)?r=this.handleClaude37Chunk(e.content):r=this.handleDeepseekChunk(e),this.hasOpenThinkBlock&&!r&&(this.fullResponse+="</think>",this.hasOpenThinkBlock=!1),this.modelAdapter?.shouldTruncateStreaming?.(this.fullResponse)&&(this.shouldTruncate=!0,this.fullResponse=this.truncateToLastCompleteToolCall(this.fullResponse)),this.updateCurrentAiMessage(this.fullResponse)}truncateToLastCompleteToolCall(e){let r=e.lastIndexOf("</use_tool>");if(r===-1)return e;let n=e.substring(0,r+11);return this.modelAdapter?.sanitizeResponse?this.modelAdapter.sanitizeResponse(n,1):n}close(){return this.hasOpenThinkBlock&&(this.fullResponse+="</think>",this.updateCurrentAiMessage(this.fullResponse)),this.fullResponse}}});var xG,xHt=b(()=>{er();$t();_t();kt();wG();S4();xG=class extends JP{async run(e,r,n,o,i){let a=new C_(n);try{let l=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),c=iz(l),d=[],f=Rf(),p=this.chainManager.chatModelManager.getChatModel();f&&d.push({role:iI(p),content:f});for(let h of c)d.push({role:h.role,content:h.content});if(e.content&&Array.isArray(e.content)){let h=e.content.map(y=>y.type==="text"?{...y,text:e.message}:y);d.push({role:"user",content:h})}else d.push({role:"user",content:e.message});B(`Final Request to AI:
`,d);let m=await Od(()=>this.chainManager.chatModelManager.getChatModel().stream(d,{signal:r.signal}));for await(let h of m){if(r.signal.aborted){B("Stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(h)}}catch(u){u.name==="AbortError"||r.signal.aborted?B("Stream aborted by user",{reason:r.signal.reason}):await this.handleError(u,o,n)}let s=a.close();return r.signal.aborted&&r.signal.reason==="new-chat"?(n(""),""):this.handleResponse(s,e,r,o,n)}}});var C4,SHt=b(()=>{KA();Af();Ov();C4=class extends zn{constructor(e){super(e),Object.defineProperty(this,"callbacks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"verbose",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.callbacks=e?.callbacks,this.tags=e?.tags??[],this.metadata=e?.metadata??{},this.verbose=e?.verbose??!1}_getRelevantDocuments(e,r){throw new Error("Not implemented!")}async invoke(e,r){return this.getRelevantDocuments(e,Tn(r))}async getRelevantDocuments(e,r){let n=Tn(U6(r)),i=await(await _u.configure(n.callbacks,this.callbacks,n.tags,this.tags,n.metadata,this.metadata,{verbose:this.verbose}))?.handleRetrieverStart(this.toJSON(),e,n.runId,void 0,void 0,void 0,n.runName);try{let a=await this._getRelevantDocuments(e,i);return await i?.handleRetrieverEnd(a),a}catch(a){throw await i?.handleRetrieverError(a),a}}}});var Fze=b(()=>{SHt()});var Zde={};as(Zde,{HybridRetriever:()=>SG});var SG,CG=b(()=>{er();jy();fF();wR();$t();Sc();_t();kt();hG();tI();Fze();Zce();Lde();SG=class extends C4{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"];this.queryRewritePrompt=Am.fromTemplate(`Please write a passage to answer the question. If you don't know the answer, just make up a passage.
Question: {question}
Passage:`)}async getRelevantDocuments(r,n){return Od(async()=>{let o=Zg(r,app.vault),i=o.map(h=>h.basename),a=[...new Set([...this.options.salientTerms,...i])],s=await this.getExplicitChunks(o),u=r;n?.runName!=="no_hyde"&&(u=await this.rewriteQuery(r));let l=await this.getOramaChunks(u,a,this.options.textWeight),c=this.filterAndFormatChunks(l,s),d=c;if(c.length===0)return ne().debug&&console.log("No chunks found for query:",r),d;let f=c.reduce((h,y)=>{let g=y.metadata.score;return typeof g=="number"&&!isNaN(g)?Math.max(h,g):h},0),p=c.every(h=>typeof h.metadata.score!="number"||isNaN(h.metadata.score)),m=this.options.useRerankerThreshold&&(f<this.options.useRerankerThreshold||p);return m&&(d=(await Zi.getInstance().rerank(r,c.map(y=>y.pageContent.slice(0,3e3)))).response.data.map(y=>({...c[y.index],metadata:{...c[y.index].metadata,rerank_score:y.relevance_score}}))),ne().debug&&(console.log("*** HYBRID RETRIEVER DEBUG INFO: ***"),n?.runName!=="no_hyde"&&(console.log(`
Original Query: `,r),console.log("Rewritten Query: ",u)),console.log(`
Explicit Chunks: `,s),console.log("Orama Chunks: ",l),console.log("Combined Chunks: ",c),console.log("Max Orama Score: ",f),m?console.log("Reranked Chunks: ",d):console.log("No reranking applied.")),d})}async rewriteQuery(r){try{return await jee(async()=>{let n=await this.queryRewritePrompt.format({question:r}),o=await Od(()=>Wd.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke(n));return o&&"content"in o?kj(o.content):(console.warn("Unexpected rewrittenQuery format. Falling back to original query."),r)},cz)}catch(n){return console.error("Error in rewriteQuery:",n),r}}async getExplicitChunks(r){let n=[];for(let o of r){let i=await KP.getInstance().getDb(),a=await WP.getDocsByPath(i,o.path);if(a){let s=a.map(u=>new sh({pageContent:u.document.content,metadata:{...u.document.metadata,score:u.score,path:u.document.path,mtime:u.document.mtime,ctime:u.document.ctime,title:u.document.title,id:u.document.id,embeddingModel:u.document.embeddingModel,tags:u.document.tags,extension:u.document.extension,created_at:u.document.created_at,nchars:u.document.nchars}}));n.push(...s)}}return n}async getOramaChunks(r,n,o){let i;try{i=await this.convertQueryToVector(r)}catch(l){throw console.error("Error in convertQueryToVector, please ensure your embedding model is working and has an adequate context length:",l,`
Query:`,r),l}let a=await KP.getInstance().getDb(),s={similarity:this.options.minSimilarityScore,limit:this.options.maxK,includeVectors:!0};if(n.length>0){let l;o||(o=.5),l=1-o;let c=!0;for(let d of n)if(!d.startsWith("#")){c=!1;break}c&&(ne().debug&&console.log("Tag only query detected, setting textWeight to 1 and vectorWeight to 0."),o=1,l=0),s.mode="hybrid",s.term=n.join(" "),s.vector={value:i,property:"embedding"},s.hybridWeights={text:o,vector:l}}else s.mode="vector",s.vector={value:i,property:"embedding"};if(this.options.timeRange){let{startTime:l,endTime:c}=this.options.timeRange,d=this.generateDailyNoteDateRange(l,c);B("Daily note date range:",d[0],d[d.length-1]);let f=Zg(d.join(", "),app.vault),m=(await this.getExplicitChunks(f)).map(w=>({...w,metadata:{...w.metadata,includeInContext:!0}}));B("Modified time range:",l,c),s.where={mtime:{between:[l,c]}};let y=(await Zp(a,s)).hits.map(w=>new sh({pageContent:w.document.content,metadata:{...w.document.metadata,score:w.score,path:w.document.path,mtime:w.document.mtime,ctime:w.document.ctime,title:w.document.title,id:w.document.id,embeddingModel:w.document.embeddingModel,tags:w.document.tags,extension:w.document.extension,created_at:w.document.created_at,nchars:w.document.nchars}})),g=[...m,...y];return Array.from(new Set(g.map(w=>w.metadata.id))).map(w=>g.find(S=>S.metadata.id===w)).filter(w=>w!==void 0)}B(`Orama search params:
`,s);let u=await Zp(a,s);return!u||!u.hits?(console.warn("Search results or hits are undefined"),[]):u.hits.map(l=>!l||!l.document?(console.warn("Invalid hit or document in search results"),null):((typeof l.score!="number"||isNaN(l.score))&&console.warn("NaN/invalid score detected:",{score:l.score,path:l.document.path,title:l.document.title}),new sh({pageContent:l.document.content||"",metadata:{...l.document.metadata||{},score:l.score,path:l.document.path||"",mtime:l.document.mtime,ctime:l.document.ctime,title:l.document.title||"",id:l.document.id,embeddingModel:l.document.embeddingModel,tags:l.document.tags||[],extension:l.document.extension,created_at:l.document.created_at,nchars:l.document.nchars}}))).filter(l=>l!==null)}async convertQueryToVector(r){let o=await(await Ru.getInstance().getEmbeddingsAPI()).embedQuery(r);if(o.length===0)throw new Error("Query embedding returned an empty vector");return o}generateDailyNoteDateRange(r,n){let o=[],i=new Date(r),a=new Date(n),s=new Date(i);for(;s<=a;)o.push(`[[${s.toLocaleDateString("en-CA")}]]`),s.setDate(s.getDate()+1);return o}filterAndFormatChunks(r,n){let o=this.options.minSimilarityScore,i=r.filter(u=>{let l=u.metadata.score;return typeof l!="number"||isNaN(l)?!0:l>=o}),a=new Set(n.map(u=>u.pageContent)),s=[...n];for(let u of i){let l=u.pageContent;a.has(l)||(a.add(l),s.push(u))}return s.map(u=>({...u,metadata:{...u.metadata,includeInContext:!0}}))}}});var $ze,kze,xR,Yde=b(()=>{$t();er();$ze=require("obsidian");vze();kze={maxChars:Bj,overlap:0,maxBytesTotal:10*1024*1024},xR=class{constructor(e){this.app=e;this.cache=new Map;this.memoryUsage=0;this.splitter=b4.fromLanguage("markdown",{chunkSize:Bj,chunkOverlap:0,separators:[`
`,`
`,". "," ",""],keepSeparator:!1})}async getChunks(e,r={}){try{if(!Array.isArray(e))return Ft("ChunkManager: Invalid notePaths provided"),[];if(e.length===0)return[];e.length>1e3&&(Ft("ChunkManager: Too many note paths, limiting to 1000"),e=e.slice(0,1e3));let n=e.filter(a=>!(!a||typeof a!="string"||a.includes("..")||a.startsWith("/")));if(n.length===0)return Ft("ChunkManager: No valid note paths provided"),[];let o={...kze,...r},i=[];for(let a of n){let s=this.cache.get(a);if(!s&&(s=await this.generateChunksForNote(a,o),s.length>0)){let u=this.calculateChunkBytes(s);this.memoryUsage+u<=o.maxBytesTotal?(this.cache.set(a,s),this.memoryUsage+=u):Ft(`ChunkManager: Skipping cache for ${a}, would exceed memory budget`)}i.push(...s)}return B(`ChunkManager: Retrieved ${i.length} chunks from ${n.length} notes (${this.formatMemoryUsage()})`),i}catch(n){return Ft("ChunkManager: Failed to get chunks",n),[]}}async getChunkText(e){return(await this.ensureChunkExists(e))?.content||""}async ensureChunkExists(e){let[r]=e.split("#"),o=(await this.getValidatedChunks(r)).find(i=>i.id===e);return o||Ft(`ChunkManager: Chunk ${e} not found after regeneration`),o||null}async getValidatedChunks(e){let r=this.cache.get(e);if(!r&&(B(`ChunkManager: Cache miss for ${e}, regenerating...`),r=await this.regenerateChunks(e),!r||r.length===0))return Ft(`ChunkManager: Failed to regenerate chunks for ${e}`),[];let n=this.app.vault.getAbstractFileByPath(e);return n&&n instanceof $ze.TFile&&r.length>0&&n.stat.mtime>r[0].mtime&&(B(`ChunkManager: File ${e} modified, regenerating chunks`),r=await this.regenerateChunks(e),!r||r.length===0)?(Ft(`ChunkManager: Failed to regenerate chunks after modification for ${e}`),[]):r}getChunkTextSync(e){let[r]=e.split("#"),n=this.cache.get(r);return n?n.find(i=>i.id===e)?.content||"":(Ft(`ChunkManager: Chunk not in cache: ${e} (use async getChunkText for auto-regeneration)`),"")}async regenerateChunks(e){try{let r=await this.generateChunksForNote(e,kze);if(r.length>0){let n=this.calculateChunkBytes(r);if(this.memoryUsage+n<=kze.maxBytesTotal){let o=this.cache.get(e);o&&(this.memoryUsage-=this.calculateChunkBytes(o)),this.cache.set(e,r),this.memoryUsage+=n}else Ft(`ChunkManager: Cannot cache regenerated chunks for ${e}, would exceed memory budget`)}return r}catch(r){return Ft(`ChunkManager: Failed to regenerate chunks for ${e}`,r),[]}}clearCache(){this.cache.clear(),this.memoryUsage=0,B("ChunkManager: Cache cleared")}async generateChunksForNote(e,r){try{let n=this.app.vault.getAbstractFileByPath(e);if(!n||!(n instanceof $ze.TFile))return[];let o=await this.safeReadFile(n);if(!o?.trim())return[];let a=(this.app.metadataCache.getFileCache(n)?.headings||[]).slice().sort((l,c)=>l.position.start.offset-c.position.start.offset),s=[],u=0;if(a.length===0){let l=await this.processContentSection(o,"",n,u,r);return s.push(...l),s}for(let l=0;l<a.length;l++){let c=a[l],d=a[l+1],f=c.position.start.offset,p=d?.position.start.offset||o.length,m=o.substring(f,p),h=await this.processContentSection(m,c.heading,n,u,r);s.push(...h),u+=h.length}return s}catch(n){return Ft(`ChunkManager: Failed to chunk note ${e}`,n),[]}}async processContentSection(e,r,n,o,i){let a=n.basename,s=[],u=`
NOTE TITLE: [[${a}]]
NOTE BLOCK CONTENT:
`,l=u+e;if(l.length<=i.maxChars){let c=this.generateChunkId(n.path,o),d=this.calculateContentHash(l);s.push({id:c,notePath:n.path,chunkIndex:o,content:l,contentHash:d,title:a,heading:r,mtime:n.stat.mtime})}else try{(await this.splitter.createDocuments([e],[],{chunkHeader:u,appendChunkOverlapHeader:i.overlap>0})).forEach((d,f)=>{let p=o+f,m=this.generateChunkId(n.path,p),h=this.calculateContentHash(d.pageContent);s.push({id:m,notePath:n.path,chunkIndex:p,content:d.pageContent,contentHash:h,title:a,heading:r,mtime:n.stat.mtime})})}catch(c){Ft(`ChunkManager: Failed to split section in ${n.path}`,c);let d=this.generateChunkId(n.path,o),f=this.calculateContentHash(l);s.push({id:d,notePath:n.path,chunkIndex:o,content:l,contentHash:f,title:a,heading:r,mtime:n.stat.mtime})}return s}calculateChunkBytes(e){return e.reduce((r,n)=>r+Buffer.byteLength(n.content,"utf8"),0)}async safeReadFile(e){try{return(await this.app.vault.cachedRead(e))?.trim()||""}catch(r){return Ft(`ChunkManager: Failed to read ${e.path}`,r),""}}generateChunkId(e,r){return`${e}#${r}`}calculateContentHash(e){let r=e.length.toString(16),n=e.slice(0,32).replace(/\s/g,"").substring(0,8);return r+n}formatMemoryUsage(){return`${(this.memoryUsage/1024/1024).toFixed(1)}MB`}}});var Bze=x(()=>{});function Kd(t,e,r){let n=typeof r,o=typeof t;if(n!=="undefined"){if(o!=="undefined"){if(r){if(o==="function"&&n===o)return function(s){return t(r(s))};if(e=t.constructor,e===r.constructor){if(e===Array)return r.concat(t);if(e===Map){var i=new Map(r);for(var a of t)i.set(a[0],a[1]);return i}if(e===Set){a=new Set(r);for(i of t.values())a.add(i);return a}}}return t}return r}return o==="undefined"?e:t}function O4(t,e){return typeof t>"u"?e:t}function Us(){return Object.create(null)}function O_(t){return typeof t=="string"}function EG(t){return typeof t=="object"}function PG(t,e){if(O_(e))t=t[e];else for(let r=0;t&&r<e.length;r++)t=t[e[r]];return t}function A4(t={}){if(!this||this.constructor!==A4)return new A4(...arguments);if(arguments.length)for(t=0;t<arguments.length;t++)this.assign(arguments[t]);else this.assign(t)}function SF(t){t.F=null,t.B.clear(),t.D.clear()}function Kze(t,e,r){r||(e||typeof t!="object"?typeof e=="object"&&(r=e,e=0):r=t),r&&(t=r.query||t,e=r.limit||e);let n=""+(e||0);r&&(n+=(r.offset||0)+!!r.context+!!r.suggest+(r.resolve!==!1)+(r.resolution||this.resolution)+(r.boost||0)),t=(""+t).toLowerCase(),this.cache||(this.cache=new EF);let o=this.cache.get(t+n);if(!o){let i=r&&r.cache;i&&(r.cache=!1),o=this.search(t,e,r),i&&(r.cache=i),this.cache.set(t+n,o)}return o}function EF(t){this.limit=t&&t!==!0?t:1e3,this.cache=new Map,this.h=""}function AHt(t,e,r,n){let o=[];for(let i=0,a;i<t.index.length;i++)if(a=t.index[i],e>=a.length)e-=a.length;else{e=a[n?"splice":"slice"](e,r);let s=e.length;if(s&&(o=o.length?o.concat(e):e,r-=s,n&&(t.length-=s),!r))break;e=0}return o}function I4(t){if(!this||this.constructor!==I4)return new I4(t);this.index=t?[t]:[],this.length=t?t.length:0;let e=this;return new Proxy([],{get(r,n){if(n==="length")return e.length;if(n==="push")return function(o){e.index[e.index.length-1].push(o),e.length++};if(n==="pop")return function(){if(e.length)return e.length--,e.index[e.index.length-1].pop()};if(n==="indexOf")return function(o){let i=0;for(let a=0,s,u;a<e.index.length;a++){if(s=e.index[a],u=s.indexOf(o),u>=0)return i+u;i+=s.length}return-1};if(n==="includes")return function(o){for(let i=0;i<e.index.length;i++)if(e.index[i].includes(o))return!0;return!1};if(n==="slice")return function(o,i){return AHt(e,o||0,i||e.length,!1)};if(n==="splice")return function(o,i){return AHt(e,o||0,i||e.length,!0)};if(n==="constructor")return Array;if(typeof n!="symbol")return(r=e.index[n/2**31|0])&&r[n]},set(r,n,o){return r=n/2**31|0,(e.index[r]||(e.index[r]=[]))[n]=o,e.length++,!0}})}function E_(t=8){if(!this||this.constructor!==E_)return new E_(t);this.index=Us(),this.h=[],this.size=0,t>32?(this.B=kHt,this.A=BigInt(t)):(this.B=FHt,this.A=t)}function P_(t=8){if(!this||this.constructor!==P_)return new P_(t);this.index=Us(),this.h=[],this.size=0,t>32?(this.B=kHt,this.A=BigInt(t)):(this.B=FHt,this.A=t)}function FHt(t){let e=2**this.A-1;if(typeof t=="number")return t&e;let r=0,n=this.A+1;for(let o=0;o<t.length;o++)r=(r*n^t.charCodeAt(o))&e;return this.A===32?r+2**31:r}function kHt(t){let e=BigInt(2)**this.A-BigInt(1);var r=typeof t;if(r==="bigint")return t&e;if(r==="number")return BigInt(t)&e;r=BigInt(0);let n=this.A+BigInt(1);for(let o=0;o<t.length;o++)r=(r*n^BigInt(t.charCodeAt(o)))&e;return r}async function Rhn(t){t=t.data;var e=t.task;let r=t.id,n=t.args;switch(e){case"init":OG=t.options||{},(e=t.factory)?(Function("return "+e)()(self),E4=new self.FlexSearch.Index(OG),delete self.FlexSearch):E4=new T_(OG),postMessage({id:r});break;default:let o;e==="export"&&(n[1]?(n[0]=OG.export,n[2]=0,n[3]=1):n=null),e==="import"?n[0]&&(t=await OG.import.call(E4,n[0]),E4.import(n[0],t)):((o=n&&E4[e].apply(E4,n))&&o.then&&(o=await o),o&&o.await&&(o=await o.await),e==="search"&&o.result&&(o=o.result)),postMessage(e==="search"?{id:r,msg:o}:{id:r})}}function Jze(t){P4.call(t,"add"),P4.call(t,"append"),P4.call(t,"search"),P4.call(t,"update"),P4.call(t,"remove"),P4.call(t,"searchCache")}function Nhn(){qze=tfe=0}function P4(t){this[t+"Async"]=function(){let e=arguments;var r=e[e.length-1];let n;if(typeof r=="function"&&(n=r,delete e[e.length-1]),qze?tfe||(tfe=Date.now()-IHt>=this.priority*this.priority*3):(qze=setTimeout(Nhn,0),IHt=Date.now()),tfe){let i=this;return new Promise(a=>{setTimeout(function(){a(i[t+"Async"].apply(i,e))},0)})}let o=this[t].apply(this,e);return r=o.then?o:new Promise(i=>i(o)),n&&r.then(n),r}}function CF(t={},e){function r(s){function u(l){l=l.data||l;let c=l.id,d=c&&i.h[c];d&&(d(l.msg),delete i.h[c])}if(this.worker=s,this.h=Us(),this.worker)return o?this.worker.on("message",u):this.worker.onmessage=u,t.config?new Promise(function(l){SR>1e9&&(SR=0),i.h[++SR]=function(){l(i)},i.worker.postMessage({id:SR,task:"init",factory:n,options:t})}):(this.priority=t.priority||4,this.encoder=e||null,this.worker.postMessage({task:"init",factory:n,options:t}),this)}if(!this||this.constructor!==CF)return new CF(t);let n=typeof self<"u"?self._factory:typeof window<"u"?window._factory:null;n&&(n=n.toString());let o=typeof window>"u",i=this,a=jhn(n,o,t.worker);return a.then?a.then(function(s){return r.call(i,s)}):r.call(this,a)}function CR(t){CF.prototype[t]=function(){let e=this,r=[].slice.call(arguments);var n=r[r.length-1];let o;return typeof n=="function"&&(o=n,r.pop()),n=new Promise(function(i){t==="export"&&typeof r[0]=="function"&&(r[0]=null),SR>1e9&&(SR=0),e.h[++SR]=i,e.worker.postMessage({task:t,id:SR,args:r})}),o?(n.then(o),this):n}}function jhn(t,e,r){return e?typeof module<"u"?new(Bze()).Worker(__dirname+"/worker/node.js"):Promise.resolve().then(()=>j(Bze())).then(function(n){return new n.Worker(LHt.dirname+"/node/node.mjs")}):t?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+Rhn.toString()],{type:"text/javascript"}))):new window.Worker(typeof r=="string"?r:LHt.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js"),{type:"module"})}function Hze(t,e,r,n,o,i){if(t=t[o],n===r.length-1)e[o]=i||t;else if(t)if(t.constructor===Array)for(e=e[o]=Array(t.length),o=0;o<t.length;o++)Hze(t,e,r,n,o);else e=e[o]||(e[o]=Us()),o=r[++n],Hze(t,e,r,n,o)}function Vze(t,e,r,n,o,i,a,s){if(t=t[a])if(n===e.length-1){if(t.constructor===Array){if(r[n]){for(e=0;e<t.length;e++)o.add(i,t[e],!0,!0);return}t=t.join(" ")}o.add(i,t,s,!0)}else if(t.constructor===Array)for(a=0;a<t.length;a++)Vze(t,e,r,n,o,i,a,s);else a=e[++n],Vze(t,e,r,n,o,i,a,s)}function Zze(t,e,r,n){if(!t.length)return t;if(t.length===1)return t=t[0],t=r||t.length>e?t.slice(r,r+e):t,n?T4.call(this,t):t;let o=[];for(let i=0,a,s;i<t.length;i++)if((a=t[i])&&(s=a.length)){if(r){if(r>=s){r-=s;continue}a=a.slice(r,r+e),s=a.length,r=0}if(s>e&&(a=a.slice(0,e),s=e),!o.length&&s>=e)return n?T4.call(this,a):a;if(o.push(a),e-=s,!e)break}return o=o.length>1?[].concat.apply([],o):o[0],n?T4.call(this,o):o}function ufe(t,e,r,n){var o=n[0];if(o[0]&&o[0].query)return t[e].apply(t,o);if(!(e!=="and"&&e!=="not"||t.result.length||t.await||o.suggest))return n.length>1&&(o=n[n.length-1]),(n=o.resolve)?t.await||t.result:t;let i=[],a=0,s=0,u,l,c,d,f;for(e=0;e<n.length;e++)if(o=n[e]){var p=void 0;if(o.constructor===pa)p=o.await||o.result;else if(o.then||o.constructor===Array)p=o;else{a=o.limit||0,s=o.offset||0,c=o.suggest,l=o.resolve,u=((d=o.highlight||t.highlight)||o.enrich)&&l,p=o.queue;let m=o.async||p,h=o.index,y=o.query;if(h?t.index||(t.index=h):h=t.index,y||o.tag){let g=o.field||o.pluck;if(g&&(!y||t.query&&!d||(t.query=y,t.field=g,t.highlight=d),h=h.index.get(g)),p&&(f||t.await)){f=1;let _,w=t.C.length,S=new Promise(function(C){_=C});(function(C,E){S.h=function(){E.index=null,E.resolve=!1;let P=m?C.searchAsync(E):C.search(E);return P.then?P.then(function(T){return t.C[w]=T=T.result||T,_(T),T}):(P=P.result||P,_(P),P)}})(h,Object.assign({},o)),t.C.push(S),i[e]=S;continue}else o.resolve=!1,o.index=null,p=m?h.searchAsync(o):h.search(o),o.resolve=l,o.index=h}else if(o.and)p=Qde(o,"and",h);else if(o.or)p=Qde(o,"or",h);else if(o.not)p=Qde(o,"not",h);else if(o.xor)p=Qde(o,"xor",h);else continue}p.await?(f=1,p=p.await):p.then?(f=1,p=p.then(function(m){return m.result||m})):p=p.result||p,i[e]=p}if(f&&!t.await&&(t.await=new Promise(function(m){t.return=m})),f){let m=Promise.all(i).then(function(h){for(let y=0;y<t.C.length;y++)if(t.C[y]===m){t.C[y]=function(){return r.call(t,h,a,s,u,l,c,d)};break}Yze(t)});t.C.push(m)}else if(t.await)t.C.push(function(){return r.call(t,i,a,s,u,l,c,d)});else return r.call(t,i,a,s,u,l,c,d);return l?t.await||t.result:t}function Qde(t,e,r){t=t[e];let n=t[0]||t;return n.index||(n.index=r),r=new pa(n),t.length>1&&(r=r[e].apply(r,t.slice(1))),r}function Dhn(t,e,r,n,o,i,a){return t.length&&(this.result.length&&t.push(this.result),t.length<2?this.result=t[0]:(this.result=$Ht(t,e,r,!1,this.h),r=0)),o&&(this.await=null),o?this.resolve(e,r,n,a):this}function Lhn(t,e,r,n,o,i,a){if(!i&&!this.result.length)return o?this.result:this;let s;if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{let u=0;for(let l=0,c,d;l<t.length;l++)if((c=t[l])&&(d=c.length))u<d&&(u=d);else if(!i){u=0;break}u?(this.result=nfe(t,u,e,r,i,this.h,o),s=!0):this.result=[]}else i||(this.result=t);return o&&(this.await=null),o?this.resolve(e,r,n,a,s):this}function Fhn(t,e,r,n,o,i,a){if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{e:{i=r;var s=this.h;let u=[],l=Us(),c=0;for(let d=0,f;d<t.length;d++)if(f=t[d]){c<f.length&&(c=f.length);for(let p=0,m;p<f.length;p++)if(m=f[p])for(let h=0,y;h<m.length;h++)y=m[h],l[y]=l[y]?2:1}for(let d=0,f,p=0;d<c;d++)for(let m=0,h;m<t.length;m++)if((h=t[m])&&(f=h[d])){for(let y=0,g;y<f.length;y++)if(g=f[y],l[g]===1)if(i)i--;else if(o){if(u.push(g),u.length===e){t=u;break e}}else{let _=d+(m?s:0);if(u[_]||(u[_]=[]),u[_].push(g),++p===e){t=u;break e}}}t=u}this.result=t,s=!0}else i||(this.result=t);return o&&(this.await=null),o?this.resolve(e,r,n,a,s):this}function khn(t,e,r,n,o,i,a){if(!i&&!this.result.length)return o?this.result:this;if(t.length&&this.result.length){e:{i=r;var s=[];t=new Set(t.flat().flat());for(let u=0,l,c=0;u<this.result.length;u++)if(l=this.result[u]){for(let d=0,f;d<l.length;d++)if(f=l[d],!t.has(f)){if(i)i--;else if(o){if(s.push(f),s.length===e){t=s;break e}}else if(s[u]||(s[u]=[]),s[u].push(f),++c===e){t=s;break e}}}t=s}this.result=t,s=!0}return o&&(this.await=null),o?this.resolve(e,r,n,a,s):this}function rfe(t,e,r,n,o){let i,a,s;typeof o=="string"?(i=o,o=""):i=o.template,a=i.indexOf("$1"),s=i.substring(a+2),a=i.substring(0,a);let u=o&&o.boundary,l=!o||o.clip!==!1,c=o&&o.merge&&s&&a&&new RegExp(s+" "+a,"g");o=o&&o.ellipsis;var d=0;if(typeof o=="object"){var f=o.template;d=f.length-2,o=o.pattern}typeof o!="string"&&(o=o===!1?"":"..."),d&&(o=f.replace("$1",o)),f=o.length-d;let p,m;typeof u=="object"&&(p=u.before,p===0&&(p=-1),m=u.after,m===0&&(m=-1),u=u.total||9e5),d=new Map;for(let G=0,X,F,Q;G<e.length;G++){let ee;if(n)ee=e,Q=n;else{var h=e[G];if(Q=h.field,!Q)continue;ee=h.result}F=r.get(Q),X=F.encoder,h=d.get(X),typeof h!="string"&&(h=X.encode(t),d.set(X,h));for(let U=0;U<ee.length;U++){var y=ee[U].doc;if(!y||(y=PG(y,Q),!y))continue;var g=y.trim().split(/\s+/);if(!g.length)continue;y="";var _=[];let z=[];for(var w=-1,S=-1,C=0,E=0;E<g.length;E++){var P=g[E],T=X.encode(P);T=T.length>1?T.join(" "):T[0];let V;if(T&&P){for(var I=P.length,N=(X.split?P.replace(X.split,""):P).length-T.length,M="",D=0,k=0;k<h.length;k++){var L=h[k];if(L){var H=L.length;H+=N,D&&H<=D||(L=T.indexOf(L),L>-1&&(M=(L?P.substring(0,L):"")+a+P.substring(L,L+H)+s+(L+H<I?P.substring(L+H):""),D=H,V=!0))}}M&&(u&&(w<0&&(w=y.length+(y?1:0)),S=y.length+(y?1:0)+M.length,C+=I,z.push(_.length),_.push({match:M})),y+=(y?" ":"")+M)}if(!V)P=g[E],y+=(y?" ":"")+P,u&&_.push({text:P});else if(u&&C>=u)break}if(C=z.length*(i.length-2),p||m||u&&y.length-C>u)if(C=u+C-f*2,E=S-w,p>0&&(E+=p),m>0&&(E+=m),E<=C)g=p?w-(p>0?p:0):w-((C-E)/2|0),_=m?S+(m>0?m:0):g+C,l||(g>0&&y.charAt(g)!==" "&&y.charAt(g-1)!==" "&&(g=y.indexOf(" ",g),g<0&&(g=0)),_<y.length&&y.charAt(_-1)!==" "&&y.charAt(_)!==" "&&(_=y.lastIndexOf(" ",_),_<S?_=S:++_)),y=(g?o:"")+y.substring(g,_)+(_<y.length?o:"");else{for(S=[],w={},C={},E={},P={},T={},M=N=I=0,k=D=1;;){var K=void 0;for(let V=0,q;V<z.length;V++){if(q=z[V],M)if(N!==M){if(E[V+1])continue;if(q+=M,w[q]){I-=f,C[V+1]=1,E[V+1]=1;continue}if(q>=_.length-1){if(q>=_.length){E[V+1]=1,q>=g.length&&(C[V+1]=1);continue}I-=f}if(y=_[q].text,H=m&&T[V])if(H>0){if(y.length>H)if(E[V+1]=1,l)y=y.substring(0,H);else continue;(H-=y.length)||(H=-1),T[V]=H}else{E[V+1]=1;continue}if(I+y.length+1<=u)y=" "+y,S[V]+=y;else if(l)K=u-I-1,K>0&&(y=" "+y.substring(0,K),S[V]+=y),E[V+1]=1;else{E[V+1]=1;continue}}else{if(E[V])continue;if(q-=N,w[q]){I-=f,E[V]=1,C[V]=1;continue}if(q<=0){if(q<0){E[V]=1,C[V]=1;continue}I-=f}if(y=_[q].text,H=p&&P[V])if(H>0){if(y.length>H)if(E[V]=1,l)y=y.substring(y.length-H);else continue;(H-=y.length)||(H=-1),P[V]=H}else{E[V]=1;continue}if(I+y.length+1<=u)y+=" ",S[V]=y+S[V];else if(l)K=y.length+1-(u-I),K>=0&&K<y.length&&(y=y.substring(K)+" ",S[V]=y+S[V]),E[V]=1;else{E[V]=1;continue}}else{y=_[q].match,p&&(P[V]=p),m&&(T[V]=m),V&&I++;let W;if(q?!V&&f&&(I+=f):(C[V]=1,E[V]=1),q>=g.length-1||q<_.length-1&&_[q+1].match?W=1:f&&(I+=f),I-=i.length-2,!V||I+y.length<=u)S[V]=y;else{K=D=k=C[V]=0;break}W&&(C[V+1]=1,E[V+1]=1)}I+=y.length,K=w[q]=1}if(K)N===M?M++:N++;else{if(N===M?D=0:k=0,!D&&!k)break;D?(N++,M=N):M++}}y="";for(let V=0,q;V<S.length;V++)q=(V&&C[V]?" ":(V&&!o?" ":"")+o)+S[V],y+=q;o&&!C[S.length]&&(y+=o)}c&&(y=y.replace(c," ")),ee[U].highlight=y}if(n)break}return e}function pa(t,e){if(!this||this.constructor!==pa)return new pa(t,e);let r=0,n,o,i,a,s,u;if(t&&t.index){let l=t;if(e=l.index,r=l.boost||0,o=l.query){i=l.field||l.pluck,a=l.highlight;let c=l.resolve;t=l.async||l.queue,l.resolve=!1,l.index=null,t=t?e.searchAsync(l):e.search(l),l.resolve=c,l.index=e,t=t.result||t}else t=[]}if(t&&t.then){let l=this;t=t.then(function(c){l.C[0]=l.result=c.result||c,Yze(l)}),n=[t],t=[],s=new Promise(function(c){u=c})}this.index=e||null,this.result=t||[],this.h=r,this.C=n||[],this.await=s||null,this.return=u||null,this.highlight=a||null,this.query=o||"",this.field=i||""}function Yze(t,e){let r=t.result;var n=t.await;t.await=null;for(let o=0,i;o<t.C.length;o++)if(i=t.C[o]){if(typeof i=="function")r=i(),t.C[o]=r=r.result||r,o--;else if(i.h)r=i.h(),t.C[o]=r=r.result||r,o--;else if(i.then)return t.await=n}return n=t.return,t.C=[],t.return=null,e||n(r),r}function nfe(t,e,r,n,o,i,a){let s=t.length,u=[],l,c;l=Us();for(let d=0,f,p,m,h;d<e;d++)for(let y=0;y<s;y++)if(m=t[y],d<m.length&&(f=m[d]))for(let g=0;g<f.length;g++){if(p=f[g],(c=l[p])?l[p]++:(c=0,l[p]=1),h=u[c]||(u[c]=[]),!a){let _=d+(y||!o?0:i||0);h=h[_]||(h[_]=[])}if(h.push(p),a&&r&&c===s-1&&h.length-n===r)return n?h.slice(n):h}if(t=u.length)if(o)u=u.length>1?$Ht(u,r,n,a,i):(u=u[0])&&r&&u.length>r||n?u.slice(n,r+n):u;else{if(t<s)return[];if(u=u[t-1],r||n)if(a)(u.length>r||n)&&(u=u.slice(n,r+n));else{o=[];for(let d=0,f;d<u.length;d++)if(f=u[d]){if(n&&f.length>n)n-=f.length;else if((r&&f.length>r||n)&&(f=f.slice(n,r+n),r-=f.length,n&&(n-=f.length)),o.push(f),!r)break}u=o}}return u}function $Ht(t,e,r,n,o){let i=[],a=Us(),s;var u=t.length;let l;if(n){for(o=u-1;o>=0;o--)if(l=(n=t[o])&&n.length){for(u=0;u<l;u++)if(s=n[u],!a[s]){if(a[s]=1,r)r--;else if(i.push(s),i.length===e)return i}}}else for(let c=u-1,d,f=0;c>=0;c--){d=t[c];for(let p=0;p<d.length;p++)if(l=(n=d[p])&&n.length){for(let m=0;m<l;m++)if(s=n[m],!a[s])if(a[s]=1,r)r--;else{let h=(p+(c<u-1&&o||0))/(c+1)|0;if((i[h]||(i[h]=[])).push(s),++f===e)return i}}}return i}function $hn(t,e,r){let n=Us(),o=[];for(let i=0,a;i<e.length;i++){a=e[i];for(let s=0;s<a.length;s++)n[a[s]]=1}if(r)for(let i=0,a;i<t.length;i++)a=t[i],n[a]&&(o.push(a),n[a]=0);else for(let i=0,a,s;i<t.result.length;i++)for(a=t.result[i],e=0;e<a.length;e++)s=a[e],n[s]&&((o[i]||(o[i]=[])).push(s),n[s]=0);return o}function MHt(t){let e=[],r=Us(),n=Us();for(let o=0,i,a,s,u,l,c,d;o<t.length;o++){i=t[o],a=i.field,s=i.result;for(let f=0;f<s.length;f++)l=s[f],typeof l!="object"?l={id:u=l}:u=l.id,(c=r[u])?c.push(a):(l.field=r[u]=[a],e.push(l)),(d=l.highlight)&&(c=n[u],c||(n[u]=c={},l.highlight=c),c[a]=d)}return e}function Bhn(t,e,r,n,o){return t=this.tag.get(t),t?(t=t.get(e),t?(e=t.length-n,e>0&&((r&&e>r||n)&&(t=t.slice(n,n+r)),o&&(t=T4.call(this,t))),t):[]):[]}function T4(t){if(!this||!this.store)return t;if(this.db)return this.index.get(this.field[0]).db.enrich(t);let e=Array(t.length);for(let r=0,n;r<t.length;r++)n=t[r],e[r]={id:n,doc:this.store.get(n)};return e}function OF(t){if(!this||this.constructor!==OF)return new OF(t);let e=t.document||t.doc||t,r,n;if(this.B=[],this.field=[],this.D=[],this.key=(r=e.key||e.id)&&ofe(r,this.D)||"id",(n=t.keystore||0)&&(this.keystore=n),this.fastupdate=!!t.fastupdate,this.reg=!this.fastupdate||t.worker||t.db?n?new P_(n):new Set:n?new E_(n):new Map,this.h=(r=e.store||null)&&r&&r!==!0&&[],this.store=r?n?new E_(n):new Map:null,this.cache=(r=t.cache||null)&&new EF(r),t.cache=!1,this.worker=t.worker||!1,this.priority=t.priority||4,this.index=zhn.call(this,t,e),this.tag=null,(r=e.tag)&&(typeof r=="string"&&(r=[r]),r.length)){this.tag=new Map,this.A=[],this.F=[];for(let o=0,i,a;o<r.length;o++){if(i=r[o],a=i.field||i,!a)throw Error("The tag field from the document descriptor is undefined.");i.custom?this.A[o]=i.custom:(this.A[o]=ofe(a,this.D),i.filter&&(typeof this.A[o]=="string"&&(this.A[o]=new String(this.A[o])),this.A[o].G=i.filter)),this.F[o]=a,this.tag.set(a,new Map)}}if(this.worker){this.fastupdate=!1,t=[];for(let o of this.index.values())o.then&&t.push(o);if(t.length){let o=this;return Promise.all(t).then(function(i){let a=0;for(let s of o.index.entries()){let u=s[0],l=s[1];l.then&&(l=i[a],o.index.set(u,l),a++)}return o})}}else t.db&&(this.fastupdate=!1,this.mount(t.db))}function zhn(t,e){let r=new Map,n=e.index||e.field||e;O_(n)&&(n=[n]);for(let i=0,a,s;i<n.length;i++){if(a=n[i],O_(a)||(s=a,a=a.field),s=EG(s)?Object.assign({},t,s):t,this.worker){var o=void 0;o=(o=s.encoder)&&o.encode?o:new A4(typeof o=="string"?Gze[o]:o||{}),o=new CF(s,o),r.set(a,o)}this.worker||r.set(a,new T_(s,this.reg)),s.custom?this.B[i]=s.custom:(this.B[i]=ofe(a,this.D),s.filter&&(typeof this.B[i]=="string"&&(this.B[i]=new String(this.B[i])),this.B[i].G=s.filter)),this.field[i]=a}if(this.h){t=e.store,O_(t)&&(t=[t]);for(let i=0,a,s;i<t.length;i++)a=t[i],s=a.field||a,a.custom?(this.h[i]=a.custom,a.custom.O=s):(this.h[i]=ofe(s,this.D),a.filter&&(typeof this.h[i]=="string"&&(this.h[i]=new String(this.h[i])),this.h[i].G=a.filter))}return r}function ofe(t,e){let r=t.split(":"),n=0;for(let o=0;o<r.length;o++)t=r[o],t[t.length-1]==="]"&&(t=t.substring(0,t.length-2))&&(e[n]=!0),t&&(r[n++]=t);return n<r.length&&(r.length=n),n>1?r:r[0]}function Xze(t,e=0){let r=[],n=[];e&&(e=25e4/e*5e3|0);for(let o of t.entries())n.push(o),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function Qze(t,e){e||(e=new Map);for(let r=0,n;r<t.length;r++)n=t[r],e.set(n[0],n[1]);return e}function BHt(t,e=0){let r=[],n=[];e&&(e=25e4/e*1e3|0);for(let o of t.entries())n.push([o[0],Xze(o[1])[0]]),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function zHt(t,e){e||(e=new Map);for(let r=0,n,o;r<t.length;r++)n=t[r],o=e.get(n[0]),e.set(n[0],Qze(n[1],o));return e}function UHt(t){let e=[],r=[];for(let n of t.keys())r.push(n),r.length===25e4&&(e.push(r),r=[]);return r.length&&e.push(r),e}function qHt(t,e){e||(e=new Set);for(let r=0;r<t.length;r++)e.add(t[r]);return e}function ife(t,e,r,n,o,i,a=0){let s=n&&n.constructor===Array;var u=s?n.shift():n;if(!u)return this.export(t,e,o,i+1);if((u=t((e?e+".":"")+(a+1)+"."+r,JSON.stringify(u)))&&u.then){let l=this;return u.then(function(){return ife.call(l,t,e,r,s?n:null,o,i,a+1)})}return ife.call(this,t,e,r,s?n:null,o,i,a+1)}function Uhn(t,e,r=0,n=0){if(r<this.field.length){let a=this.field[r];if((e=this.index.get(a).export(t,a,r,n=1))&&e.then){let s=this;return e.then(function(){return s.export(t,a,r+1)})}return this.export(t,a,r+1)}let o,i;switch(n){case 0:o="reg",i=UHt(this.reg),e=null;break;case 1:o="tag",i=this.tag&&BHt(this.tag,this.reg.size),e=null;break;case 2:o="doc",i=this.store&&Xze(this.store),e=null;break;default:return}return ife.call(this,t,e,o,i||null,r,n)}function qhn(t,e){var r=t.split(".");r[r.length-1]==="json"&&r.pop();let n=r.length>2?r[0]:"";if(r=r.length>2?r[2]:r[1],this.worker&&n)return this.index.get(n).import(t);if(e){if(typeof e=="string"&&(e=JSON.parse(e)),n)return this.index.get(n).import(r,e);switch(r){case"reg":this.fastupdate=!1,this.reg=qHt(e,this.reg);for(let o=0,i;o<this.field.length;o++)i=this.index.get(this.field[o]),i.fastupdate=!1,i.reg=this.reg;if(this.worker){e=[];for(let o of this.index.values())e.push(o.import(t));return Promise.all(e)}break;case"tag":this.tag=zHt(e,this.tag);break;case"doc":this.store=Qze(e,this.store)}}}function RHt(t,e){let r="";for(let n of t.entries()){t=n[0];let o=n[1],i="";for(let a=0,s;a<o.length;a++){s=o[a]||[""];let u="";for(let l=0;l<s.length;l++)u+=(u?",":"")+(e==="string"?'"'+s[l]+'"':s[l]);u="["+u+"]",i+=(i?",":"")+u}i='["'+t+'",['+i+"]]",r+=(r?",":"")+i}return r}function TG(t,e){let r=0;var n=typeof e>"u";if(t.constructor===Array){for(let o=0,i,a,s;o<t.length;o++)if((i=t[o])&&i.length){if(n)return 1;if(a=i.indexOf(e),a>=0){if(i.length>1)return i.splice(a,1),1;if(delete t[o],r)return 1;s=1}else{if(s)return 1;r++}}}else for(let o of t.entries())n=o[0],TG(o[1],e)?r++:t.delete(n);return r}function ZP(t,e,r,n,o,i,a){let s,u;if(!(s=e[r])||a&&!s[a]){if(a?(e=s||(e[r]=Us()),e[a]=1,u=t.ctx,(s=u.get(a))?u=s:u.set(a,u=t.keystore?new E_(t.keystore):new Map)):(u=t.map,e[r]=1),(s=u.get(r))?u=s:u.set(r,u=s=[]),i){for(let l=0,c;l<s.length;l++)if((c=s[l])&&c.includes(o)){if(l<=n)return;c.splice(c.indexOf(o),1),t.fastupdate&&(e=t.reg.get(o))&&e.splice(e.indexOf(c),1);break}}if(u=u[n]||(u[n]=[]),u.push(o),u.length===2**31-1){if(e=new I4(u),t.fastupdate)for(let l of t.reg.values())l.includes(u)&&(l[l.indexOf(u)]=e);s[n]=u=e}t.fastupdate&&((n=t.reg.get(o))?n.push(u):t.reg.set(o,[u]))}}function efe(t,e,r,n,o){return r&&t>1?e+(n||0)<=t?r+(o||0):(t-1)/(e+(n||0))*(r+(o||0))+1|0:0}function NHt(t,e,r,n,o,i,a){let s=t.length,u=t;if(s>1)u=nfe(t,e,r,n,o,i,a);else if(s===1)return a?Zze.call(null,t[0],r,n):new pa(t[0],this);return a?u:new pa(u,this)}function jHt(t,e,r,n,o,i,a){return t=Wze(this,t,e,r,n,o,i,a),this.db?t.then(function(s){return o?s||[]:new pa(s,this)}):t&&t.length?o?Zze.call(this,t,r,n):new pa(t,this):o?[]:new pa([],this)}function DHt(t,e,r,n){let o=[];if(t&&t.length){if(t.length<=n){e.push(t);return}for(let i=0,a;i<n;i++)(a=t[i])&&(o[i]=a);if(o.length){e.push(o);return}}if(!r)return o}function Wze(t,e,r,n,o,i,a,s){let u;return r&&(u=t.bidirectional&&e>r)&&(u=r,r=e,e=u),t.db?t.db.get(e,r,n,o,i,a,s):(t=r?(t=t.ctx.get(r))&&t.get(e):t.map.get(e),t)}function T_(t,e){if(!this||this.constructor!==T_)return new T_(t);if(t){var r=O_(t)?t:t.preset;r&&(t=Object.assign({},Hhn[r],t))}else t={};r=t.context;let n=r===!0?{depth:1}:r||{},o=O_(t.encoder)?Gze[t.encoder]:t.encode||t.encoder||{};this.encoder=o.encode?o:typeof o=="object"?new A4(o):{encode:o},this.resolution=t.resolution||9,this.tokenize=r=(r=t.tokenize)&&r!=="default"&&r!=="exact"&&r||"strict",this.depth=r==="strict"&&n.depth||0,this.bidirectional=n.bidirectional!==!1,this.fastupdate=!!t.fastupdate,this.score=t.score||null,(r=t.keystore||0)&&(this.keystore=r),this.map=r?new E_(r):new Map,this.ctx=r?new E_(r):new Map,this.reg=e||(this.fastupdate?r?new E_(r):new Map:r?new P_(r):new Set),this.N=n.resolution||3,this.rtl=o.rtl||t.rtl||!1,this.cache=(r=t.cache||null)&&new EF(r),this.resolve=t.resolve!==!1,(r=t.db)&&(this.db=this.mount(r)),this.M=t.commit!==!1,this.commit_task=[],this.commit_timer=null,this.priority=t.priority||4}function HHt(t){t.commit_timer||(t.commit_timer=setTimeout(function(){t.commit_timer=null,t.db.commit(t)},1))}function sfe(t,e={}){if(!this||this.constructor!==sfe)return new sfe(t,e);typeof t=="object"&&(e=t,t=t.name),t||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(t?":"+t.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=e.field?e.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=e.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}function Uze(t,e,r){let n=t.value,o,i=0;for(let a=0,s;a<n.length;a++){if(s=r?n:n[a]){for(let u=0,l,c;u<e.length;u++)if(c=e[u],l=s.indexOf(c),l>=0)if(o=1,s.length>1)s.splice(l,1);else{n[a]=[];break}i+=s.length}if(r)break}i?o&&t.update(n):t.delete(),t.continue()}function OR(t,e){return new Promise((r,n)=>{t.onsuccess=t.oncomplete=function(){e&&e(this.result),e=null,r(this.result)},t.onerror=t.onblocked=n,t=null})}var LHt,Lt,Thn,Ahn,Ihn,Mhn,CHt,OHt,Xde,zze,EHt,PHt,THt,Gze,E4,OG,qze,IHt,tfe,SR,Hhn,VHt,afe,xF,WHt,KHt=b(()=>{LHt={};Thn=/[^\p{L}\p{N}]+/u,Ahn=/(\d{3})/g,Ihn=/(\D)(\d{3})/g,Mhn=/(\d{3})(\D)/g,CHt=/[\u0300-\u036f]/g;Lt=A4.prototype;Lt.assign=function(t){this.normalize=Kd(t.normalize,!0,this.normalize);let e=t.include,r=e||t.exclude||t.split,n;if(r||r===""){if(typeof r=="object"&&r.constructor!==RegExp){let o="";n=!e,e||(o+="\\p{Z}"),r.letter&&(o+="\\p{L}"),r.number&&(o+="\\p{N}",n=!!e),r.symbol&&(o+="\\p{S}"),r.punctuation&&(o+="\\p{P}"),r.control&&(o+="\\p{C}"),(r=r.char)&&(o+=typeof r=="object"?r.join(""):r);try{this.split=new RegExp("["+(e?"^":"")+o+"]+","u")}catch{this.split=/\s+/}}else this.split=r,n=r===!1||"a1a".split(r).length<2;this.numeric=Kd(t.numeric,n)}else{try{this.split=Kd(this.split,Thn)}catch{this.split=/\s+/}this.numeric=Kd(t.numeric,Kd(this.numeric,!0))}if(this.prepare=Kd(t.prepare,null,this.prepare),this.finalize=Kd(t.finalize,null,this.finalize),r=t.filter,this.filter=typeof r=="function"?r:Kd(r&&new Set(r),null,this.filter),this.dedupe=Kd(t.dedupe,!0,this.dedupe),this.matcher=Kd((r=t.matcher)&&new Map(r),null,this.matcher),this.mapper=Kd((r=t.mapper)&&new Map(r),null,this.mapper),this.stemmer=Kd((r=t.stemmer)&&new Map(r),null,this.stemmer),this.replacer=Kd(t.replacer,null,this.replacer),this.minlength=Kd(t.minlength,1,this.minlength),this.maxlength=Kd(t.maxlength,1024,this.maxlength),this.rtl=Kd(t.rtl,!1,this.rtl),(this.cache=r=Kd(t.cache,!0,this.cache))&&(this.F=null,this.L=typeof r=="number"?r:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(let o of this.matcher.keys())this.h+=(this.h?"|":"")+o;if(this.stemmer)for(let o of this.stemmer.keys())this.A+=(this.A?"|":"")+o;return this};Lt.addStemmer=function(t,e){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(t,e),this.A+=(this.A?"|":"")+t,this.K=null,this.cache&&SF(this),this};Lt.addFilter=function(t){return typeof t=="function"?this.filter=t:(this.filter||(this.filter=new Set),this.filter.add(t)),this.cache&&SF(this),this};Lt.addMapper=function(t,e){return typeof t=="object"?this.addReplacer(t,e):t.length>1?this.addMatcher(t,e):(this.mapper||(this.mapper=new Map),this.mapper.set(t,e),this.cache&&SF(this),this)};Lt.addMatcher=function(t,e){return typeof t=="object"?this.addReplacer(t,e):t.length<2&&(this.dedupe||this.mapper)?this.addMapper(t,e):(this.matcher||(this.matcher=new Map),this.matcher.set(t,e),this.h+=(this.h?"|":"")+t,this.J=null,this.cache&&SF(this),this)};Lt.addReplacer=function(t,e){return typeof t=="string"?this.addMatcher(t,e):(this.replacer||(this.replacer=[]),this.replacer.push(t,e),this.cache&&SF(this),this)};Lt.encode=function(t,e){if(this.cache&&t.length<=this.H)if(this.F){if(this.B.has(t))return this.B.get(t)}else this.F=setTimeout(SF,50,this);this.normalize&&(typeof this.normalize=="function"?t=this.normalize(t):t=CHt?t.normalize("NFKD").replace(CHt,"").toLowerCase():t.toLowerCase()),this.prepare&&(t=this.prepare(t)),this.numeric&&t.length>3&&(t=t.replace(Ihn,"$1 $2").replace(Mhn,"$1 $2").replace(Ahn,"$1 "));let r=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer),n=[],o=Us(),i,a,s=this.split||this.split===""?t.split(this.split):[t];for(let l=0,c,d;l<s.length;l++)if((c=d=s[l])&&!(c.length<this.minlength||c.length>this.maxlength)){if(e){if(o[c])continue;o[c]=1}else{if(i===c)continue;i=c}if(r)n.push(c);else if(!this.filter||(typeof this.filter=="function"?this.filter(c):!this.filter.has(c))){if(this.cache&&c.length<=this.I)if(this.F){var u=this.D.get(c);if(u||u===""){u&&n.push(u);continue}}else this.F=setTimeout(SF,50,this);if(this.stemmer){this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));let f;for(;f!==c&&c.length>2;)f=c,c=c.replace(this.K,p=>this.stemmer.get(p))}if(c&&(this.mapper||this.dedupe&&c.length>1)){u="";for(let f=0,p="",m,h;f<c.length;f++)m=c.charAt(f),m===p&&this.dedupe||((h=this.mapper&&this.mapper.get(m))||h===""?h===p&&this.dedupe||!(p=h)||(u+=h):u+=p=m);c=u}if(this.matcher&&c.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),c=c.replace(this.J,f=>this.matcher.get(f))),c&&this.replacer)for(u=0;c&&u<this.replacer.length;u+=2)c=c.replace(this.replacer[u],this.replacer[u+1]);if(this.cache&&d.length<=this.I&&(this.D.set(d,c),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),c){if(c!==d)if(e){if(o[c])continue;o[c]=1}else{if(a===c)continue;a=c}n.push(c)}}}return this.finalize&&(n=this.finalize(n)||n),this.cache&&t.length<=this.H&&(this.B.set(t,n),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),n};EF.prototype.set=function(t,e){this.cache.set(this.h=t,e),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};EF.prototype.get=function(t){let e=this.cache.get(t);return e&&this.h!==t&&(this.cache.delete(t),this.cache.set(this.h=t,e)),e};EF.prototype.remove=function(t){for(let e of this.cache){let r=e[0];e[1].includes(t)&&this.cache.delete(r)}};EF.prototype.clear=function(){this.cache.clear(),this.h=""};OHt={normalize:!1,numeric:!1,dedupe:!1},Xde={},zze=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),EHt=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),PHt=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],THt={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,\u00DF:2,d:3,t:3,l:4,m:5,n:5,r:6},Gze={Exact:OHt,Default:Xde,Normalize:Xde,LatinBalance:{mapper:zze},LatinAdvanced:{mapper:zze,matcher:EHt,replacer:PHt},LatinExtra:{mapper:zze,replacer:PHt.concat([/(?!^)[aeo]/g,""]),matcher:EHt},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(t){for(let r=0;r<t.length;r++){var e=t[r];let n=e.charAt(0),o=THt[n];for(let i=1,a;i<e.length&&(a=e.charAt(i),a==="h"||a==="w"||!(a=THt[a])||a===o||(n+=a,o=a,n.length!==4));i++);t[r]=n}}},CJK:{split:""},LatinExact:OHt,LatinDefault:Xde,LatinSimple:Xde};I4.prototype.clear=function(){this.index.length=0};I4.prototype.push=function(){};E_.prototype.get=function(t){let e=this.index[this.B(t)];return e&&e.get(t)};E_.prototype.set=function(t,e){var r=this.B(t);let n=this.index[r];n?(r=n.size,n.set(t,e),(r-=n.size)&&this.size++):(this.index[r]=n=new Map([[t,e]]),this.h.push(n),this.size++)};P_.prototype.add=function(t){var e=this.B(t);let r=this.index[e];r?(e=r.size,r.add(t),(e-=r.size)&&this.size++):(this.index[e]=r=new Set([t]),this.h.push(r),this.size++)};Lt=E_.prototype;Lt.has=P_.prototype.has=function(t){let e=this.index[this.B(t)];return e&&e.has(t)};Lt.delete=P_.prototype.delete=function(t){let e=this.index[this.B(t)];e&&e.delete(t)&&this.size--};Lt.clear=P_.prototype.clear=function(){this.index=Us(),this.h=[],this.size=0};Lt.values=P_.prototype.values=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].values())yield e};Lt.keys=P_.prototype.keys=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].keys())yield e};Lt.entries=P_.prototype.entries=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].entries())yield e};SR=0;CR("add");CR("append");CR("search");CR("update");CR("remove");CR("clear");CR("export");CR("import");CF.prototype.searchCache=Kze;Jze(CF.prototype);OF.prototype.add=function(t,e,r){if(EG(t)&&(e=t,t=PG(e,this.key)),e&&(t||t===0)){if(!r&&this.reg.has(t))return this.update(t,e);for(let s=0,u;s<this.field.length;s++){u=this.B[s];var n=this.index.get(this.field[s]);if(typeof u=="function"){var o=u(e);o&&n.add(t,o,r,!0)}else o=u.G,(!o||o(e))&&(u.constructor===String?u=[""+u]:O_(u)&&(u=[u]),Vze(e,u,this.D,0,n,t,u[0],r))}if(this.tag)for(n=0;n<this.A.length;n++){var i=this.A[n];o=this.tag.get(this.F[n]);let s=Us();if(typeof i=="function"){if(i=i(e),!i)continue}else{var a=i.G;if(a&&!a(e))continue;i.constructor===String&&(i=""+i),i=PG(e,i)}if(o&&i){O_(i)&&(i=[i]);for(let u=0,l,c;u<i.length;u++)if(l=i[u],!s[l]&&(s[l]=1,(a=o.get(l))?c=a:o.set(l,c=[]),!r||!c.includes(t))){if(c.length===2**31-1){if(a=new I4(c),this.fastupdate)for(let d of this.reg.values())d.includes(c)&&(d[d.indexOf(c)]=a);o.set(l,c=a)}c.push(t),this.fastupdate&&((a=this.reg.get(t))?a.push(c):this.reg.set(t,[c]))}}}if(this.store&&(!r||!this.store.has(t))){let s;if(this.h){s=Us();for(let u=0,l;u<this.h.length;u++){if(l=this.h[u],(r=l.G)&&!r(e))continue;let c;if(typeof l=="function"){if(c=l(e),!c)continue;l=[l.O]}else if(O_(l)||l.constructor===String){s[l]=e[l];continue}Hze(e,s,l,0,l[0],c)}}this.store.set(t,s||e)}this.worker&&(this.fastupdate||this.reg.add(t))}return this};pa.prototype.or=function(){return ufe(this,"or",Dhn,arguments)};pa.prototype.and=function(){return ufe(this,"and",Lhn,arguments)};pa.prototype.xor=function(){return ufe(this,"xor",Fhn,arguments)};pa.prototype.not=function(){return ufe(this,"not",khn,arguments)};Lt=pa.prototype;Lt.limit=function(t){if(this.await){let e=this;this.C.push(function(){return e.limit(t).result})}else if(this.result.length){let e=[];for(let r=0,n;r<this.result.length;r++)if(n=this.result[r])if(n.length<=t){if(e[r]=n,t-=n.length,!t)break}else{e[r]=n.slice(0,t);break}this.result=e}return this};Lt.offset=function(t){if(this.await){let e=this;this.C.push(function(){return e.offset(t).result})}else if(this.result.length){let e=[];for(let r=0,n;r<this.result.length;r++)(n=this.result[r])&&(n.length<=t?t-=n.length:(e[r]=n.slice(t),t=0));this.result=e}return this};Lt.boost=function(t){if(this.await){let e=this;this.C.push(function(){return e.boost(t).result})}else this.h+=t;return this};Lt.resolve=function(t,e,r,n,o){let i=this.await?Yze(this,!0):this.result;if(i.then){let a=this;return i.then(function(){return a.resolve(t,e,r,n,o)})}return i.length&&(typeof t=="object"?(n=t.highlight||this.highlight,r=!!n||t.enrich,e=t.offset,t=t.limit):(n=n||this.highlight,r=!!n||r),i=o?r?T4.call(this.index,i):i:Zze.call(this.index,i,t||100,e,r)),this.finalize(i,n)};Lt.finalize=function(t,e){if(t.then){let n=this;return t.then(function(o){return n.finalize(o,e)})}e&&t.length&&this.query&&(t=rfe(this.query,t,this.index.index,this.field,e));let r=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",r&&r(t),t};Us();OF.prototype.search=function(t,e,r,n){r||(!e&&EG(t)?(r=t,t=""):EG(e)&&(r=e,e=0));let o=[];var i=[];let a,s,u,l,c,d,f=0,p=!0,m;if(r){r.constructor===Array&&(r={index:r}),t=r.query||t,a=r.pluck,s=r.merge,l=r.boost,d=a||r.field||(d=r.index)&&(d.index?null:d);var h=this.tag&&r.tag;u=r.suggest,p=r.resolve!==!1,c=r.cache,m=p&&this.store&&r.highlight;var y=!!m||p&&this.store&&r.enrich;e=r.limit||e;var g=r.offset||0;if(e||(e=p?100:0),h&&(!this.db||!n)){h.constructor!==Array&&(h=[h]);var _=[];for(let P=0,T;P<h.length;P++)if(T=h[P],T.field&&T.tag){var w=T.tag;if(w.constructor===Array)for(var S=0;S<w.length;S++)_.push(T.field,w[S]);else _.push(T.field,w)}else{w=Object.keys(T);for(let I=0,N,M;I<w.length;I++)if(N=w[I],M=T[N],M.constructor===Array)for(S=0;S<M.length;S++)_.push(N,M[S]);else _.push(N,M)}if(h=_,!t){if(i=[],_.length)for(h=0;h<_.length;h+=2){if(this.db){if(n=this.index.get(_[h]),!n)continue;i.push(n=n.db.tag(_[h+1],e,g,y))}else n=Bhn.call(this,_[h],_[h+1],e,g,y);o.push(p?{field:_[h],tag:_[h+1],result:n}:[n])}if(i.length){let P=this;return Promise.all(i).then(function(T){for(let I=0;I<T.length;I++)p?o[I].result=T[I]:o[I]=T[I];return p?o:new pa(o.length>1?nfe(o,1,0,0,u,l):o[0],P)})}return p?o:new pa(o.length>1?nfe(o,1,0,0,u,l):o[0],this)}}p||a||!(d=d||this.field)||(O_(d)?a=d:(d.constructor===Array&&d.length===1&&(d=d[0]),a=d.field||d.index)),d&&d.constructor!==Array&&(d=[d])}d||(d=this.field);let C;_=(this.worker||this.db)&&!n&&[];for(let P=0,T,I,N;P<d.length;P++){if(I=d[P],this.db&&this.tag&&!this.B[P])continue;let M;if(O_(I)||(M=I,I=M.field,t=M.query||t,e=O4(M.limit,e),g=O4(M.offset,g),u=O4(M.suggest,u),m=p&&this.store&&O4(M.highlight,m),y=!!m||p&&this.store&&O4(M.enrich,y),c=O4(M.cache,c)),n)T=n[P];else{w=M||r||{},S=w.enrich;var E=this.index.get(I);if(h&&(this.db&&(w.tag=h,C=E.db.support_tag_search,w.field=d),!C&&S&&(w.enrich=!1)),T=c?E.searchCache(t,e,w):E.search(t,e,w),S&&(w.enrich=S),_){_[P]=T;continue}}if(N=(T=T.result||T)&&T.length,h&&N){if(w=[],S=0,this.db&&n){if(!C)for(E=d.length;E<n.length;E++){let D=n[E];if(D&&D.length)S++,w.push(D);else if(!u)return p?o:new pa(o,this)}}else for(let D=0,k,L;D<h.length;D+=2){if(k=this.tag.get(h[D]),!k){if(u)continue;return p?o:new pa(o,this)}if(L=(k=k&&k.get(h[D+1]))&&k.length)S++,w.push(k);else if(!u)return p?o:new pa(o,this)}if(S){if(T=$hn(T,w,p),N=T.length,!N&&!u)return p?T:new pa(T,this);S--}}if(N)i[f]=I,o.push(T),f++;else if(d.length===1)return p?o:new pa(o,this)}if(_){if(this.db&&h&&h.length&&!C)for(y=0;y<h.length;y+=2){if(i=this.index.get(h[y]),!i){if(u)continue;return p?o:new pa(o,this)}_.push(i.db.tag(h[y+1],e,g,!1))}let P=this;return Promise.all(_).then(function(T){return r&&(r.resolve=p),T.length&&(T=P.search(t,e,r,T)),T})}if(!f)return p?o:new pa(o,this);if(a&&(!y||!this.store))return o=o[0],p?o:new pa(o,this);for(_=[],g=0;g<i.length;g++){if(h=o[g],y&&h.length&&typeof h[0].doc>"u"&&(this.db?_.push(h=this.index.get(this.field[0]).db.enrich(h)):h=T4.call(this,h)),a)return p?m?rfe(t,h,this.index,a,m):h:new pa(h,this);o[g]={field:i[g],result:h}}if(y&&this.db&&_.length){let P=this;return Promise.all(_).then(function(T){for(let I=0;I<T.length;I++)o[I].result=T[I];return m&&(o=rfe(t,o,P.index,a,m)),s?MHt(o):o})}return m&&(o=rfe(t,o,this.index,a,m)),s?MHt(o):o};Lt=OF.prototype;Lt.mount=function(t){let e=this.field;if(this.tag)for(let i=0,a;i<this.F.length;i++){a=this.F[i];var r=void 0;this.index.set(a,r=new T_({},this.reg)),e===this.field&&(e=e.slice(0)),e.push(a),r.tag=this.tag.get(a)}r=[];let n={db:t.db,type:t.type,fastupdate:t.fastupdate};for(let i=0,a,s;i<e.length;i++){n.field=s=e[i],a=this.index.get(s);let u=new t.constructor(t.id,n);u.id=t.id,r[i]=u.mount(a),a.document=!0,i?a.bypass=!0:a.store=this.store}let o=this;return this.db=Promise.all(r).then(function(){o.db=!0})};Lt.commit=async function(){let t=[];for(let e of this.index.values())t.push(e.commit());await Promise.all(t),this.reg.clear()};Lt.destroy=function(){let t=[];for(let e of this.index.values())t.push(e.destroy());return Promise.all(t)};Lt.append=function(t,e){return this.add(t,e,!0)};Lt.update=function(t,e){return this.remove(t).add(t,e)};Lt.remove=function(t){EG(t)&&(t=PG(t,this.key));for(var e of this.index.values())e.remove(t,!0);if(this.reg.has(t)){if(this.tag&&!this.fastupdate)for(let r of this.tag.values())for(let n of r){e=n[0];let o=n[1],i=o.indexOf(t);i>-1&&(o.length>1?o.splice(i,1):r.delete(e))}this.store&&this.store.delete(t),this.reg.delete(t)}return this.cache&&this.cache.remove(t),this};Lt.clear=function(){let t=[];for(let e of this.index.values()){let r=e.clear();r.then&&t.push(r)}if(this.tag)for(let e of this.tag.values())e.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),t.length?Promise.all(t):this};Lt.contain=function(t){return this.db?this.index.get(this.field[0]).db.has(t):this.reg.has(t)};Lt.cleanup=function(){for(let t of this.index.values())t.cleanup();return this};Lt.get=function(t){return this.db?this.index.get(this.field[0]).db.enrich(t).then(function(e){return e[0]&&e[0].doc||null}):this.store.get(t)||null};Lt.set=function(t,e){return typeof t=="object"&&(e=t,t=PG(e,this.key)),this.store.set(t,e),this};Lt.searchCache=Kze;Lt.export=Uhn;Lt.import=qhn;Jze(OF.prototype);T_.prototype.remove=function(t,e){let r=this.reg.size&&(this.fastupdate?this.reg.get(t):this.reg.has(t));if(r){if(this.fastupdate){for(let n=0,o,i;n<r.length;n++)if((o=r[n])&&(i=o.length))if(o[i-1]===t)o.pop();else{let a=o.indexOf(t);a>=0&&o.splice(a,1)}}else TG(this.map,t),this.depth&&TG(this.ctx,t);e||this.reg.delete(t)}return this.db&&(this.commit_task.push({del:t}),this.M&&HHt(this)),this.cache&&this.cache.remove(t),this};Hhn={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};T_.prototype.add=function(t,e,r,n){if(e&&(t||t===0)){if(!n&&!r&&this.reg.has(t))return this.update(t,e);n=this.depth,e=this.encoder.encode(e,!n);let l=e.length;if(l){let c=Us(),d=Us(),f=this.resolution;for(let p=0;p<l;p++){let m=e[this.rtl?l-1-p:p];var o=m.length;if(o&&(n||!d[m])){var i=this.score?this.score(e,m,p,null,0):efe(f,l,p),a="";switch(this.tokenize){case"tolerant":if(ZP(this,d,m,i,t,r),o>2){for(let h=1,y,g,_,w;h<o-1;h++)y=m.charAt(h),g=m.charAt(h+1),_=m.substring(0,h)+g,w=m.substring(h+2),a=_+y+w,ZP(this,d,a,i,t,r),a=_+w,ZP(this,d,a,i,t,r);ZP(this,d,m.substring(0,m.length-1),i,t,r)}break;case"full":if(o>2){for(let h=0,y;h<o;h++)for(i=o;i>h;i--){a=m.substring(h,i),y=this.rtl?o-1-h:h;var s=this.score?this.score(e,m,p,a,y):efe(f,l,p,o,y);ZP(this,d,a,s,t,r)}break}case"bidirectional":case"reverse":if(o>1){for(s=o-1;s>0;s--){a=m[this.rtl?o-1-s:s]+a;var u=this.score?this.score(e,m,p,a,s):efe(f,l,p,o,s);ZP(this,d,a,u,t,r)}a=""}case"forward":if(o>1){for(s=0;s<o;s++)a+=m[this.rtl?o-1-s:s],ZP(this,d,a,i,t,r);break}default:if(ZP(this,d,m,i,t,r),n&&l>1&&p<l-1)for(o=this.N,a=m,i=Math.min(n+1,this.rtl?p+1:l-p),s=1;s<i;s++){m=e[this.rtl?l-1-p-s:p+s],u=this.bidirectional&&m>a;let h=this.score?this.score(e,a,p,m,s-1):efe(o+(l/2>o?0:1),l,p,i-1,s-1);ZP(this,c,u?a:m,h,t,r,u?m:a)}}}}this.fastupdate||this.reg.add(t)}}return this.db&&(this.commit_task.push(r?{ins:t}:{del:t}),this.M&&HHt(this)),this};T_.prototype.search=function(t,e,r){if(r||(e||typeof t!="object"?typeof e=="object"&&(r=e,e=0):(r=t,t="")),r&&r.cache)return r.cache=!1,t=this.searchCache(t,e,r),r.cache=!0,t;let n=[],o,i,a,s=0,u,l,c,d,f;r&&(t=r.query||t,e=r.limit||e,s=r.offset||0,i=r.context,a=r.suggest,f=(u=r.resolve)&&r.enrich,c=r.boost,d=r.resolution,l=this.db&&r.tag),typeof u>"u"&&(u=this.resolve),i=this.depth&&i!==!1;let p=this.encoder.encode(t,!i);if(o=p.length,e=e||(u?100:0),o===1)return jHt.call(this,p[0],"",e,s,u,f,l);if(o===2&&i&&!a)return jHt.call(this,p[1],p[0],e,s,u,f,l);let m=Us(),h=0,y;if(i&&(y=p[0],h=1),d||d===0||(d=y?this.N:this.resolution),this.db){if(this.db.search&&(r=this.db.search(this,p,e,s,a,u,f,l),r!==!1))return r;let g=this;return async function(){for(let _,w;h<o;h++){if((w=p[h])&&!m[w]){if(m[w]=1,_=await Wze(g,w,y,0,0,!1,!1),_=DHt(_,n,a,d)){n=_;break}y&&(a&&_&&n.length||(y=w))}a&&y&&h===o-1&&!n.length&&(d=g.resolution,y="",h=-1,m=Us())}return NHt(n,d,e,s,a,c,u)}()}for(let g,_;h<o;h++){if((_=p[h])&&!m[_]){if(m[_]=1,g=Wze(this,_,y,0,0,!1,!1),g=DHt(g,n,a,d)){n=g;break}y&&(a&&g&&n.length||(y=_))}a&&y&&h===o-1&&!n.length&&(d=this.resolution,y="",h=-1,m=Us())}return NHt(n,d,e,s,a,c,u)};Lt=T_.prototype;Lt.mount=function(t){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),t.mount(this)};Lt.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)};Lt.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};Lt.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this};Lt.append=function(t,e){return this.add(t,e,!0)};Lt.contain=function(t){return this.db?this.db.has(t):this.reg.has(t)};Lt.update=function(t,e){let r=this,n=this.remove(t);return n&&n.then?n.then(()=>r.add(t,e)):this.add(t,e)};Lt.cleanup=function(){return this.fastupdate?(TG(this.map),this.depth&&TG(this.ctx),this):this};Lt.searchCache=Kze;Lt.export=function(t,e,r=0,n=0){let o,i;switch(n){case 0:o="reg",i=UHt(this.reg);break;case 1:o="cfg",i=null;break;case 2:o="map",i=Xze(this.map,this.reg.size);break;case 3:o="ctx",i=BHt(this.ctx,this.reg.size);break;default:return}return ife.call(this,t,e,o,i,r,n)};Lt.import=function(t,e){if(e)switch(typeof e=="string"&&(e=JSON.parse(e)),t=t.split("."),t[t.length-1]==="json"&&t.pop(),t.length===3&&t.shift(),t=t.length>1?t[1]:t[0],t){case"reg":this.fastupdate=!1,this.reg=qHt(e,this.reg);break;case"map":this.map=Qze(e,this.map);break;case"ctx":this.ctx=zHt(e,this.ctx)}};Lt.serialize=function(t=!0){let e="",r="",n="";if(this.reg.size){let i;for(var o of this.reg.keys())i||(i=typeof o),e+=(e?",":"")+(i==="string"?'"'+o+'"':o);e="index.reg=new Set(["+e+"]);",r=RHt(this.map,i),r="index.map=new Map(["+r+"]);";for(let a of this.ctx.entries()){o=a[0];let s=RHt(a[1],i);s="new Map(["+s+"])",s='["'+o+'",'+s+"]",n+=(n?",":"")+s}n="index.ctx=new Map(["+n+"]);"}return t?"function inject(index){"+e+r+n+"}":e+r+n};Jze(T_.prototype);VHt=typeof window<"u"&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),afe=["map","ctx","tag","reg","cfg"],xF=Us();Lt=sfe.prototype;Lt.mount=function(t){return t.index?t.mount(this):(t.db=this,this.open())};Lt.open=function(){if(this.db)return this.db;let t=this;navigator.storage&&navigator.storage.persist(),xF[t.id]||(xF[t.id]=[]),xF[t.id].push(t.field);let e=VHt.open(t.id,1);return e.onupgradeneeded=function(){let r=t.db=this.result;for(let n=0,o;n<afe.length;n++){o=afe[n];for(let i=0,a;i<xF[t.id].length;i++)a=xF[t.id][i],r.objectStoreNames.contains(o+(o!=="reg"&&a?":"+a:""))||r.createObjectStore(o+(o!=="reg"&&a?":"+a:""))}},t.db=OR(e,function(r){t.db=r,t.db.onversionchange=function(){t.close()}})};Lt.close=function(){this.db&&this.db.close(),this.db=null};Lt.destroy=function(){let t=VHt.deleteDatabase(this.id);return OR(t)};Lt.clear=function(){let t=[];for(let r=0,n;r<afe.length;r++){n=afe[r];for(let o=0,i;o<xF[this.id].length;o++)i=xF[this.id][o],t.push(n+(n!=="reg"&&i?":"+i:""))}let e=this.db.transaction(t,"readwrite");for(let r=0;r<t.length;r++)e.objectStore(t[r]).clear();return OR(e)};Lt.get=function(t,e,r=0,n=0,o=!0,i=!1){t=this.db.transaction((e?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((e?"ctx":"map")+(this.field?":"+this.field:"")).get(e?e+":"+t:t);let a=this;return OR(t).then(function(s){let u=[];if(!s||!s.length)return u;if(o){if(!r&&!n&&s.length===1)return s[0];for(let l=0,c;l<s.length;l++)if((c=s[l])&&c.length){if(n>=c.length){n-=c.length;continue}let d=r?n+Math.min(c.length-n,r):c.length;for(let f=n;f<d;f++)u.push(c[f]);if(n=0,u.length===r)break}return i?a.enrich(u):u}return s})};Lt.tag=function(t,e=0,r=0,n=!1){t=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(t);let o=this;return OR(t).then(function(i){return!i||!i.length||r>=i.length?[]:!e&&!r?i:(i=i.slice(r,r+e),n?o.enrich(i):i)})};Lt.enrich=function(t){typeof t!="object"&&(t=[t]);let e=this.db.transaction("reg","readonly").objectStore("reg"),r=[];for(let n=0;n<t.length;n++)r[n]=OR(e.get(t[n]));return Promise.all(r).then(function(n){for(let o=0;o<n.length;o++)n[o]={id:t[o],doc:n[o]?JSON.parse(n[o]):null};return n})};Lt.has=function(t){return t=this.db.transaction("reg","readonly").objectStore("reg").getKey(t),OR(t).then(function(e){return!!e})};Lt.search=null;Lt.info=function(){};Lt.transaction=function(t,e,r){t+=t!=="reg"&&this.field?":"+this.field:"";let n=this.h[t+":"+e];if(n)return r.call(this,n);let o=this.db.transaction(t,e);this.h[t+":"+e]=n=o.objectStore(t);let i=r.call(this,n);return this.h[t+":"+e]=null,OR(o).finally(function(){return o=n=null,i})};Lt.commit=async function(t){let e=t.commit_task,r=[];t.commit_task=[];for(let n=0,o;n<e.length;n++)o=e[n],o.del&&r.push(o.del);r.length&&await this.remove(r),t.reg.size&&(await this.transaction("map","readwrite",function(n){for(let o of t.map){let i=o[0],a=o[1];a.length&&(n.get(i).onsuccess=function(){let s=this.result;var u;if(s&&s.length){let l=Math.max(s.length,a.length);for(let c=0,d,f;c<l;c++)if((f=a[c])&&f.length){if((d=s[c])&&d.length)for(u=0;u<f.length;u++)d.push(f[u]);else s[c]=f;u=1}}else s=a,u=1;u&&n.put(s,i)})}}),await this.transaction("ctx","readwrite",function(n){for(let o of t.ctx){let i=o[0],a=o[1];for(let s of a){let u=s[0],l=s[1];l.length&&(n.get(i+":"+u).onsuccess=function(){let c=this.result;var d;if(c&&c.length){let f=Math.max(c.length,l.length);for(let p=0,m,h;p<f;p++)if((h=l[p])&&h.length){if((m=c[p])&&m.length)for(d=0;d<h.length;d++)m.push(h[d]);else c[p]=h;d=1}}else c=l,d=1;d&&n.put(c,i+":"+u)})}}}),t.store?await this.transaction("reg","readwrite",function(n){for(let o of t.store){let i=o[0],a=o[1];n.put(typeof a=="object"?JSON.stringify(a):1,i)}}):t.bypass||await this.transaction("reg","readwrite",function(n){for(let o of t.reg.keys())n.put(1,o)}),t.tag&&await this.transaction("tag","readwrite",function(n){for(let o of t.tag){let i=o[0],a=o[1];a.length&&(n.get(i).onsuccess=function(){let s=this.result;s=s&&s.length?s.concat(a):a,n.put(s,i)})}}),t.map.clear(),t.ctx.clear(),t.tag&&t.tag.clear(),t.store&&t.store.clear(),t.document||t.reg.clear())};Lt.remove=function(t){return typeof t!="object"&&(t=[t]),Promise.all([this.transaction("map","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&Uze(r,t)}}),this.transaction("ctx","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&Uze(r,t)}}),this.transaction("tag","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&Uze(r,t,!0)}}),this.transaction("reg","readwrite",function(e){for(let r=0;r<t.length;r++)e.delete(t[r])})])};WHt={Index:T_,Charset:Gze,Encoder:A4,Document:OF,Worker:CF,Resolver:pa,IndexedDB:sfe,Language:{}}});var M4,lfe,GHt=b(()=>{$t();_t();M4=class M4{constructor(){this.bytesUsed=0;let e=ne(),r=Math.min(1e3,Math.max(20,e.lexicalSearchRamLimit||100));this.maxBytes=r*M4.MB_TO_BYTES,this.candidateLimit=Math.min(M4.DEFAULT_CANDIDATE_LIMIT,Math.floor(r*5))}getMaxBytes(){return this.maxBytes}getCandidateLimit(){return this.candidateLimit}getBytesUsed(){return this.bytesUsed}canAddContent(e){return this.bytesUsed+e<=this.maxBytes}addBytes(e){this.bytesUsed+=e}reset(){let e=this.bytesUsed;this.bytesUsed=0,B(`MemoryManager: Reset memory tracking (was using ${e} bytes, max: ${this.maxBytes} bytes)`)}getUsagePercent(){return Math.round(this.bytesUsed/this.maxBytes*100)}static getByteSize(e){return new TextEncoder().encode(e).length}};M4.DEFAULT_CANDIDATE_LIMIT=500,M4.MB_TO_BYTES=1024*1024;lfe=M4});var AG,Xp,cfe,JHt=b(()=>{$t();er();KHt();AG=require("obsidian");Yde();GHt();Xp=class Xp{constructor(e,r){this.app=e;this.indexedChunks=new Set;this.memoryManager=new lfe,this.chunkManager=r||new xR(e),this.index=null}createIndex(){let e=WHt.Document,r=this.tokenizeMixed.bind(this);return new e({encode:!1,tokenize:r,cache:!1,document:{id:"id",index:[{field:"title",tokenize:r,weight:3},{field:"heading",tokenize:r,weight:2.5},{field:"path",tokenize:r,weight:2},{field:"body",tokenize:r,weight:1}],store:["id","notePath","title","heading","chunkIndex"]}})}tokenizeMixed(e){if(!e)return[];let r=[],n=e.toLowerCase().match(/[a-z0-9_]+/g)||[];r.push(...n);let o=/[\u4e00-\u9fff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]+/g,i=e.match(o)||[];for(let a of i){a.length===1&&r.push(a);for(let s=0;s<a.length-1;s++)r.push(a.slice(s,s+2))}return r}async buildFromCandidates(e){if(B(`FullTextEngine: [CHUNKS] Starting with ${e.length} candidate notes`),this.indexedChunks.clear(),this.memoryManager.reset(),!this.index){await new Promise(l=>setTimeout(l,0));let s=Date.now();this.index=this.createIndex();let u=Date.now()-s;B(`FullTextEngine: FlexSearch index created in ${u}ms`)}let r={maxChars:Bj,overlap:0,maxBytesTotal:this.memoryManager.getMaxBytes()*Xp.CHUNK_MEMORY_PERCENTAGE},n=await this.chunkManager.getChunks(e,r);if(n.length===0)return B("FullTextEngine: No chunks generated"),0;B(`FullTextEngine: Generated ${n.length} chunks from ${e.length} notes`);let o=0,i=Xp.BATCH_SIZE,a=new Map;for(let s=0;s<n.length;s++){let u=n[s],l=Buffer.byteLength(u.content,"utf8");if(!this.memoryManager.canAddContent(l)){B(`FullTextEngine: Memory limit reached at ${o} chunks`);break}let c=u.notePath.replace(/\.md$/,"").split("/").join(" "),d=a.get(u.notePath);if(!d){let p=this.app.vault.getAbstractFileByPath(u.notePath);if(p instanceof AG.TFile){let m=this.app.metadataCache.getFileCache(p),h=m?(0,AG.getAllTags)(m)??[]:[],y=m?.frontmatter??{},g=this.app.metadataCache.resolvedLinks[p.path]??{},_=this.app.metadataCache.getBacklinksForFile(p)?.data??{},w=Object.keys(g),S=Object.keys(_),C=[...w,...S],E=this.extractPropertyValues(y);d={tags:h,links:C,props:E},a.set(u.notePath,d)}else d={tags:[],links:[],props:[]}}let f=[u.content,...d.props].join(" ");this.index.add({id:u.id,title:u.title,heading:u.heading,path:c,body:f,tags:d.tags,links:d.links,props:d.props.join(" "),notePath:u.notePath,chunkIndex:u.chunkIndex}),this.memoryManager.addBytes(l),this.indexedChunks.add(u.id),o++,s>0&&s%i===0&&await new Promise(p=>setTimeout(p,0))}return B(`FullTextEngine: [CHUNKS] Indexed ${o}/${n.length} chunks (${this.memoryManager.getUsagePercent()}% memory)`),o}async createNoteDoc(e){try{let r=this.app.metadataCache.getFileCache(e),n=await this.app.vault.cachedRead(e);n.length>Xp.MAX_CONTENT_SIZE&&(B(`FullText: File ${e.path} exceeds size limit (${n.length} bytes), truncating`),n=n.substring(0,Xp.MAX_CONTENT_SIZE));let o=r?(0,AG.getAllTags)(r)??[]:[],i=r?.headings?.map(p=>p.heading)??[],a=r?.frontmatter??{},s=this.app.metadataCache.resolvedLinks[e.path]??{},u=this.app.metadataCache.getBacklinksForFile(e)?.data??{},l=Object.keys(s),c=Object.keys(u),d=a,f=d?.title||d?.name||e.basename;return{id:e.path,title:f,headings:i,tags:o,props:a,linksOut:l,linksIn:c,body:n}}catch(r){return B(`FullText: Skipped ${e.path}: ${r}`),null}}extractPropertyValues(e){let r=[];if(e&&typeof e=="object")for(let n of Object.values(e))this.extractPrimitiveValues(n,r,Xp.MAX_EXTRACTION_DEPTH);return r}extractPrimitiveValues(e,r,n){if(!(n<=0||e==null))if(typeof e=="string"){let o=e.trim();o&&r.push(o)}else typeof e=="number"||typeof e=="boolean"?r.push(String(e)):e instanceof Date?r.push(e.toISOString()):Array.isArray(e)&&e.slice(0,Xp.MAX_ARRAY_ITEMS).forEach(o=>{if(typeof o=="string"||typeof o=="number"||typeof o=="boolean"){let i=typeof o=="string"?o.trim():String(o);i&&r.push(i)}})}search(e,r=30,n=[],o){if(!this.index)return[];let i=new Set;for(let u of e)try{let l=this.index.search(u,{limit:r*3,enrich:!0});if(Array.isArray(l)){for(let c of l)if(c?.result)for(let d of c.result){let f=typeof d=="string"?d:d?.id;f&&i.add(f)}}}catch(l){B(`FullText: Search failed for "${u}": ${l}`)}B(`FullText: Found ${i.size} unique documents from all queries (recall phase)`);let a=new Map,s=n.length>0?[...n]:o?[o]:[];if(s.length>0&&i.size>0){for(let u of s)this.scoreWithQuery(u,i,a,r);B(`FullText: Scored with ${s.length} terms (${n.length>0?"salient terms":"original query fallback"})`)}return this.buildFinalResults(a,r)}scoreWithQuery(e,r,n,o){try{let i=this.index.search(e,{limit:o*3,enrich:!0});if(Array.isArray(i))for(let a of i){if(!a?.result||!a?.field)continue;let s=a.field,u=this.getFieldWeight(s),c=e.trim().includes(" ")?1.5:1;for(let d=0;d<a.result.length;d++){let f=a.result[d],p=typeof f=="string"?f:f?.id;if(p&&r.has(p)){let h=1/(d+1)*u*c,y=n.get(p)||{score:0,fieldMatches:new Set,queriesMatched:new Set,lexicalMatches:[]};y.lexicalMatches.push({field:s,query:e,weight:u});let g={score:y.score+h,fieldMatches:new Set(y.fieldMatches).add(s),queriesMatched:new Set(y.queriesMatched).add(e),lexicalMatches:y.lexicalMatches};n.set(p,g)}}}}catch(i){B(`FullText: Scoring failed for query "${e}": ${i}`)}}buildFinalResults(e,r){let n=[];for(let[o,i]of e.entries()){let a=1+(i.fieldMatches.size-1)*.2,s=1+Math.max(0,i.queriesMatched.size-1)*.1,u=i.score*a*s;u=this.applyPhraseInPathBonus(o,i.queriesMatched,u);let l={lexicalMatches:i.lexicalMatches,baseScore:u,finalScore:u};n.push({id:o,score:u,engine:"fulltext",explanation:l})}return n.sort((o,i)=>i.score-o.score),n.slice(0,r)}applyPhraseInPathBonus(e,r,n){let o=e.replace(/\.md$/,"").split("/").join(" ").toLowerCase();for(let i of r)if(i.includes(" ")){let a=i.toLowerCase();if(o.includes(a))return n*1.5}return n}getFieldWeight(e){return Xp.FIELD_WEIGHTS[e]||1}clear(){try{if(this.index){try{let e=this.index;if(e!=null&&typeof e=="object")try{"destroy"in e&&typeof e.destroy=="function"?e.destroy():"clear"in e&&typeof e.clear=="function"&&e.clear()}catch(r){Ft(`FullTextEngine: Index method call error: ${r}`)}}catch(e){Ft(`FullTextEngine: Index cleanup error (type: ${typeof this.index}): ${e}`)}this.index=null}this.indexedChunks.clear(),this.memoryManager.reset(),B("FullTextEngine: Cleanup completed successfully")}catch(e){Ft(`FullTextEngine: Cleanup error: ${e}`)}}getStats(){return{documentsIndexed:this.indexedChunks.size,memoryUsed:this.memoryManager.getBytesUsed(),memoryPercent:this.memoryManager.getUsagePercent()}}};Xp.MAX_CONTENT_SIZE=10*1024*1024,Xp.BATCH_SIZE=10,Xp.CHUNK_MEMORY_PERCENTAGE=.35,Xp.MAX_ARRAY_ITEMS=10,Xp.MAX_EXTRACTION_DEPTH=2,Xp.FIELD_WEIGHTS={title:3,path:1.5,headings:1.5,tags:1.5,props:1.5,links:1.5,body:1};cfe=Xp});var dfe,ZHt=b(()=>{dfe=class{static levenshteinDistance(e,r){let n=e.length,o=r.length;if(n===0)return o;if(o===0)return n;let i=Array(n+1).fill(null).map(()=>Array(o+1).fill(0));for(let a=0;a<=n;a++)i[a][0]=a;for(let a=0;a<=o;a++)i[0][a]=a;for(let a=1;a<=n;a++)for(let s=1;s<=o;s++)e[a-1]===r[s-1]?i[a][s]=i[a-1][s-1]:i[a][s]=1+Math.min(i[a-1][s],i[a][s-1],i[a-1][s-1]);return i[n][o]}static similarity(e,r){let n=e.toLowerCase(),o=r.toLowerCase(),i=Math.max(n.length,o.length);return i===0?1:1-this.levenshteinDistance(n,o)/i}static generateVariants(e){let r=new Set,n=e.toLowerCase();if(r.add(e),r.add(n),r.add(e.toUpperCase()),n.length>0&&r.add(n[0].toUpperCase()+n.slice(1)),n.includes(" ")||n.includes("-")||n.includes("_")){let i=n.split(/[\s\-_]+/);if(i.length>1){let a=i[0]+i.slice(1).map(u=>u[0]?.toUpperCase()+u.slice(1)).join("");r.add(a);let s=i.map(u=>u[0]?.toUpperCase()+u.slice(1)).join("");r.add(s)}}n.endsWith("s")?r.add(n.slice(0,-1)):n.endsWith("es")?r.add(n.slice(0,-2)):(r.add(n+"s"),n.endsWith("y")&&r.add(n.slice(0,-1)+"ies"));let o={a:["s","q","w","z"],b:["v","g","h","n"],c:["x","d","f","v"],d:["s","e","r","f","c","x"],e:["w","r","d","s"],f:["d","r","t","g","v","c"],g:["f","t","y","h","b","v"],h:["g","y","u","j","n","b"],i:["u","o","k","j"],j:["h","u","i","k","m","n"],k:["j","i","o","l","m"],l:["k","o","p"],m:["n","j","k"],n:["b","h","j","m"],o:["i","p","l","k"],p:["o","l"],q:["w","a"],r:["e","t","f","d"],s:["a","w","e","d","x","z"],t:["r","y","g","f"],u:["y","i","j","h"],v:["c","f","g","b"],w:["q","e","s","a"],x:["z","s","d","c"],y:["t","u","h","g"],z:["a","s","x"]};for(let i=0;i<n.length&&r.size<10;i++){let a=n[i],s=o[a]||[];for(let u of s){if(r.size>=10)break;let l=n.slice(0,i)+u+n.slice(i+1);r.add(l)}}return Array.from(r)}static isFuzzyMatch(e,r,n=.8){if(this.similarity(e,r)>=n)return!0;let i=l=>{let c=l.toLowerCase();return c.endsWith("ies")&&c.length>3?c.slice(0,-3)+"y":c.endsWith("es")&&c.length>2?c.slice(0,-2):c.endsWith("s")&&!c.endsWith("ss")&&c.length>1?c.slice(0,-1):c},a=i(e),s=i(r);return a===s?!0:this.similarity(a,s)>=n}}});var pfe,ffe,YHt=b(()=>{er();IE();$t();kt();ZHt();pfe=class pfe{constructor(e={}){this.options=e;this.cache=new Map;this.config={maxVariants:e.maxVariants??2,timeout:e.timeout??cz,cacheSize:e.cacheSize??100,minTermLength:2}}async expand(e){if(!e?.trim())return{queries:[],salientTerms:[],originalQuery:"",expandedQueries:[],expandedTerms:[]};let r=this.cache.get(e);if(r)return this.cache.delete(e),this.cache.set(e,r),B(`QueryExpander: Using cached expansion for "${e}"`),r;try{let n=await this.expandWithTimeout(e);return this.cacheResult(e,n),n}catch(n){return Ft(`QueryExpander: Failed to expand query "${e}":`,n),this.fallbackExpansion(e)}}async expandWithTimeout(e){try{return await jee(r=>this.expandWithLLM(e,r),this.config.timeout,"Query expansion")}catch(r){if(r instanceof v8)return B(`QueryExpander: Timeout reached for "${e}"`),this.fallbackExpansion(e);throw r}}async expandWithLLM(e,r){try{if(!this.options.getChatModel)return B("QueryExpander: No chat model getter provided"),this.fallbackExpansion(e);let n=await this.options.getChatModel();if(!n)return B("QueryExpander: No chat model available"),this.fallbackExpansion(e);let o=pfe.PROMPT_TEMPLATE.replace("{count}",this.config.maxVariants.toString()).replace("{query}",e),i=await Od(async()=>await n.invoke(o,r?{signal:r}:void 0));if(!i)return this.fallbackExpansion(e);let a=this.extractContent(i);if(!a)return this.fallbackExpansion(e);let s=this.parseXMLResponse(a,e);return B(`QueryExpander: Expanded "${e}" to ${s.queries.length} queries and ${s.salientTerms.length} terms`),s}catch(n){return ie("QueryExpander: LLM expansion failed:",n),this.fallbackExpansion(e)}}extractContent(e){return typeof e=="string"?e:String(e?.content??e?.text??"").trim()||null}extractSalientTermsFromOriginal(e){return this.extractTermsFromQueries([e]).filter(r=>this.isValidTerm(r))}parseXMLResponse(e,r){let n=[r],o=new Set,i=/<query>(.*?)<\/query>/g,a;for(;(a=i.exec(e))!==null;){let d=a[1]?.trim();d&&d!==r&&n.length<=this.config.maxVariants&&n.push(d)}let s=/<term>(.*?)<\/term>/g,u;for(;(u=s.exec(e))!==null;){let d=u[1]?.trim().toLowerCase();d&&this.isValidTerm(d)&&o.add(d)}if(n.length===1&&o.size===0)return this.parseLegacyFormat(e,r);let l=this.extractSalientTermsFromOriginal(r),c=n.slice(1);return{queries:n.slice(0,this.config.maxVariants+1),salientTerms:l,originalQuery:r,expandedQueries:c.slice(0,this.config.maxVariants),expandedTerms:Array.from(o)}}parseLegacyFormat(e,r){let n=e.split(`
`).map(l=>l.trim()),o=[r],i=new Set,a=null;for(let l of n)if(!(!l||l==="")){if(l.toUpperCase().includes("QUERIES")){a="queries";continue}if(l.toUpperCase().includes("TERMS")||l.toUpperCase().includes("KEYWORDS")){a="terms";continue}if(a==="queries"&&o.length<=this.config.maxVariants){let c=l.replace(/^[-•*\d.)\s]+/,"").trim();c&&c!==r&&o.push(c)}else if(a==="terms"){let c=l.replace(/^[-•*\d.)\s]+/,"").trim().toLowerCase();c&&this.isValidTerm(c)&&i.add(c)}}if(o.length===1&&i.size===0)for(let l of n.slice(0,this.config.maxVariants))l&&!l.toUpperCase().includes("QUERY")&&o.push(l);let s=this.extractSalientTermsFromOriginal(r),u=o.slice(1);return{queries:o.slice(0,this.config.maxVariants+1),salientTerms:s,originalQuery:r,expandedQueries:u.slice(0,this.config.maxVariants),expandedTerms:Array.from(i)}}fallbackExpansion(e){let r=this.extractTermsFromQueries([e]),n=new Set([e]);for(let i of r)if(i.length>=3){let a=dfe.generateVariants(i);for(let s of a.slice(0,3))if(s!==i){let u=e.toLowerCase().replace(new RegExp(`\\b${i}\\b`,"gi"),s);u!==e.toLowerCase()&&n.add(u)}}return{queries:[e],salientTerms:r,originalQuery:e,expandedQueries:[],expandedTerms:[]}}extractTermsFromQueries(e){let r=new Set;for(let n of e){let o=n.toLowerCase().replace(/[^\w\s-]/g," ").split(/\s+/);for(let i of o)this.isValidTerm(i)&&(r.add(i),i.includes("-")&&i.split("-").forEach(a=>{this.isValidTerm(a)&&r.add(a)}))}return Array.from(r)}isValidTerm(e){return e.length>=this.config.minTermLength&&/^[\w-]+$/.test(e)}cacheResult(e,r){if(this.cache.size>=this.config.cacheSize){let n=this.cache.keys().next().value;n&&this.cache.delete(n)}this.cache.set(e,r)}clearCache(){this.cache.clear(),B("QueryExpander: Cache cleared")}getCacheSize(){return this.cache.size}async expandQueries(e){return(await this.expand(e)).queries}};pfe.PROMPT_TEMPLATE=`Generate alternative search queries and semantically related terms for the following query:
"{query}"
Instructions:
1. Generate {count} alternative search queries that capture the same intent
2. Extract semantically related terms that someone might use when searching for this topic
3. Include:
- Keywords from the original query
- Synonyms and related concepts
- Domain-specific terminology
- Associated terms someone might use
4. Keep the SAME LANGUAGE as the original query
5. Focus on NOUNS and meaningful concepts
6. EXCLUDE common action verbs in ANY language (find, search, get, \u67E5\u627E, chercher, buscar, etc.)
Example: "find my piano notes"
- Queries: "piano lesson notes", "piano practice sheets"
- Terms: piano, notes, music, sheet, practice, lesson, piece, scales, exercises
Example: "typescript interfaces"
- Queries: "typescript type definitions", "typescript contracts"
- Terms: typescript, interfaces, types, definitions, contracts, typing, declarations
Example: "\u67E5\u627E\u6211\u7684\u7B14\u8BB0" (Chinese)
- Queries: "\u6211\u7684\u5B66\u4E60\u7B14\u8BB0", "\u4E2A\u4EBA\u7B14\u8BB0\u6587\u6863"
- Terms: \u7B14\u8BB0, \u6587\u6863, \u8BB0\u5F55, \u8D44\u6599, \u5B66\u4E60, \u5907\u5FD8\u5F55 (keep in Chinese)
Example: "rechercher documents projet" (French)
- Queries: "documents de projet", "fichiers projet"
- Terms: documents, projet, fichiers, dossiers, archives (keep in French)
Format your response using XML tags:
<queries>
<query>alternative query 1</query>
<query>alternative query 2</query>
</queries>
<terms>
<term>keyword1</term>
<term>keyword2</term>
<term>keyword3</term>
<term>related_term1</term>
<term>related_term2</term>
</terms>`;ffe=pfe});var IG,mfe,XHt=b(()=>{$t();Yp();IG=class IG{constructor(e){this.app=e}async batchCachedReadGrep(e,r){let{inclusions:n,exclusions:o}=mu(),a=this.app.vault.getMarkdownFiles().filter(d=>Ma(d,n,o)),s=new Set,u=IG.CONFIG.BATCH_SIZE,l=e.map(d=>d.toLowerCase());for(let d=0;d<a.length&&s.size<r;d+=u){let f=a.slice(d,d+u);await Promise.all(f.map(async p=>{if(!(s.size>=r))try{let m=p.path.toLowerCase(),h=!1;for(let y of l)if(m.includes(y)){s.add(p.path),h=!0;break}if(!h){let g=(await this.app.vault.cachedRead(p)).toLowerCase();for(let _ of l)if(g.includes(_)){s.add(p.path);break}}}catch(m){B(`GrepScanner: Skipping file ${p.path}: ${m}`)}})),d%IG.CONFIG.YIELD_INTERVAL===0&&await new Promise(p=>setTimeout(p,0))}let c=Array.from(s).slice(0,r);return c.length>0&&B(` Grep: ${c.length} files match [${e.slice(0,3).join(", ")}${e.length>3?"...":""}]`),c}async grep(e,r=200){return this.batchCachedReadGrep([e],r)}async fileContainsAny(e,r){try{let n=e.path.toLowerCase(),o=0;for(let s of r)n.includes(s.toLowerCase())&&o++;if(o>0)return!0;let a=(await this.app.vault.cachedRead(e)).toLowerCase();return r.some(s=>a.includes(s.toLowerCase()))}catch{return!1}}};IG.CONFIG={BATCH_SIZE:30,YIELD_INTERVAL:100};mfe=IG});var Vhn,hfe,QHt=b(()=>{$t();Vhn={enabled:!0,minDocsForBoost:2,maxBoostFactor:1.15,minRelevanceRatio:.4},hfe=class{constructor(e){this.config=Vhn;this.app=e||null}setConfig(e){this.config={...this.config,...e}}applyBoosts(e){if(!this.config.enabled||e.length===0)return e;let r=this.calculateFolderStats(e);return this.logBoostedFolders(r),e.map(n=>{let o=this.extractFolder(n.id),i=r.get(o);if(i){let a=n.score*i.boostFactor;return{...n,score:a,explanation:n.explanation?{...n.explanation,folderBoost:{folder:i.folderPath,documentCount:i.documentCount,totalDocsInFolder:i.totalDocsInFolder,relevanceRatio:i.relevanceRatio,boostFactor:i.boostFactor},finalScore:a}:void 0}}return n})}calculateFolderStats(e){let r=new Map;for(let i of e){let a=this.extractFolder(i.id);r.set(a,(r.get(a)||0)+1)}let n=this.getTotalDocsPerFolder(),o=new Map;for(let[i,a]of r.entries()){let s=n.get(i)||a,u=a/s;if(a>=this.config.minDocsForBoost&&u>=this.config.minRelevanceRatio){let c=1+(1+Math.log2(a+1)-1)*Math.sqrt(u),d=Math.min(c,this.config.maxBoostFactor);o.set(i,{folderPath:i,documentCount:a,totalDocsInFolder:s,relevanceRatio:u,boostFactor:d})}}return o}getTotalDocsPerFolder(){let e=new Map;if(!this.app)return e;let r=this.app.vault.getMarkdownFiles();for(let n of r){let o=this.extractFolder(n.path);e.set(o,(e.get(o)||0)+1)}return e}extractFolder(e){return e.substring(0,e.lastIndexOf("/"))||""}logBoostedFolders(e){let r=Array.from(e.values()).sort((n,o)=>o.relevanceRatio-n.relevanceRatio);r.length>0&&(B(`Folder boost: Boosting ${r.length} folders with significant relevance`),r.slice(0,5).forEach(n=>{let o=(n.relevanceRatio*100).toFixed(1);B(` ${n.folderPath||"(root)"}: ${n.documentCount}/${n.totalDocsInFolder} docs (${o}% relevant, ${n.boostFactor.toFixed(2)}x boost)`)}))}getFolderBoosts(e){return this.config.enabled?this.calculateFolderStats(e):new Map}}});var Whn,gfe,eVt=b(()=>{$t();Whn={enabled:!0,maxCandidates:10,backlinkWeight:1,coCitationWeight:.5,sharedTagWeight:.3,boostStrength:.1,maxBoostMultiplier:1.2},gfe=class{constructor(e,r={}){this.metadataCache=e.metadataCache,this.config={...Whn,...r}}applyBoost(e){if(!this.config.enabled||e.length===0)return e;let r=this.filterCandidates(e);if(r.length<2)return e;let n=new Set(r.map(s=>s.id)),o=new Map;for(let s of r){let u=this.calculateConnections(s.id,n);o.set(s.id,u)}let i=e.map(s=>{let u=o.get(s.id);return!u||u.boostMultiplier===1?s:{...s,score:s.score*u.boostMultiplier,explanation:s.explanation?{...s.explanation,graphConnections:{backlinks:u.backlinks.length,coCitations:u.coCitations.length,sharedTags:u.sharedTags.length,score:u.connectionScore,boostMultiplier:u.boostMultiplier}}:void 0}}),a=i.filter(s=>{let u=o.get(s.id);return u&&u.boostMultiplier>1});return a.length>0&&B(`GraphBoostCalculator: Boosted ${a.length} notes based on connections`),i}calculateConnections(e,r){let n=this.findBacklinks(e,r),o=this.findCoCitations(e,r),i=this.findSharedTags(e,r),a=n.length*this.config.backlinkWeight+o.length*this.config.coCitationWeight+i.length*this.config.sharedTagWeight,s=1;return a>0&&(s=1+this.config.boostStrength*Math.log(1+a),s=Math.min(s,this.config.maxBoostMultiplier)),{backlinks:n,coCitations:o,sharedTags:i,connectionScore:a,boostMultiplier:s}}resolveFile(e){let r=this.metadataCache.getFirstLinkpathDest(e,"");return r&&typeof r=="object"&&"path"in r?r:null}findBacklinks(e,r){let n=[],o=this.resolveFile(e);if(!o)return n;let i=this.metadataCache.getBacklinksForFile(o);if(!i)return n;for(let[a]of i.data)r.has(a)&&a!==e&&n.push(a);return n}findCoCitations(e,r){let n=[],o=new Set,i=this.resolveFile(e);if(!i)return n;let a=this.metadataCache.getBacklinksForFile(i);if(!a)return n;for(let[s]of a.data)o.add(s);if(o.size===0)return n;for(let s of r){if(s===e)continue;let u=this.resolveFile(s);if(!u)continue;let l=this.metadataCache.getBacklinksForFile(u);if(l){for(let[c]of l.data)if(o.has(c)){n.push(s);break}}}return n}findSharedTags(e,r){let n=[],o=this.resolveFile(e);if(!o)return n;let i=this.metadataCache.getFileCache(o);if(!i||!i.tags||i.tags.length===0)return n;let a=new Set(i.tags.map(s=>s.tag));for(let s of r){if(s===e)continue;let u=this.resolveFile(s);if(!u)continue;let l=this.metadataCache.getFileCache(u);if(!l||!l.tags)continue;l.tags.some(d=>a.has(d.tag))&&n.push(s)}return n}filterCandidates(e){let r=e,n=r.length;return r=r.slice(0,this.config.maxCandidates),n>this.config.maxCandidates&&B(`GraphBoost: Limited to top ${this.config.maxCandidates} candidates (from ${n})`),r}setConfig(e){this.config={...this.config,...e}}}});var yfe,tVt=b(()=>{yfe=class{constructor(e={}){this.config={method:"zscore-tanh",tanhScale:2.5,clipMin:.02,clipMax:.98};this.config={...this.config,...e}}updateExplanation(e,r,n){if(e)return{...e,baseScore:r,finalScore:n}}normalize(e){if(e.length===0)return e;switch(this.config.method){case"zscore-tanh":return this.normalizeZScoreTanh(e);case"minmax":return this.normalizeMinMax(e);case"percentile":return this.normalizePercentile(e);default:return e}}normalizeZScoreTanh(e){let r=e.map(l=>l.score),n=r.reduce((l,c)=>l+c,0)/r.length,o=r.reduce((l,c)=>l+Math.pow(c-n,2),0)/r.length,i=Math.sqrt(o);if(i===0)return e.map(l=>({...l,score:.5,explanation:this.updateExplanation(l.explanation,l.score,.5)}));let a=this.config.tanhScale||2.5,s=this.config.clipMin||.02,u=this.config.clipMax||.98;return e.map(l=>{let c=(l.score-n)/i,d=.5+.5*Math.tanh(c/a),f=Math.max(s,Math.min(u,d));return{...l,score:f,explanation:this.updateExplanation(l.explanation,l.score,f)}})}normalizeMinMax(e){let r=e.map(u=>u.score),n=Math.min(...r),o=Math.max(...r);if(o===n)return e.map(u=>({...u,score:.5,explanation:this.updateExplanation(u.explanation,u.score,.5)}));let i=this.config.clipMin||.02,a=this.config.clipMax||.98;return e.map(u=>{let l=(u.score-n)/(o-n),c=i+l*(a-i);return{...u,score:c,explanation:this.updateExplanation(u.explanation,u.score,c)}})}normalizePercentile(e){let r=e.length,n=this.config.clipMin||.02,o=this.config.clipMax||.98,i=[...e].sort((s,u)=>s.score-u.score),a=new Map;return i.forEach((s,u)=>{let l=u/(r-1),c=n+l*(o-n);a.set(s.id,c)}),e.map(s=>{let u=a.get(s.id)||.5;return{...s,score:u,explanation:this.updateExplanation(s.explanation,s.score,u)}})}getStatistics(e){if(e.length===0)return{mean:0,std:0,min:0,max:0,median:0};let r=e.map(c=>c.score),n=[...r].sort((c,d)=>c-d),o=r.reduce((c,d)=>c+d,0)/r.length,i=r.reduce((c,d)=>c+Math.pow(d-o,2),0)/r.length,a=Math.sqrt(i),s=n[0],u=n[n.length-1],l=n[Math.floor(n.length/2)];return{mean:o,std:a,min:s,max:u,median:l}}}});var Khn,bfe,rVt=b(()=>{er();$t();Yde();JHt();YHt();XHt();QHt();eVt();tVt();Khn=2,bfe=class{constructor(e,r){this.app=e;this.getChatModel=r;this.grepScanner=new mfe(e),this.chunkManager=new xR(e),this.fullTextEngine=new cfe(e,this.chunkManager),this.queryExpander=new ffe({getChatModel:this.getChatModel,maxVariants:3,timeout:cz}),this.folderBoostCalculator=new hfe(e),this.graphBoostCalculator=new gfe(e,{enabled:!0,maxCandidates:10,boostStrength:.1,maxBoostMultiplier:1.15}),this.scoreNormalizer=new yfe({method:"minmax",clipMin:.02,clipMax:.98})}async retrieve(e,r={}){if(!e||typeof e!="string")return Ft("SearchCore: Invalid query provided"),[];let n=e.trim();if(n.length===0)return Ft("SearchCore: Empty query provided"),[];n.length>1e3?(Ft("SearchCore: Query too long, truncating"),e=n.substring(0,1e3)):e=n;let o=Math.min(Math.max(1,r.maxResults||30),100),i=Math.min(Math.max(10,r.candidateLimit||500),1e3),a=!!(r.enableLexicalBoosts??!0);try{B(`SearchCore: Searching for "${e}"`);let s=await this.queryExpander.expand(e),u=s.queries,l=r.salientTerms?[...new Set([...s.salientTerms,...r.salientTerms])]:s.salientTerms;(u.length>1||l.length>3||s.expandedTerms.length>0)&&B(`Query expansion: ${u.length} variants, ${l.length} scoring terms (from original), ${s.expandedTerms.length} recall terms (LLM-generated)`);let c=[...u,...s.expandedTerms,...l],d=await this.grepScanner.batchCachedReadGrep(c,200),f=d.slice(0,i);B(`SearchCore: ${f.length} candidates (from ${d.length} grep hits)`);let m=await this.executeLexicalSearch(f,c,l,o,s.originalQuery);if(a&&(m=this.folderBoostCalculator.applyBoosts(m),m=this.graphBoostCalculator.applyBoost(m)),m=this.scoreNormalizer.normalize(m),this.fullTextEngine.clear(),m=m.slice(0,o),m.length>0){let h=this.app.vault.getAbstractFileByPath(m[0].id);B(`SearchCore: ${m.length} results found (top: ${h?.name||m[0].id})`)}else B("SearchCore: No results found");return m}catch(s){ie("SearchCore: Retrieval failed",s);try{return await this.fallbackSearch(e,o)}catch(u){return ie("SearchCore: Fallback search also failed",u),[]}}}async fallbackSearch(e,r){try{return(await this.grepScanner.grep(e,r)).map((o,i)=>({id:o,score:1/(i+1),engine:"grep"}))}catch(n){return ie("SearchCore: Fallback search failed",n),[]}}getStats(){return{fullTextStats:this.fullTextEngine.getStats()}}getChunkManager(){return this.chunkManager}clear(){this.fullTextEngine.clear(),this.queryExpander.clearCache(),B("SearchCore: Cleared all caches")}async executeLexicalSearch(e,r,n,o,i){try{let a=Date.now(),s=await this.fullTextEngine.buildFromCandidates(e),u=Date.now()-a,l=Date.now(),c=this.fullTextEngine.search(r,o*Khn,n,i),d=Date.now()-l;return B(`Full-text: ${s} docs indexed (${u}ms), ${c.length} results (${d}ms)`),c}catch(a){return ie("Full-text search failed",a),[]}}}});var PF,nVt=b(()=>{PF="0.39.0"});function uVt(t,e={auto:!1}){if(oVt)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${t.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(TF)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${t.kind}'\` after \`import '@anthropic-ai/sdk/shims/${TF}'\``);oVt=e.auto,TF=t.kind,eUe=t.fetch,Ghn=t.Request,Jhn=t.Response,Zhn=t.Headers,iVt=t.FormData,Yhn=t.Blob,_fe=t.File,tUe=t.ReadableStream,aVt=t.getMultipartRequestOptions,rUe=t.getDefaultAgent,vfe=t.fileFromPath,sVt=t.isFsReadStream}var oVt,TF,eUe,Ghn,Jhn,Zhn,iVt,Yhn,_fe,tUe,aVt,rUe,vfe,sVt,nUe=b(()=>{oVt=!1});var wfe,lVt=b(()=>{wfe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function cVt({manuallyImported:t}={}){let e=t?"You may need to use polyfills":"Add one of these imports before your first `import \u2026 from '@anthropic-ai/sdk'`:\n- `import '@anthropic-ai/sdk/shims/node'` (if you're running on Node)\n- `import '@anthropic-ai/sdk/shims/web'` (otherwise)\n",r,n,o,i;try{r=fetch,n=Request,o=Response,i=Headers}catch(a){throw new Error(`this environment is missing the following Web Fetch API type: ${a.message}. ${e}`)}return{kind:"web",fetch:r,Request:n,Response:o,Headers:i,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`)}},getMultipartRequestOptions:async(a,s)=>({...s,body:new wfe(a)}),getDefaultAgent:a=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/anthropics/anthropic-sdk-typescript#file-uploads")},isFsReadStream:a=>!1}}var dVt=b(()=>{lVt()});var fVt=b(()=>{dVt()});var MG=b(()=>{nUe();fVt();nUe();TF||uVt(cVt(),{auto:!0})});var qr,Zc,Gd,ER,R4,RG,NG,jG,DG,LG,FG,kG,$G,A_=b(()=>{YP();qr=class extends Error{},Zc=class t extends qr{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.request_id=o?.["request-id"],this.error=r}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new ER({message:n,cause:xfe(r)});let i=r;return e===400?new RG(e,i,n,o):e===401?new NG(e,i,n,o):e===403?new jG(e,i,n,o):e===404?new DG(e,i,n,o):e===409?new LG(e,i,n,o):e===422?new FG(e,i,n,o):e===429?new kG(e,i,n,o):e>=500?new $G(e,i,n,o):new t(e,i,n,o)}},Gd=class extends Zc{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},ER=class extends Zc{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},R4=class extends ER{constructor({message:e}={}){super({message:e??"Request timed out."})}},RG=class extends Zc{},NG=class extends Zc{},jG=class extends Zc{},DG=class extends Zc{},LG=class extends Zc{},FG=class extends Zc{},kG=class extends Zc{},$G=class extends Zc{}});function tgn(t,e){for(let o=e??0;o<t.length;o++){if(t[o]===10)return{preceding:o,index:o+1,carriage:!1};if(t[o]===13)return{preceding:o,index:o+1,carriage:!0}}return null}function pVt(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var Sfe,AF,fg,XP,oUe=b(()=>{A_();Sfe=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},AF=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},XP=class{constructor(){fg.set(this,void 0),this.buffer=new Uint8Array,Sfe(this,fg,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?new TextEncoder().encode(e):e,n=new Uint8Array(this.buffer.length+r.length);n.set(this.buffer),n.set(r,this.buffer.length),this.buffer=n;let o=[],i;for(;(i=tgn(this.buffer,AF(this,fg,"f")))!=null;){if(i.carriage&&AF(this,fg,"f")==null){Sfe(this,fg,i.index,"f");continue}if(AF(this,fg,"f")!=null&&(i.index!==AF(this,fg,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,AF(this,fg,"f")-1))),this.buffer=this.buffer.slice(AF(this,fg,"f")),Sfe(this,fg,null,"f");continue}let a=AF(this,fg,"f")!==null?i.preceding-1:i.preceding,s=this.decodeText(this.buffer.slice(0,a));o.push(s),this.buffer=this.buffer.slice(i.index),Sfe(this,fg,null,"f")}return o}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new qr(`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new qr(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new qr("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
`):[]}};fg=new WeakMap;XP.NEWLINE_CHARS=new Set([`
`,"\r"]);XP.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function BG(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var iUe=b(()=>{});async function*rgn(t,e){if(!t.body)throw e.abort(),new qr("Attempted to iterate over a response with no body");let r=new aUe,n=new XP,o=BG(t.body);for await(let i of ngn(o))for(let a of n.decode(i)){let s=r.decode(a);s&&(yield s)}for(let i of n.flush()){let a=r.decode(i);a&&(yield a)}}async function*ngn(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?new TextEncoder().encode(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=pVt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function ogn(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var hO,aUe,Cfe=b(()=>{MG();A_();oUe();iUe();YP();A_();hO=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;async function*o(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let i=!1;try{for await(let a of rgn(e,r)){if(a.event==="completion")try{yield JSON.parse(a.data)}catch(s){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),s}if(a.event==="message_start"||a.event==="message_delta"||a.event==="message_stop"||a.event==="content_block_start"||a.event==="content_block_delta"||a.event==="content_block_stop")try{yield JSON.parse(a.data)}catch(s){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),s}if(a.event!=="ping"&&a.event==="error")throw Zc.generate(void 0,`SSE Error: ${a.data}`,a.data,sUe(e.headers))}i=!0}catch(a){if(a instanceof Error&&a.name==="AbortError")return;throw a}finally{i||r.abort()}}return new t(o,r)}static fromReadableStream(e,r){let n=!1;async function*o(){let a=new XP,s=BG(e);for await(let u of s)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let s of o())a||s&&(yield JSON.parse(s));a=!0}catch(s){if(s instanceof Error&&s.name==="AbortError")return;throw s}finally{a||r.abort()}}return new t(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller),new t(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new tUe({async start(){r=e[Symbol.asyncIterator]()},async pull(o){try{let{value:i,done:a}=await r.next();if(a)return o.close();let s=n.encode(JSON.stringify(i)+`
`);o.enqueue(s)}catch(i){o.error(i)}},async cancel(){await r.return?.()}})}};aUe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=ogn(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function mVt(t,e,r){if(t=await t,agn(t))return t;if(ign(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=zG(o)?[await o.arrayBuffer()]:[o];return new _fe(i,e,r)}let n=await sgn(t);if(e||(e=lgn(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new _fe(n,e,r)}async function sgn(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(zG(t))e.push(await t.arrayBuffer());else if(cgn(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${ugn(t)}`);return e}function ugn(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function lgn(t){return uUe(t.name)||uUe(t.filename)||uUe(t.path)?.split(/[\\/]/).pop()}var ign,agn,zG,uUe,cgn,lUe,cUe=b(()=>{MG();MG();ign=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",agn=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&zG(t),zG=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function";uUe=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},cgn=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",lUe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody"});async function _Vt(t){let{response:e}=t;if(t.options.stream)return N4("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):hO.fromSSEResponse(e,t.controller);if(e.status===204)return null;if(t.options.__binaryResponse)return e;let r=e.headers.get("content-type");if(r?.includes("application/json")||r?.includes("application/vnd.api+json")){let i=await e.json();return N4("response",e.status,e.url,e.headers,i),vVt(i,e)}let o=await e.text();return N4("response",e.status,e.url,e.headers,o),o}function vVt(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("request-id"),enumerable:!1})}function ggn(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${o}.${i}.${a}`}}}return null}function UG(t){if(!t)return!0;for(let e in t)return!1;return!0}function wVt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function bVt(t,e){for(let r in e){if(!wVt(e,r))continue;let n=r.toLowerCase();if(!n)continue;let o=e[r];o===null?delete t[n]:o!==void 0&&(t[n]=o)}}function N4(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Anthropic:DEBUG:${t}`,...e)}var fgn,pgn,Ofe,Pfe,Tfe,Afe,fUe,sUe,mgn,ky,hgn,hVt,gVt,yVt,ygn,bgn,_gn,vgn,wgn,dUe,xfe,Ife,xgn,xVt,Sgn,Efe,YP=b(()=>{nVt();Cfe();A_();MG();cUe();fgn=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},pgn=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)};Pfe=class t extends Promise{constructor(e,r=_Vt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>vVt(e(await this.parseResponse(r),r),r.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}},Tfe=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=dUe("maxRetries",r),this.timeout=dUe("timeout",n),this.httpAgent=o,this.fetch=i??eUe}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...ygn(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${xgn()}`}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(async o=>{let i=o&&zG(o?.body)?new DataView(await o.body.arrayBuffer()):o?.body instanceof DataView?o.body:o?.body instanceof ArrayBuffer?new DataView(o.body):o&&ArrayBuffer.isView(o?.body)?new DataView(o.body.buffer):o?.body;return{method:e,path:r,...o,body:i}}))}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}calculateContentLength(e){if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length.toString()}else if(ArrayBuffer.isView(e))return e.byteLength.toString();return null}buildRequest(e,{retryCount:r=0}={}){e={...e};let{method:n,path:o,query:i,headers:a={}}=e,s=ArrayBuffer.isView(e.body)||e.__binaryRequest&&typeof e.body=="string"?e.body:lUe(e.body)?e.body.body:e.body?JSON.stringify(e.body,null,2):null,u=this.calculateContentLength(s),l=this.buildURL(o,i);"timeout"in e&&dUe("timeout",e.timeout),e.timeout=e.timeout??this.timeout;let c=e.httpAgent??this.httpAgent??rUe(l),d=e.timeout+1e3;typeof c?.options?.timeout=="number"&&d>(c.options.timeout??0)&&(c.options.timeout=d),this.idempotencyHeader&&n!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),a[this.idempotencyHeader]=e.idempotencyKey);let f=this.buildHeaders({options:e,headers:a,contentLength:u,retryCount:r});return{req:{method:n,...s&&{body:s},headers:f,...c&&{agent:c},signal:e.signal??null},url:l,timeout:e.timeout}}buildHeaders({options:e,headers:r,contentLength:n,retryCount:o}){let i={};n&&(i["content-length"]=n);let a=this.defaultHeaders(e);return bVt(i,a),bVt(i,r),lUe(e.body)&&TF!=="node"&&delete i["content-type"],Efe(a,"x-stainless-retry-count")===void 0&&Efe(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),Efe(a,"x-stainless-timeout")===void 0&&Efe(r,"x-stainless-timeout")===void 0&&e.timeout&&(i["x-stainless-timeout"]=String(e.timeout)),this.validateHeaders(i,r),i}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new qr("Streaming is strongly recommended for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-python#streaming-responses for more details");return 600*1e3}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(r=>[...r])):{...e}:{}}makeStatusError(e,r,n,o){return Zc.generate(e,r,n,o)}request(e,r=null){return new Pfe(this.makeRequest(e,r))}async makeRequest(e,r){let n=await e,o=n.maxRetries??this.maxRetries;r==null&&(r=o),await this.prepareOptions(n);let{req:i,url:a,timeout:s}=this.buildRequest(n,{retryCount:o-r});if(await this.prepareRequest(i,{url:a,options:n}),N4("request",a,n,i.headers),n.signal?.aborted)throw new Gd;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(xfe);if(l instanceof Error){if(n.signal?.aborted)throw new Gd;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new R4:new ER({cause:l})}let c=sUe(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let y=`retrying, ${r} attempts remaining`;return N4(`response (error; ${y})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(y=>xfe(y).message),f=bgn(d),p=f?void 0:d;throw N4(`response (error; ${r?"(error; no more retries left)":"(error; not retryable)"})`,l.status,a,c,p),this.makeStatusError(l.status,f,p,c)}return{response:l,options:n,controller:u}}requestAPIList(e,r){let n=this.makeRequest(r,null);return new fUe(this,n,e)}buildURL(e,r){let n=vgn(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return UG(o)||(r={...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(n.search=this.stringifyQuery(r)),n.toString()}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new qr(`Cannot stringify type ${typeof n}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout(e,r,n,o){let{signal:i,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let s=setTimeout(()=>o.abort(),n),u={signal:o.signal,...a};u.method&&(u.method=u.method.toUpperCase());let l=60*1e3,c=setTimeout(()=>{if(u&&u?.agent?.sockets)for(let d of Object.values(u?.agent?.sockets).flat())d?.setKeepAlive&&d.setKeepAlive(!0,l)},l);return this.fetch.call(void 0,e,u).finally(()=>{clearTimeout(s),clearTimeout(c)})}shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n){let o,i=n?.["retry-after-ms"];if(i){let s=parseFloat(i);Number.isNaN(s)||(o=s)}let a=n?.["retry-after"];if(a&&!o){let s=parseFloat(a);Number.isNaN(s)?o=Date.parse(a)-Date.now():o=s*1e3}if(!(o&&0<=o&&o<60*1e3)){let s=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,s)}return await wgn(o),this.makeRequest(e,r-1)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}getUserAgent(){return`${this.constructor.name}/JS ${PF}`}},Afe=class{constructor(e,r,n,o){Ofe.set(this,void 0),fgn(this,Ofe,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){let e=this.nextPageInfo();if(!e)throw new qr("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let r={...this.options};if("params"in e&&typeof r.query=="object")r.query={...r.query,...e.params};else if("url"in e){let n=[...Object.entries(r.query||{}),...e.url.searchParams.entries()];for(let[o,i]of n)e.url.searchParams.set(o,i);r.query=void 0,r.path=e.url.toString()}return await pgn(this,Ofe,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Ofe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},fUe=class extends Pfe{constructor(e,r,n){super(r,async o=>new n(e,o.response,await _Vt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},sUe=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),mgn={method:!0,path:!0,query:!0,body:!0,headers:!0,maxRetries:!0,stream:!0,timeout:!0,httpAgent:!0,signal:!0,idempotencyKey:!0,__binaryRequest:!0,__binaryResponse:!0,__streamClass:!0},ky=t=>typeof t=="object"&&t!==null&&!UG(t)&&Object.keys(t).every(e=>wVt(mgn,e)),hgn=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":PF,"X-Stainless-OS":gVt(Deno.build.os),"X-Stainless-Arch":hVt(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":PF,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":process.version};if(Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":PF,"X-Stainless-OS":gVt(process.platform),"X-Stainless-Arch":hVt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=ggn();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":PF,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":PF,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};hVt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",gVt=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),ygn=()=>yVt??(yVt=hgn()),bgn=t=>{try{return JSON.parse(t)}catch{return}},_gn=/^[a-z][a-z0-9+.-]*:/i,vgn=t=>_gn.test(t),wgn=t=>new Promise(e=>setTimeout(e,t)),dUe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new qr(`${t} must be an integer`);if(e<0)throw new qr(`${t} must be a positive integer`);return e},xfe=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null)try{return new Error(JSON.stringify(t))}catch{}return new Error(String(t))},Ife=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};xgn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),xVt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",Sgn=t=>typeof t?.get=="function",Efe=(t,e)=>{let r=e.toLowerCase();if(Sgn(t)){let n=e[0]?.toUpperCase()+e.substring(1).replace(/([^\w])(\w)/g,(o,i,a)=>i+a.toUpperCase());for(let o of[e,r,e.toUpperCase(),n]){let i=t.get(o);if(i)return i}}for(let[n,o]of Object.entries(t))if(n.toLowerCase()===r)return Array.isArray(o)?(o.length<=1||console.warn(`Received ${o.length} entries for the ${e} header, using the first entry.`),o[0]):o}});var gO,qG=b(()=>{YP();gO=class extends Afe{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1,this.first_id=n.first_id||null,this.last_id=n.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageParams(){let e=this.nextPageInfo();if(!e)return null;if("params"in e)return e.params;let r=Object.fromEntries(e.url.searchParams);return Object.keys(r).length?r:null}nextPageInfo(){if(this.options.query?.before_id){let r=this.first_id;return r?{params:{before_id:r}}:null}let e=this.last_id;return e?{params:{after_id:e}}:null}}});var SVt=b(()=>{});var Yc,QP=b(()=>{Yc=class{constructor(e){this._client=e}}});var IF,j4,pUe=b(()=>{QP();YP();qG();IF=class extends Yc{retrieve(e,r){return this._client.get(`/v1/models/${e}?beta=true`,r)}list(e={},r){return ky(e)?this.list({},e):this._client.getAPIList("/v1/models?beta=true",j4,{query:e,...r})}},j4=class extends gO{};IF.BetaModelInfosPage=j4});var D4,mUe=b(()=>{A_();iUe();oUe();D4=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new XP;for await(let r of this.iterator)for(let n of e.decode(r))yield JSON.parse(n);for(let r of e.flush())yield JSON.parse(r)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,r){if(!e.body)throw r.abort(),new qr("Attempted to iterate over a response with no body");return new t(BG(e.body),r)}}});var MF,L4,hUe=b(()=>{QP();YP();qG();mUe();A_();MF=class extends Yc{create(e,r){let{betas:n,...o}=e;return this._client.post("/v1/messages/batches?beta=true",{body:o,...r,headers:{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),...r?.headers}})}retrieve(e,r={},n){if(ky(r))return this.retrieve(e,{},r);let{betas:o}=r;return this._client.get(`/v1/messages/batches/${e}?beta=true`,{...n,headers:{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString(),...n?.headers}})}list(e={},r){if(ky(e))return this.list({},e);let{betas:n,...o}=e;return this._client.getAPIList("/v1/messages/batches?beta=true",L4,{query:o,...r,headers:{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),...r?.headers}})}delete(e,r={},n){if(ky(r))return this.delete(e,{},r);let{betas:o}=r;return this._client.delete(`/v1/messages/batches/${e}?beta=true`,{...n,headers:{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString(),...n?.headers}})}cancel(e,r={},n){if(ky(r))return this.cancel(e,{},r);let{betas:o}=r;return this._client.post(`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString(),...n?.headers}})}async results(e,r={},n){if(ky(r))return this.results(e,{},r);let o=await this.retrieve(e);if(!o.results_url)throw new qr(`No batch \`results_url\`; Has it finished processing? ${o.processing_status} - ${o.id}`);let{betas:i}=r;return this._client.get(o.results_url,{...n,headers:{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary",...n?.headers},__binaryResponse:!0})._thenUnwrap((a,s)=>D4.fromResponse(s.response,s.controller))}},L4=class extends gO{};MF.BetaMessageBatchesPage=L4});var Pgn,F4,Tgn,Agn,Mfe,gUe=b(()=>{Pgn=t=>{let e=0,r=[];for(;e<t.length;){let n=t[e];if(n==="\\"){e++;continue}if(n==="{"){r.push({type:"brace",value:"{"}),e++;continue}if(n==="}"){r.push({type:"brace",value:"}"}),e++;continue}if(n==="["){r.push({type:"paren",value:"["}),e++;continue}if(n==="]"){r.push({type:"paren",value:"]"}),e++;continue}if(n===":"){r.push({type:"separator",value:":"}),e++;continue}if(n===","){r.push({type:"delimiter",value:","}),e++;continue}if(n==='"'){let s="",u=!1;for(n=t[++e];n!=='"';){if(e===t.length){u=!0;break}if(n==="\\"){if(e++,e===t.length){u=!0;break}s+=n+t[e],n=t[++e]}else s+=n,n=t[++e]}n=t[++e],u||r.push({type:"string",value:s});continue}if(n&&/\s/.test(n)){e++;continue}let i=/[0-9]/;if(n&&i.test(n)||n==="-"||n==="."){let s="";for(n==="-"&&(s+=n,n=t[++e]);n&&i.test(n)||n===".";)s+=n,n=t[++e];r.push({type:"number",value:s});continue}let a=/[a-z]/i;if(n&&a.test(n)){let s="";for(;n&&a.test(n)&&e!==t.length;)s+=n,n=t[++e];if(s=="true"||s=="false"||s==="null")r.push({type:"name",value:s});else{e++;continue}continue}e++}return r},F4=t=>{if(t.length===0)return t;let e=t[t.length-1];switch(e.type){case"separator":return t=t.slice(0,t.length-1),F4(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),F4(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),F4(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),F4(t);break;case"delimiter":return t=t.slice(0,t.length-1),F4(t);break}return t},Tgn=t=>{let e=[];return t.map(r=>{r.type==="brace"&&(r.value==="{"?e.push("}"):e.splice(e.lastIndexOf("}"),1)),r.type==="paren"&&(r.value==="["?e.push("]"):e.splice(e.lastIndexOf("]"),1))}),e.length>0&&e.reverse().map(r=>{r==="}"?t.push({type:"brace",value:"}"}):r==="]"&&t.push({type:"paren",value:"]"})}),t},Agn=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},Mfe=t=>JSON.parse(Agn(Tgn(F4(Pgn(t)))))});var rp,kn,$y,PR,HG,Rfe,VG,WG,Nfe,KG,eT,GG,jfe,Dfe,k4,Lfe,Ffe,yUe,CVt,bUe,_Ue,vUe,wUe,OVt,EVt,kfe,PVt=b(()=>{A_();Cfe();gUe();rp=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},kn=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},EVt="__json_buf",kfe=class t{constructor(){$y.add(this),this.messages=[],this.receivedMessages=[],PR.set(this,void 0),this.controller=new AbortController,HG.set(this,void 0),Rfe.set(this,()=>{}),VG.set(this,()=>{}),WG.set(this,void 0),Nfe.set(this,()=>{}),KG.set(this,()=>{}),eT.set(this,{}),GG.set(this,!1),jfe.set(this,!1),Dfe.set(this,!1),k4.set(this,!1),Lfe.set(this,void 0),Ffe.set(this,void 0),bUe.set(this,e=>{if(rp(this,jfe,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Gd),e instanceof Gd)return rp(this,Dfe,!0,"f"),this._emit("abort",e);if(e instanceof qr)return this._emit("error",e);if(e instanceof Error){let r=new qr(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new qr(String(e)))}),rp(this,HG,new Promise((e,r)=>{rp(this,Rfe,e,"f"),rp(this,VG,r,"f")}),"f"),rp(this,WG,new Promise((e,r)=>{rp(this,Nfe,e,"f"),rp(this,KG,r,"f")}),"f"),kn(this,HG,"f").catch(()=>{}),kn(this,WG,"f").catch(()=>{})}get response(){return kn(this,Lfe,"f")}get request_id(){return kn(this,Ffe,"f")}async withResponse(){let e=await kn(this,HG,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let o=new t;for(let i of r.messages)o._addMessageParam(i);return o._run(()=>o._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},kn(this,bUe,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),kn(this,$y,"m",_Ue).call(this);let{response:i,data:a}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(i);for await(let s of a)kn(this,$y,"m",vUe).call(this,s);if(a.controller.signal?.aborted)throw new Gd;kn(this,$y,"m",wUe).call(this)}_connected(e){this.ended||(rp(this,Lfe,e,"f"),rp(this,Ffe,e?.headers.get("request-id"),"f"),kn(this,Rfe,"f").call(this,e),this._emit("connect"))}get ended(){return kn(this,GG,"f")}get errored(){return kn(this,jfe,"f")}get aborted(){return kn(this,Dfe,"f")}abort(){this.controller.abort()}on(e,r){return(kn(this,eT,"f")[e]||(kn(this,eT,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=kn(this,eT,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(kn(this,eT,"f")[e]||(kn(this,eT,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{rp(this,k4,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){rp(this,k4,!0,"f"),await kn(this,WG,"f")}get currentMessage(){return kn(this,PR,"f")}async finalMessage(){return await this.done(),kn(this,$y,"m",yUe).call(this)}async finalText(){return await this.done(),kn(this,$y,"m",CVt).call(this)}_emit(e,...r){if(kn(this,GG,"f"))return;e==="end"&&(rp(this,GG,!0,"f"),kn(this,Nfe,"f").call(this));let n=kn(this,eT,"f")[e];if(n&&(kn(this,eT,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!kn(this,k4,"f")&&!n?.length&&Promise.reject(o),kn(this,VG,"f").call(this,o),kn(this,KG,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!kn(this,k4,"f")&&!n?.length&&Promise.reject(o),kn(this,VG,"f").call(this,o),kn(this,KG,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",kn(this,$y,"m",yUe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),kn(this,$y,"m",_Ue).call(this),this._connected(null);let o=hO.fromReadableStream(e,this.controller);for await(let i of o)kn(this,$y,"m",vUe).call(this,i);if(o.controller.signal?.aborted)throw new Gd;kn(this,$y,"m",wUe).call(this)}[(PR=new WeakMap,HG=new WeakMap,Rfe=new WeakMap,VG=new WeakMap,WG=new WeakMap,Nfe=new WeakMap,KG=new WeakMap,eT=new WeakMap,GG=new WeakMap,jfe=new WeakMap,Dfe=new WeakMap,k4=new WeakMap,Lfe=new WeakMap,Ffe=new WeakMap,bUe=new WeakMap,$y=new WeakSet,yUe=function(){if(this.receivedMessages.length===0)throw new qr("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},CVt=function(){if(this.receivedMessages.length===0)throw new qr("stream ended without producing a Message with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new qr("stream ended without producing a content block with type=text");return r.join(" ")},_Ue=function(){this.ended||rp(this,PR,void 0,"f")},vUe=function(r){if(this.ended)return;let n=kn(this,$y,"m",OVt).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let o=n.content.at(-1);switch(r.delta.type){case"text_delta":{o.type==="text"&&this._emit("text",r.delta.text,o.text||"");break}case"citations_delta":{o.type==="text"&&this._emit("citation",r.delta.citation,o.citations??[]);break}case"input_json_delta":{o.type==="tool_use"&&o.input&&this._emit("inputJson",r.delta.partial_json,o.input);break}case"thinking_delta":{o.type==="thinking"&&this._emit("thinking",r.delta.thinking,o.thinking);break}case"signature_delta":{o.type==="thinking"&&this._emit("signature",o.signature);break}default:r.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{rp(this,PR,n,"f");break}case"content_block_start":case"message_delta":break}},wUe=function(){if(this.ended)throw new qr("stream has ended, this shouldn't happen");let r=kn(this,PR,"f");if(!r)throw new qr("request ended without sending any chunks");return rp(this,PR,void 0,"f"),r},OVt=function(r){let n=kn(this,PR,"f");if(r.type==="message_start"){if(n)throw new qr(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new qr(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,n;case"content_block_start":return n.content.push(r.content_block),n;case"content_block_delta":{let o=n.content.at(r.index);switch(r.delta.type){case"text_delta":{o?.type==="text"&&(o.text+=r.delta.text);break}case"citations_delta":{o?.type==="text"&&(o.citations??(o.citations=[]),o.citations.push(r.delta.citation));break}case"input_json_delta":{if(o?.type==="tool_use"){let i=o[EVt]||"";i+=r.delta.partial_json,Object.defineProperty(o,EVt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=Mfe(i))}break}case"thinking_delta":{o?.type==="thinking"&&(o.thinking+=r.delta.thinking);break}case"signature_delta":{o?.type==="thinking"&&(o.signature=r.delta.signature);break}default:r.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new hO(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var TVt,TR,xUe=b(()=>{QP();hUe();hUe();PVt();TVt={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025"},TR=class extends Yc{constructor(){super(...arguments),this.batches=new MF(this._client)}create(e,r){let{betas:n,...o}=e;return o.model in TVt&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${TVt[o.model]}
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),this._client.post("/v1/messages?beta=true",{body:o,timeout:this._client._options.timeout??(o.stream?6e5:this._client._calculateNonstreamingTimeout(o.max_tokens)),...r,headers:{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0,...r?.headers},stream:e.stream??!1})}stream(e,r){return kfe.createMessage(this,e,r)}countTokens(e,r){let{betas:n,...o}=e;return this._client.post("/v1/messages/count_tokens?beta=true",{body:o,...r,headers:{"anthropic-beta":[...n??[],"token-counting-2024-11-01"].toString(),...r?.headers}})}};TR.Batches=MF;TR.BetaMessageBatchesPage=L4});var yO,SUe=b(()=>{QP();pUe();pUe();xUe();xUe();yO=class extends Yc{constructor(){super(...arguments),this.models=new IF(this._client),this.messages=new TR(this._client)}};yO.Models=IF;yO.BetaModelInfosPage=j4;yO.Messages=TR});var RF,CUe=b(()=>{QP();RF=class extends Yc{create(e,r){return this._client.post("/v1/complete",{body:e,timeout:this._client._options.timeout??6e5,...r,stream:e.stream??!1})}}});var NF,$4,OUe=b(()=>{QP();YP();qG();mUe();A_();NF=class extends Yc{create(e,r){return this._client.post("/v1/messages/batches",{body:e,...r})}retrieve(e,r){return this._client.get(`/v1/messages/batches/${e}`,r)}list(e={},r){return ky(e)?this.list({},e):this._client.getAPIList("/v1/messages/batches",$4,{query:e,...r})}delete(e,r){return this._client.delete(`/v1/messages/batches/${e}`,r)}cancel(e,r){return this._client.post(`/v1/messages/batches/${e}/cancel`,r)}async results(e,r){let n=await this.retrieve(e);if(!n.results_url)throw new qr(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...r,headers:{Accept:"application/binary",...r?.headers},__binaryResponse:!0})._thenUnwrap((o,i)=>D4.fromResponse(i.response,i.controller))}},$4=class extends gO{};NF.MessageBatchesPage=$4});var np,$n,By,AR,JG,$fe,ZG,YG,Bfe,XG,tT,QG,zfe,Ufe,B4,qfe,Hfe,EUe,AVt,PUe,TUe,AUe,IUe,IVt,MVt,Vfe,RVt=b(()=>{A_();Cfe();gUe();np=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},$n=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},MVt="__json_buf",Vfe=class t{constructor(){By.add(this),this.messages=[],this.receivedMessages=[],AR.set(this,void 0),this.controller=new AbortController,JG.set(this,void 0),$fe.set(this,()=>{}),ZG.set(this,()=>{}),YG.set(this,void 0),Bfe.set(this,()=>{}),XG.set(this,()=>{}),tT.set(this,{}),QG.set(this,!1),zfe.set(this,!1),Ufe.set(this,!1),B4.set(this,!1),qfe.set(this,void 0),Hfe.set(this,void 0),PUe.set(this,e=>{if(np(this,zfe,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Gd),e instanceof Gd)return np(this,Ufe,!0,"f"),this._emit("abort",e);if(e instanceof qr)return this._emit("error",e);if(e instanceof Error){let r=new qr(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new qr(String(e)))}),np(this,JG,new Promise((e,r)=>{np(this,$fe,e,"f"),np(this,ZG,r,"f")}),"f"),np(this,YG,new Promise((e,r)=>{np(this,Bfe,e,"f"),np(this,XG,r,"f")}),"f"),$n(this,JG,"f").catch(()=>{}),$n(this,YG,"f").catch(()=>{})}get response(){return $n(this,qfe,"f")}get request_id(){return $n(this,Hfe,"f")}async withResponse(){let e=await $n(this,JG,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let o=new t;for(let i of r.messages)o._addMessageParam(i);return o._run(()=>o._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},$n(this,PUe,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),$n(this,By,"m",TUe).call(this);let{response:i,data:a}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(i);for await(let s of a)$n(this,By,"m",AUe).call(this,s);if(a.controller.signal?.aborted)throw new Gd;$n(this,By,"m",IUe).call(this)}_connected(e){this.ended||(np(this,qfe,e,"f"),np(this,Hfe,e?.headers.get("request-id"),"f"),$n(this,$fe,"f").call(this,e),this._emit("connect"))}get ended(){return $n(this,QG,"f")}get errored(){return $n(this,zfe,"f")}get aborted(){return $n(this,Ufe,"f")}abort(){this.controller.abort()}on(e,r){return($n(this,tT,"f")[e]||($n(this,tT,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=$n(this,tT,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return($n(this,tT,"f")[e]||($n(this,tT,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{np(this,B4,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){np(this,B4,!0,"f"),await $n(this,YG,"f")}get currentMessage(){return $n(this,AR,"f")}async finalMessage(){return await this.done(),$n(this,By,"m",EUe).call(this)}async finalText(){return await this.done(),$n(this,By,"m",AVt).call(this)}_emit(e,...r){if($n(this,QG,"f"))return;e==="end"&&(np(this,QG,!0,"f"),$n(this,Bfe,"f").call(this));let n=$n(this,tT,"f")[e];if(n&&($n(this,tT,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!$n(this,B4,"f")&&!n?.length&&Promise.reject(o),$n(this,ZG,"f").call(this,o),$n(this,XG,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!$n(this,B4,"f")&&!n?.length&&Promise.reject(o),$n(this,ZG,"f").call(this,o),$n(this,XG,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",$n(this,By,"m",EUe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),$n(this,By,"m",TUe).call(this),this._connected(null);let o=hO.fromReadableStream(e,this.controller);for await(let i of o)$n(this,By,"m",AUe).call(this,i);if(o.controller.signal?.aborted)throw new Gd;$n(this,By,"m",IUe).call(this)}[(AR=new WeakMap,JG=new WeakMap,$fe=new WeakMap,ZG=new WeakMap,YG=new WeakMap,Bfe=new WeakMap,XG=new WeakMap,tT=new WeakMap,QG=new WeakMap,zfe=new WeakMap,Ufe=new WeakMap,B4=new WeakMap,qfe=new WeakMap,Hfe=new WeakMap,PUe=new WeakMap,By=new WeakSet,EUe=function(){if(this.receivedMessages.length===0)throw new qr("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},AVt=function(){if(this.receivedMessages.length===0)throw new qr("stream ended without producing a Message with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new qr("stream ended without producing a content block with type=text");return r.join(" ")},TUe=function(){this.ended||np(this,AR,void 0,"f")},AUe=function(r){if(this.ended)return;let n=$n(this,By,"m",IVt).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let o=n.content.at(-1);switch(r.delta.type){case"text_delta":{o.type==="text"&&this._emit("text",r.delta.text,o.text||"");break}case"citations_delta":{o.type==="text"&&this._emit("citation",r.delta.citation,o.citations??[]);break}case"input_json_delta":{o.type==="tool_use"&&o.input&&this._emit("inputJson",r.delta.partial_json,o.input);break}case"thinking_delta":{o.type==="thinking"&&this._emit("thinking",r.delta.thinking,o.thinking);break}case"signature_delta":{o.type==="thinking"&&this._emit("signature",o.signature);break}default:r.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{np(this,AR,n,"f");break}case"content_block_start":case"message_delta":break}},IUe=function(){if(this.ended)throw new qr("stream has ended, this shouldn't happen");let r=$n(this,AR,"f");if(!r)throw new qr("request ended without sending any chunks");return np(this,AR,void 0,"f"),r},IVt=function(r){let n=$n(this,AR,"f");if(r.type==="message_start"){if(n)throw new qr(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new qr(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,n;case"content_block_start":return n.content.push(r.content_block),n;case"content_block_delta":{let o=n.content.at(r.index);switch(r.delta.type){case"text_delta":{o?.type==="text"&&(o.text+=r.delta.text);break}case"citations_delta":{o?.type==="text"&&(o.citations??(o.citations=[]),o.citations.push(r.delta.citation));break}case"input_json_delta":{if(o?.type==="tool_use"){let i=o[MVt]||"";i+=r.delta.partial_json,Object.defineProperty(o,MVt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=Mfe(i))}break}case"thinking_delta":{o?.type==="thinking"&&(o.thinking+=r.delta.thinking);break}case"signature_delta":{o?.type==="thinking"&&(o.signature=r.delta.signature);break}default:r.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new hO(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var rT,NVt,MUe=b(()=>{QP();OUe();OUe();RVt();rT=class extends Yc{constructor(){super(...arguments),this.batches=new NF(this._client)}create(e,r){return e.model in NVt&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${NVt[e.model]}
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),this._client.post("/v1/messages",{body:e,timeout:this._client._options.timeout??(e.stream?6e5:this._client._calculateNonstreamingTimeout(e.max_tokens)),...r,stream:e.stream??!1})}stream(e,r){return Vfe.createMessage(this,e,r)}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},NVt={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025"};rT.Batches=NF;rT.MessageBatchesPage=$4});var IR,jF,RUe=b(()=>{QP();YP();qG();IR=class extends Yc{retrieve(e,r){return this._client.get(`/v1/models/${e}`,r)}list(e={},r){return ky(e)?this.list({},e):this._client.getAPIList("/v1/models",jF,{query:e,...r})}},jF=class extends gO{};IR.ModelInfosPage=jF});var jVt=b(()=>{SVt();SUe();CUe();MUe();RUe()});var DVt,Ri,Xmi,Qmi,LVt=b(()=>{YP();A_();cUe();jVt();CUe();RUe();SUe();MUe();Ri=class extends Tfe{constructor({baseURL:e=Ife("ANTHROPIC_BASE_URL"),apiKey:r=Ife("ANTHROPIC_API_KEY")??null,authToken:n=Ife("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){let i={apiKey:r,authToken:n,...o,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&xVt())throw new qr(`It looks like you're running in a browser-like environment.
This is disabled by default, as it risks exposing your secret API credentials to attackers.
If you understand the risks and have appropriate mitigations in place,
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
`);super({baseURL:i.baseURL,timeout:i.timeout??6e5,httpAgent:i.httpAgent,maxRetries:i.maxRetries,fetch:i.fetch}),this.completions=new RF(this),this.messages=new rT(this),this.models=new IR(this),this.beta=new yO(this),this._options=i,this.apiKey=r,this.authToken=n}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01",...this._options.defaultHeaders}}validateHeaders(e,r){if(!(this.apiKey&&e["x-api-key"])&&r["x-api-key"]!==null&&!(this.authToken&&e.authorization)&&r.authorization!==null)throw new Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}authHeaders(e){let r=this.apiKeyAuth(e),n=this.bearerAuth(e);return r!=null&&!UG(r)?r:n!=null&&!UG(n)?n:{}}apiKeyAuth(e){return this.apiKey==null?{}:{"X-Api-Key":this.apiKey}}bearerAuth(e){return this.authToken==null?{}:{Authorization:`Bearer ${this.authToken}`}}};DVt=Ri;Ri.Anthropic=DVt;Ri.HUMAN_PROMPT=`
Human:`;Ri.AI_PROMPT=`
Assistant:`;Ri.DEFAULT_TIMEOUT=6e5;Ri.AnthropicError=qr;Ri.APIError=Zc;Ri.APIConnectionError=ER;Ri.APIConnectionTimeoutError=R4;Ri.APIUserAbortError=Gd;Ri.NotFoundError=DG;Ri.ConflictError=LG;Ri.RateLimitError=kG;Ri.BadRequestError=RG;Ri.AuthenticationError=NG;Ri.InternalServerError=$G;Ri.PermissionDeniedError=jG;Ri.UnprocessableEntityError=FG;Ri.toFile=mVt;Ri.fileFromPath=vfe;Ri.Completions=RF;Ri.Messages=rT;Ri.Models=IR;Ri.ModelInfosPage=jF;Ri.Beta=yO;({HUMAN_PROMPT:Xmi,AI_PROMPT:Qmi}=Ri)});function NUe(t){let e=[];for(let r of t)r.type==="tool_use"&&e.push({name:r.name,args:r.input,id:r.id,type:"tool_call"});return e}var eJ,jUe=b(()=>{$b();eJ=class extends Ij{static lc_name(){return"AnthropicToolsOutputParser"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","anthropic","output_parsers"]}),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnSingle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"zodSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){let r=e;if(typeof e=="string")try{r=JSON.parse(e)}catch(o){throw new Dh(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(o.message)}`,e)}else r=e;if(this.zodSchema===void 0)return r;let n=await this.zodSchema.safeParseAsync(r);if(n.success)return n.data;throw new Dh(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(n.error.errors)}`,JSON.stringify(r,null,2))}async parseResult(e){let r=e.flatMap(i=>{let{message:a}=i;return Array.isArray(a.content)?NUe(a.content)[0]:[]});if(r[0]===void 0)throw new Error("No parseable tool calls provided to AnthropicToolsOutputParser.");let[n]=r;return await this._validateResult(n.args)}}});function FVt(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:typeof t=="string"?{type:"tool",name:t}:t}var kVt=b(()=>{});function $Vt(t){return t==null||typeof t!="object"||!("type"in t)||t.type!=="image"||!("source"in t)||typeof t.source!="object"||t.source==null||!("type"in t.source)?!1:t.source.type==="base64"?!(!("media_type"in t.source)||typeof t.source.media_type!="string"||!("data"in t.source)||typeof t.source.data!="string"):t.source.type==="url"?!(!("url"in t.source)||typeof t.source.url!="string"):!1}var BVt=b(()=>{});function zVt(t){let e=EB({dataUrl:t});if(e)return{type:"base64",media_type:e.mime_type,data:e.data};let r;try{r=new URL(t)}catch{throw new Error([`Malformed image URL: ${JSON.stringify(t)}. Content blocks of type 'image_url' must be a valid http, https, or base64-encoded data URL.`,"Example: data:image/png;base64,/9j/4AAQSk...","Example: https://example.com/image.jpg"].join(`
`))}if(r.protocol==="http:"||r.protocol==="https:")return{type:"url",url:t};throw new Error([`Invalid image URL protocol: ${JSON.stringify(r.protocol)}. Anthropic only supports images as http, https, or base64-encoded data URLs on 'image_url' content blocks.`,"Example: data:image/png;base64,/9j/4AAQSk...","Example: https://example.com/image.jpg"].join(`
`))}function Ngn(t){let e=[];for(let r of t)if(r._getType()==="tool")if(typeof r.content=="string"){let n=e[e.length-1];n?._getType()==="human"&&Array.isArray(n.content)&&"type"in n.content[0]&&n.content[0].type==="tool_result"?n.content.push({type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}):e.push(new eu({content:[{type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}]}))}else e.push(new eu({content:[{type:"tool_result",content:DUe(r.content),tool_use_id:r.tool_call_id}]}));else e.push(r);return e}function UVt(t){if(t.id===void 0)throw new Error('Anthropic requires all tool calls to have an "id".');return{type:"tool_use",id:t.id,name:t.name,input:t.args}}function DUe(t){let e=["tool_use","tool_result","input_json_delta"],r=["text","text_delta"];return typeof t=="string"?t:t.map(o=>{if(jb(o))return L6(o,jgn);let i="cache_control"in o?o.cache_control:void 0;if(o.type==="image_url"){let a;return typeof o.image_url=="string"?a=zVt(o.image_url):a=zVt(o.image_url.url),{type:"image",source:a,...i?{cache_control:i}:{}}}else{if($Vt(o))return o;if(o.type==="document")return{...o,...i?{cache_control:i}:{}};if(o.type==="thinking")return{type:"thinking",thinking:o.thinking,signature:o.signature,...i?{cache_control:i}:{}};if(o.type==="redacted_thinking")return{type:"redacted_thinking",data:o.data,...i?{cache_control:i}:{}};if(r.find(a=>a===o.type)&&"text"in o)return{type:"text",text:o.text,...i?{cache_control:i}:{}};if(e.find(a=>a===o.type)){let a={...o};if("index"in a&&delete a.index,a.type==="input_json_delta"&&(a.type="tool_use"),"input"in a&&typeof a.input=="string")try{a.input=JSON.parse(a.input)}catch{a.input={}}return{...a,...i?{cache_control:i}:{}}}else throw new Error("Unsupported message content format")}})}function Wfe(t){let e=Ngn(t),r;e.length>0&&e[0]._getType()==="system"&&(r=t[0].content);let o=(r!==void 0?e.slice(1):e).map(i=>{let a;if(i._getType()==="human")a="user";else if(i._getType()==="ai")a="assistant";else if(i._getType()==="tool")a="user";else throw i._getType()==="system"?new Error("System messages are only permitted as the first passed message."):new Error(`Message type "${i._getType()}" is not supported.`);if(Ki(i)&&i.tool_calls?.length){if(typeof i.content=="string")return i.content===""?{role:a,content:i.tool_calls.map(UVt)}:{role:a,content:[{type:"text",text:i.content},...i.tool_calls.map(UVt)]};{let{content:s}=i;return!i.tool_calls.every(l=>s.find(c=>(c.type==="tool_use"||c.type==="input_json_delta")&&c.id===l.id))&&console.warn('The "tool_calls" field on a message is only respected if content is a string.'),{role:a,content:DUe(i.content)}}}else return{role:a,content:DUe(i.content)}});return{messages:Dgn(o),system:r}}function Dgn(t){if(!t||t.length<=1)return t;let e=[],r=t[0],n=i=>typeof i=="string"?[{type:"text",text:i}]:i,o=i=>i.role!=="user"||typeof i.content=="string"?!1:Array.isArray(i.content)&&i.content.every(a=>a.type==="tool_result");for(let i=1;i<t.length;i+=1){let a=t[i];o(r)&&o(a)?r={...r,content:[...n(r.content),...n(a.content)]}:(e.push(r),r=a)}return e.push(r),e}var jgn,LUe=b(()=>{Bs();BVt();jgn={providerName:"anthropic",fromStandardTextBlock(t){return{type:"text",text:t.text,..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}},fromStandardImageBlock(t){if(t.source_type==="url"){let e=EB({dataUrl:t.url,asTypedArray:!1});return e?{type:"image",source:{type:"base64",data:e.data,media_type:e.mime_type},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}:{type:"image",source:{type:"url",url:t.url,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}}else{if(t.source_type==="base64")return{type:"image",source:{type:"base64",data:t.data,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}};throw new Error(`Unsupported image source type: ${t.source_type}`)}},fromStandardFileBlock(t){let e=(t.mime_type??"").split(";")[0];if(t.source_type==="url"){if(e==="application/pdf"||e==="")return{type:"document",source:{type:"url",url:t.url,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file url source: ${t.mime_type}`)}else if(t.source_type==="text"){if(e==="text/plain"||e==="")return{type:"document",source:{type:"text",data:t.text,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file text source: ${t.mime_type}`)}else if(t.source_type==="base64"){if(e==="application/pdf"||e==="")return{type:"document",source:{type:"base64",data:t.data,media_type:"application/pdf"},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};if(["image/jpeg","image/png","image/gif","image/webp"].includes(e))return{type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:t.data,media_type:e}}]},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file base64 source: ${t.mime_type}`)}else throw new Error(`Unsupported file source type: ${t.source_type}`)}}});function qVt(t,e){if(t.type==="message_start"){let{content:r,usage:n,...o}=t.message,i={};for(let[c,d]of Object.entries(o))d!=null&&(i[c]=d);let{input_tokens:a,output_tokens:s,...u}=n??{},l={input_tokens:a,output_tokens:s,total_tokens:a+s,input_token_details:{cache_creation:u.cache_creation_input_tokens,cache_read:u.cache_read_input_tokens}};return{chunk:new vr({content:e.coerceContentToString?"":[],additional_kwargs:i,usage_metadata:e.streamUsage?l:void 0,response_metadata:{usage:{...u}},id:t.message.id})}}else if(t.type==="message_delta"){let r={input_tokens:0,output_tokens:t.usage.output_tokens,total_tokens:t.usage.output_tokens,input_token_details:{cache_creation:t.usage.cache_creation_input_tokens,cache_read:t.usage.cache_read_input_tokens}};return{chunk:new vr({content:e.coerceContentToString?"":[],additional_kwargs:{...t.delta},usage_metadata:e.streamUsage?r:void 0})}}else if(t.type==="content_block_start"&&["tool_use","document"].includes(t.content_block.type)){let r=t.content_block,n;return r.type==="tool_use"?n=[{id:r.id,index:t.index,name:r.name,args:""}]:n=[],{chunk:new vr({content:e.coerceContentToString?"":[{index:t.index,...t.content_block,input:""}],additional_kwargs:{},tool_call_chunks:n})}}else if(t.type==="content_block_delta"&&["text_delta","citations_delta","thinking_delta","signature_delta"].includes(t.delta.type)){if(e.coerceContentToString&&"text"in t.delta)return{chunk:new vr({content:t.delta.text})};{let r=t.delta;return"citation"in r&&(r.citations=[r.citation],delete r.citation),r.type==="thinking_delta"||r.type==="signature_delta"?{chunk:new vr({content:[{index:t.index,...r,type:"thinking"}]})}:{chunk:new vr({content:[{index:t.index,...r,type:"text"}]})}}}else{if(t.type==="content_block_delta"&&t.delta.type==="input_json_delta")return{chunk:new vr({content:e.coerceContentToString?"":[{index:t.index,input:t.delta.partial_json,type:t.delta.type}],additional_kwargs:{},tool_call_chunks:[{index:t.index,args:t.delta.partial_json}]})};if(t.type==="content_block_start"&&t.content_block.type==="text"){let r=t.content_block?.text;if(r!==void 0)return{chunk:new vr({content:e.coerceContentToString?r:[{index:t.index,...t.content_block}],additional_kwargs:{}})}}else{if(t.type==="content_block_start"&&t.content_block.type==="redacted_thinking")return{chunk:new vr({content:e.coerceContentToString?"":[{index:t.index,...t.content_block}]})};if(t.type==="content_block_start"&&t.content_block.type==="thinking"){let r=t.content_block.thinking;return{chunk:new vr({content:e.coerceContentToString?r:[{index:t.index,...t.content_block}]})}}}}return null}function HVt(t,e){let r=e.usage,n=r!=null?{input_tokens:r.input_tokens??0,output_tokens:r.output_tokens??0,total_tokens:(r.input_tokens??0)+(r.output_tokens??0),input_token_details:{cache_creation:r.cache_creation_input_tokens,cache_read:r.cache_read_input_tokens}}:void 0;if(t.length===1&&t[0].type==="text")return[{text:t[0].text,message:new Ln({content:t[0].text,additional_kwargs:e,usage_metadata:n,response_metadata:e,id:e.id})}];{let o=NUe(t);return[{text:"",message:new Ln({content:t,additional_kwargs:e,tool_calls:o,usage_metadata:n,response_metadata:e,id:e.id})}]}}var VVt=b(()=>{Bs();jUe()});function Kfe(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function FUe(t){let e;return t.status===400&&t.message.includes("tool")?e=Kfe(t,"INVALID_TOOL_RESULTS"):t.status===401?e=Kfe(t,"MODEL_AUTHENTICATION"):t.status===404?e=Kfe(t,"MODEL_NOT_FOUND"):t.status===429?e=Kfe(t,"MODEL_RATE_LIMIT"):e=t,e}var WVt=b(()=>{});function Lgn(t){return!!(t.tools&&t.tools.length>0)}function Fgn(t){for(let e of t.messages??[])if(typeof e.content!="string"){for(let r of e.content??[])if(typeof r=="object"&&r!=null&&r.type==="document"&&typeof r.citations=="object"&&r.citations.enabled)return!0}return!1}function kgn(t){return!!(t.thinking&&t.thinking.type==="enabled")}function $gn(t){return"input_schema"in t}function Bgn(t){if(typeof t.content=="string")return t.content;if(Array.isArray(t.content)&&t.content.length>=1&&"input"in t.content[0])return typeof t.content[0].input=="string"?t.content[0].input:JSON.stringify(t.content[0].input);if(Array.isArray(t.content)&&t.content.length>=1&&"text"in t.content[0])return t.content[0].text}var kUe,Gfe,KVt=b(()=>{LVt();Bs();Qf();no();GC();ag();Gg();Im();kL();sg();jUe();kVt();LUe();VVt();WVt();kUe=class extends Au{static lc_name(){return"ChatAnthropic"}get lc_secrets(){return{anthropicApiKey:"ANTHROPIC_API_KEY",apiKey:"ANTHROPIC_API_KEY"}}get lc_aliases(){return{modelName:"model"}}constructor(e){if(super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"anthropicApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"topK",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:2048}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:"claude-2.1"}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"claude-2.1"}),Object.defineProperty(this,"invocationKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clientOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"thinking",{enumerable:!0,configurable:!0,writable:!0,value:{type:"disabled"}}),Object.defineProperty(this,"batchClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streamingClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"createClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.anthropicApiKey=e?.apiKey??e?.anthropicApiKey??lt("ANTHROPIC_API_KEY"),!this.anthropicApiKey&&!e?.createClient)throw new Error("Anthropic API key not found");this.clientOptions=e?.clientOptions??{},this.apiKey=this.anthropicApiKey,this.apiUrl=e?.anthropicApiUrl,this.modelName=e?.model??e?.modelName??this.model,this.model=this.modelName,this.invocationKwargs=e?.invocationKwargs??{},this.temperature=e?.temperature??this.temperature,this.topK=e?.topK??this.topK,this.topP=e?.topP??this.topP,this.maxTokens=e?.maxTokensToSample??e?.maxTokens??this.maxTokens,this.stopSequences=e?.stopSequences??this.stopSequences,this.streaming=e?.streaming??!1,this.streamUsage=e?.streamUsage??this.streamUsage,this.thinking=e?.thinking??this.thinking,this.createClient=e?.createClient??(r=>new Ri(r))}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"anthropic",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}formatStructuredToolToAnthropic(e){if(!(!e||!e.length))return e.map(r=>{if($gn(r))return r;if($d(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(Kc(r))return{name:r.name,description:r.description,input_schema:Av(r.schema)?ss(r.schema):r.schema};throw new Error(`Unknown tool type passed to ChatAnthropic: ${JSON.stringify(r,null,2)}`)})}bindTools(e,r){return this.bind({tools:this.formatStructuredToolToAnthropic(e),...r})}invocationParams(e){let r=FVt(e?.tool_choice);if(this.thinking.type==="enabled"){if(this.topK!==-1)throw new Error("topK is not supported when thinking is enabled");if(this.topP!==-1)throw new Error("topP is not supported when thinking is enabled");if(this.temperature!==1)throw new Error("temperature is not supported when thinking is enabled");return{model:this.model,stop_sequences:e?.stop??this.stopSequences,stream:this.streaming,max_tokens:this.maxTokens,tools:this.formatStructuredToolToAnthropic(e?.tools),tool_choice:r,thinking:this.thinking,...this.invocationKwargs}}return{model:this.model,temperature:this.temperature,top_k:this.topK,top_p:this.topP,stop_sequences:e?.stop??this.stopSequences,stream:this.streaming,max_tokens:this.maxTokens,tools:this.formatStructuredToolToAnthropic(e?.tools),tool_choice:r,thinking:this.thinking,...this.invocationKwargs}}_identifyingParams(){return{model_name:this.model,...this.invocationParams()}}identifyingParams(){return{model_name:this.model,...this.invocationParams()}}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=Wfe(e),a={...o,...i,stream:!0},s=!Lgn(a)&&!Fgn(a)&&!kgn(a),u=await this.createStreamWithRetry(a,{headers:r.headers});for await(let l of u){if(r.signal?.aborted)throw u.controller.abort(),new Error("AbortError: User aborted the request.");let c=this.streamUsage??r.streamUsage,d=qVt(l,{streamUsage:c,coerceContentToString:s});if(!d)continue;let{chunk:f}=d,p=Bgn(f),m=new co({message:new vr({content:f.content,additional_kwargs:f.additional_kwargs,tool_call_chunks:f.tool_call_chunks,usage_metadata:c?f.usage_metadata:void 0,response_metadata:f.response_metadata,id:f.id}),text:p??""});yield m,await n?.handleLLMNewToken(p??"",void 0,void 0,void 0,void 0,{chunk:m})}}async _generateNonStreaming(e,r,n){let o=await this.completionWithRetry({...r,stream:!1,...Wfe(e)},n),{content:i,...a}=o,s=HVt(i,a),{role:u,type:l,...c}=a;return{generations:s,llmOutput:c}}async _generate(e,r,n){if(this.stopSequences&&r.stop)throw new Error('"stopSequence" parameter found in input and default params');let o=this.invocationParams(r);if(o.stream){let i,a=this._streamResponseChunks(e,r,n);for await(let s of a)i===void 0?i=s:i=i.concat(s);if(i===void 0)throw new Error("No chunks returned from Anthropic API.");return{generations:[{text:i.text,message:i.message}]}}else return this._generateNonStreaming(e,o,{signal:r.signal,headers:r.headers})}async createStreamWithRetry(e,r){if(!this.streamingClient){let o=this.apiUrl?{baseURL:this.apiUrl}:void 0;this.streamingClient=this.createClient({dangerouslyAllowBrowser:!0,...this.clientOptions,...o,apiKey:this.apiKey,maxRetries:0})}let n=async()=>{try{return await this.streamingClient.messages.create({...e,...this.invocationKwargs,stream:!0},r)}catch(o){throw FUe(o)}};return this.caller.call(n)}async completionWithRetry(e,r){if(!this.batchClient){let o=this.apiUrl?{baseURL:this.apiUrl}:void 0;this.batchClient=this.createClient({dangerouslyAllowBrowser:!0,...this.clientOptions,...o,apiKey:this.apiKey,maxRetries:0})}let n=async()=>{try{return await this.batchClient.messages.create({...e,...this.invocationKwargs},r)}catch(o){throw FUe(o)}};return this.caller.callWithOptions({signal:r.signal??void 0},n)}_llmType(){return"anthropic"}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw;if(i==="jsonMode")throw new Error('Anthropic only supports "functionCalling" as a method.');let s=o??"extract",u,l;if(Av(n)){let m=ss(n);l=[{name:s,description:m.description??"A function available to call.",input_schema:m}],u=new eJ({returnSingle:!0,keyName:s,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.description=="string"&&typeof n.input_schema=="object"&&n.input_schema!=null?(m=n,s=n.name):m={name:s,description:n.description??"",input_schema:n},l=[m],u=new eJ({returnSingle:!0,keyName:s})}let c;if(this.thinking?.type==="enabled"){let m="Anthropic structured output relies on forced tool calling, which is not supported when `thinking` is enabled. This method will raise OutputParserException if tool calls are not generated. Consider disabling `thinking` or adjust your prompt to ensure the tool is called.";console.warn(m),c=this.bind({tools:l});let h=y=>{if(!y.tool_calls||y.tool_calls.length===0)throw new Error(m);return y};c=c.pipe(h)}else c=this.bind({tools:l,tool_choice:{type:"tool",name:s}});if(!a)return c.pipe(u).withConfig({runName:"ChatAnthropicStructuredOutput"});let d=Fo.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=Fo.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return Fi.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},Gfe=class extends kUe{}});var GVt=b(()=>{LUe()});var JVt=b(()=>{KVt();GVt()});var ZVt=b(()=>{JVt()});var Jfe,Zfe,YVt,$Ue=b(()=>{Jfe="RFC3986",Zfe={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:t=>String(t)},YVt="RFC1738"});function QVt(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function zUe(t,e){if(zgn(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var zgn,bO,BUe,XVt,e6t=b(()=>{$Ue();zgn=Array.isArray,bO=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),BUe=1024,XVt=(t,e,r,n,o)=>{if(t.length===0)return t;let i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(s){return"%26%23"+parseInt(s.slice(2),16)+"%3B"});let a="";for(let s=0;s<i.length;s+=BUe){let u=i.length>=BUe?i.slice(s,s+BUe):i,l=[];for(let c=0;c<u.length;++c){let d=u.charCodeAt(c);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===YVt&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=bO[d];continue}if(d<2048){l[l.length]=bO[192|d>>6]+bO[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=bO[224|d>>12]+bO[128|d>>6&63]+bO[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=bO[240|d>>18]+bO[128|d>>12&63]+bO[128|d>>6&63]+bO[128|d&63]}a+=l.join("")}return a}});function Vgn(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function n6t(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,y,g){let _=t,w=g,S=0,C=!1;for(;(w=w.get(UUe))!==void 0&&!C;){let N=w.get(t);if(S+=1,typeof N<"u"){if(N===S)throw new RangeError("Cyclic object value");C=!0}typeof w.get(UUe)>"u"&&(S=0)}if(typeof l=="function"?_=l(e,_):_ instanceof Date?_=f?.(_):r==="comma"&&_O(_)&&(_=zUe(_,function(N){return N instanceof Date?f?.(N):N})),_===null){if(i)return u&&!h?u(e,Cc.encoder,y,"key",p):e;_=""}if(Vgn(_)||QVt(_)){if(u){let N=h?e:u(e,Cc.encoder,y,"key",p);return[m?.(N)+"="+m?.(u(_,Cc.encoder,y,"value",p))]}return[m?.(e)+"="+m?.(String(_))]}let E=[];if(typeof _>"u")return E;let P;if(r==="comma"&&_O(_))h&&u&&(_=zUe(_,u)),P=[{value:_.length>0?_.join(",")||null:void 0}];else if(_O(l))P=l;else{let N=Object.keys(_);P=c?N.sort(c):N}let T=s?String(e).replace(/\./g,"%2E"):String(e),I=n&&_O(_)&&_.length===1?T+"[]":T;if(o&&_O(_)&&_.length===0)return I+"[]";for(let N=0;N<P.length;++N){let M=P[N],D=typeof M=="object"&&typeof M.value<"u"?M.value:_[M];if(a&&D===null)continue;let k=d&&s?M.replace(/\./g,"%2E"):M,L=_O(_)?typeof r=="function"?r(I,k):I:I+(d?"."+k:"["+k+"]");g.set(t,S);let H=new WeakMap;H.set(UUe,g),r6t(E,n6t(D,L,r,n,o,i,a,s,r==="comma"&&h&&_O(_)?null:u,l,c,d,f,p,m,h,y,H))}return E}function Wgn(t=Cc){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||Cc.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=Jfe;if(typeof t.format<"u"){if(!Ugn.call(Zfe,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=Zfe[r],o=Cc.filter;(typeof t.filter=="function"||_O(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in t6t?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=Cc.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:Cc.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Cc.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Cc.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Cc.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Cc.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Cc.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Cc.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Cc.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Cc.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Cc.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Cc.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Cc.strictNullHandling}}function qUe(t,e={}){let r=t,n=Wgn(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):_O(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=t6t[n.arrayFormat],u=s==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);let l=new WeakMap;for(let f=0;f<o.length;++f){let p=o[f];n.skipNulls&&r[p]===null||r6t(a,n6t(r[p],p,s,u,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}let c=a.join(n.delimiter),d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),c.length>0?d+c:""}var Ugn,t6t,_O,qgn,r6t,Hgn,Cc,UUe,o6t=b(()=>{e6t();$Ue();Ugn=Object.prototype.hasOwnProperty,t6t={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},_O=Array.isArray,qgn=Array.prototype.push,r6t=function(t,e){qgn.apply(t,_O(e)?e:[e])},Hgn=Date.prototype.toISOString,Cc={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:XVt,encodeValuesOnly:!1,format:Jfe,formatter:Zfe[Jfe],indices:!1,serializeDate(t){return Hgn.call(t)},skipNulls:!1,strictNullHandling:!1};UUe={}});var i6t=b(()=>{o6t()});var DF,a6t=b(()=>{DF="4.95.1"});function u6t(t,e={auto:!1}){if(s6t)throw new Error(`you must \`import 'openai/shims/${t.kind}'\` before importing anything else from openai`);if(LF)throw new Error(`can't \`import 'openai/shims/${t.kind}'\` after \`import 'openai/shims/${LF}'\``);s6t=e.auto,LF=t.kind,HUe=t.fetch,Ggn=t.Request,Jgn=t.Response,Zgn=t.Headers,VUe=t.FormData,Ygn=t.Blob,Yfe=t.File,WUe=t.ReadableStream,KUe=t.getMultipartRequestOptions,GUe=t.getDefaultAgent,Xfe=t.fileFromPath,JUe=t.isFsReadStream}var s6t,LF,HUe,Ggn,Jgn,Zgn,VUe,Ygn,Yfe,WUe,KUe,GUe,Xfe,JUe,ZUe=b(()=>{s6t=!1});var Qfe,l6t=b(()=>{Qfe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function c6t({manuallyImported:t}={}){let e=t?"You may need to use polyfills":"Add one of these imports before your first `import \u2026 from 'openai'`:\n- `import 'openai/shims/node'` (if you're running on Node)\n- `import 'openai/shims/web'` (otherwise)\n",r,n,o,i;try{r=fetch,n=Request,o=Response,i=Headers}catch(a){throw new Error(`this environment is missing the following Web Fetch API type: ${a.message}. ${e}`)}return{kind:"web",fetch:r,Request:n,Response:o,Headers:i,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`)}},getMultipartRequestOptions:async(a,s)=>({...s,body:new Qfe(a)}),getDefaultAgent:a=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/openai/openai-node#file-uploads")},isFsReadStream:a=>!1}}var d6t=b(()=>{l6t()});var f6t=b(()=>{d6t()});var YUe,tJ=b(()=>{ZUe();f6t();ZUe();YUe=()=>{LF||u6t(c6t(),{auto:!0})};YUe()});var qt,ju,Ra,nT,pg,z4,U4,q4,H4,V4,W4,K4,G4,J4,Z4,uh=b(()=>{go();qt=class extends Error{},ju=class t extends qt{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.request_id=o?.["x-request-id"],this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new nT({message:n,cause:epe(r)});let i=r?.error;return e===400?new z4(e,i,n,o):e===401?new U4(e,i,n,o):e===403?new q4(e,i,n,o):e===404?new H4(e,i,n,o):e===409?new V4(e,i,n,o):e===422?new W4(e,i,n,o):e===429?new K4(e,i,n,o):e>=500?new G4(e,i,n,o):new t(e,i,n,o)}},Ra=class extends ju{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},nT=class extends ju{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},pg=class extends nT{constructor({message:e}={}){super({message:e??"Request timed out."})}},z4=class extends ju{},U4=class extends ju{},q4=class extends ju{},H4=class extends ju{},V4=class extends ju{},W4=class extends ju{},K4=class extends ju{},G4=class extends ju{},J4=class extends qt{constructor(){super("Could not parse response content as the length limit was reached")}},Z4=class extends qt{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}});function tyn(t,e){for(let o=e??0;o<t.length;o++){if(t[o]===10)return{preceding:o,index:o+1,carriage:!1};if(t[o]===13)return{preceding:o,index:o+1,carriage:!0}}return null}function p6t(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var tpe,FF,mg,kF,m6t=b(()=>{uh();tpe=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},FF=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},kF=class{constructor(){mg.set(this,void 0),this.buffer=new Uint8Array,tpe(this,mg,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?new TextEncoder().encode(e):e,n=new Uint8Array(this.buffer.length+r.length);n.set(this.buffer),n.set(r,this.buffer.length),this.buffer=n;let o=[],i;for(;(i=tyn(this.buffer,FF(this,mg,"f")))!=null;){if(i.carriage&&FF(this,mg,"f")==null){tpe(this,mg,i.index,"f");continue}if(FF(this,mg,"f")!=null&&(i.index!==FF(this,mg,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,FF(this,mg,"f")-1))),this.buffer=this.buffer.slice(FF(this,mg,"f")),tpe(this,mg,null,"f");continue}let a=FF(this,mg,"f")!==null?i.preceding-1:i.preceding,s=this.decodeText(this.buffer.slice(0,a));o.push(s),this.buffer=this.buffer.slice(i.index),tpe(this,mg,null,"f")}return o}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new qt(`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new qt(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new qt("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
`):[]}};mg=new WeakMap;kF.NEWLINE_CHARS=new Set([`
`,"\r"]);kF.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function XUe(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var h6t=b(()=>{});async function*ryn(t,e){if(!t.body)throw e.abort(),new qt("Attempted to iterate over a response with no body");let r=new QUe,n=new kF,o=XUe(t.body);for await(let i of nyn(o))for(let a of n.decode(i)){let s=r.decode(a);s&&(yield s)}for(let i of n.flush()){let a=r.decode(i);a&&(yield a)}}async function*nyn(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?new TextEncoder().encode(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=p6t(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function oyn(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var vO,QUe,rpe=b(()=>{tJ();uh();m6t();h6t();go();uh();vO=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;async function*o(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let i=!1;try{for await(let a of ryn(e,r))if(!i){if(a.data.startsWith("[DONE]")){i=!0;continue}if(a.event===null||a.event.startsWith("response.")||a.event.startsWith("transcript.")){let s;try{s=JSON.parse(a.data)}catch(u){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),u}if(s&&s.error)throw new ju(void 0,s.error,void 0,eqe(e.headers));yield s}else{let s;try{s=JSON.parse(a.data)}catch(u){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),u}if(a.event=="error")throw new ju(void 0,s.error,s.message,void 0);yield{event:a.event,data:s}}}i=!0}catch(a){if(a instanceof Error&&a.name==="AbortError")return;throw a}finally{i||r.abort()}}return new t(o,r)}static fromReadableStream(e,r){let n=!1;async function*o(){let a=new kF,s=XUe(e);for await(let u of s)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let s of o())a||s&&(yield JSON.parse(s));a=!0}catch(s){if(s instanceof Error&&s.name==="AbortError")return;throw s}finally{a||r.abort()}}return new t(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller),new t(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new WUe({async start(){r=e[Symbol.asyncIterator]()},async pull(o){try{let{value:i,done:a}=await r.next();if(a)return o.close();let s=n.encode(JSON.stringify(i)+`
`);o.enqueue(s)}catch(i){o.error(i)}},async cancel(){await r.return?.()}})}};QUe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=oyn(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function nqe(t,e,r){if(t=await t,y6t(t))return t;if(g6t(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=rJ(o)?[await o.arrayBuffer()]:[o];return new Yfe(i,e,r)}let n=await ayn(t);if(e||(e=uyn(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new Yfe(n,e,r)}async function ayn(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(rJ(t))e.push(await t.arrayBuffer());else if(lyn(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${syn(t)}`);return e}function syn(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function uyn(t){return tqe(t.name)||tqe(t.filename)||tqe(t.path)?.split(/[\\/]/).pop()}var g6t,y6t,rJ,iyn,tqe,lyn,oqe,zy,b6t,rqe,npe=b(()=>{tJ();tJ();g6t=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",y6t=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&rJ(t),rJ=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",iyn=t=>y6t(t)||g6t(t)||JUe(t);tqe=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},lyn=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",oqe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",zy=async t=>{let e=await b6t(t.body);return KUe(e,t)},b6t=async t=>{let e=new VUe;return await Promise.all(Object.entries(t||{}).map(([r,n])=>rqe(e,r,n))),e},rqe=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(iyn(r)){let n=await nqe(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>rqe(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>rqe(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}}});async function C6t(t){let{response:e}=t;if(t.options.stream)return oT("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):vO.fromSSEResponse(e,t.controller);if(e.status===204)return null;if(t.options.__binaryResponse)return e;let n=e.headers.get("content-type")?.split(";")[0]?.trim();if(n?.includes("application/json")||n?.endsWith("+json")){let a=await e.json();return oT("response",e.status,e.url,e.headers,a),O6t(a,e)}let i=await e.text();return oT("response",e.status,e.url,e.headers,i),i}function O6t(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}function hyn(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${o}.${i}.${a}`}}}return null}function E6t(t){if(!t)return!0;for(let e in t)return!1;return!0}function P6t(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function x6t(t,e){for(let r in e){if(!P6t(e,r))continue;let n=r.toLowerCase();if(!n)continue;let o=e[r];o===null?delete t[n]:o!==void 0&&(t[n]=o)}}function oT(t,...e){if(typeof process<"u"&&process?.env?.DEBUG==="true"){let r=e.map(n=>{if(!n)return n;if(n.headers){let i={...n,headers:{...n.headers}};for(let a in n.headers)S6t.has(a.toLowerCase())&&(i.headers[a]="REDACTED");return i}let o=null;for(let i in n)S6t.has(i.toLowerCase())&&(o??(o={...n}),o[i]="REDACTED");return o??n});console.log(`OpenAI:DEBUG:${t}`,...r)}}function iJ(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var dyn,fyn,ope,ape,spe,nJ,aqe,eqe,pyn,pn,myn,_6t,v6t,w6t,gyn,yyn,byn,_yn,iT,iqe,epe,oJ,S6t,vyn,T6t,wyn,ipe,A6t,go=b(()=>{a6t();rpe();uh();tJ();npe();npe();dyn=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},fyn=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)};YUe();ape=class t extends Promise{constructor(e,r=C6t){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>O6t(e(await this.parseResponse(r),r),r.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}},spe=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=iqe("maxRetries",r),this.timeout=iqe("timeout",n),this.httpAgent=o,this.fetch=i??HUe}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...gyn(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${vyn()}`}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(async o=>{let i=o&&rJ(o?.body)?new DataView(await o.body.arrayBuffer()):o?.body instanceof DataView?o.body:o?.body instanceof ArrayBuffer?new DataView(o.body):o&&ArrayBuffer.isView(o?.body)?new DataView(o.body.buffer):o?.body;return{method:e,path:r,...o,body:i}}))}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}calculateContentLength(e){if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length.toString()}else if(ArrayBuffer.isView(e))return e.byteLength.toString();return null}buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:a,headers:s={}}=n,u=ArrayBuffer.isView(n.body)||n.__binaryRequest&&typeof n.body=="string"?n.body:oqe(n.body)?n.body.body:n.body?JSON.stringify(n.body,null,2):null,l=this.calculateContentLength(u),c=this.buildURL(i,a);"timeout"in n&&iqe("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let d=n.httpAgent??this.httpAgent??GUe(c),f=n.timeout+1e3;typeof d?.options?.timeout=="number"&&f>(d.options.timeout??0)&&(d.options.timeout=f),this.idempotencyHeader&&o!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=e.idempotencyKey);let p=this.buildHeaders({options:n,headers:s,contentLength:l,retryCount:r});return{req:{method:o,...u&&{body:u},headers:p,...d&&{agent:d},signal:n.signal??null},url:c,timeout:n.timeout}}buildHeaders({options:e,headers:r,contentLength:n,retryCount:o}){let i={};n&&(i["content-length"]=n);let a=this.defaultHeaders(e);return x6t(i,a),x6t(i,r),oqe(e.body)&&LF!=="node"&&delete i["content-type"],ipe(a,"x-stainless-retry-count")===void 0&&ipe(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),ipe(a,"x-stainless-timeout")===void 0&&ipe(r,"x-stainless-timeout")===void 0&&e.timeout&&(i["x-stainless-timeout"]=String(Math.trunc(e.timeout/1e3))),this.validateHeaders(i,r),i}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(r=>[...r])):{...e}:{}}makeStatusError(e,r,n,o){return ju.generate(e,r,n,o)}request(e,r=null){return new ape(this.makeRequest(e,r))}async makeRequest(e,r){let n=await e,o=n.maxRetries??this.maxRetries;r==null&&(r=o),await this.prepareOptions(n);let{req:i,url:a,timeout:s}=this.buildRequest(n,{retryCount:o-r});if(await this.prepareRequest(i,{url:a,options:n}),oT("request",a,n,i.headers),n.signal?.aborted)throw new Ra;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(epe);if(l instanceof Error){if(n.signal?.aborted)throw new Ra;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new pg:new nT({cause:l})}let c=eqe(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let y=`retrying, ${r} attempts remaining`;return oT(`response (error; ${y})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(y=>epe(y).message),f=yyn(d),p=f?void 0:d;throw oT(`response (error; ${r?"(error; no more retries left)":"(error; not retryable)"})`,l.status,a,c,p),this.makeStatusError(l.status,f,p,c)}return{response:l,options:n,controller:u}}requestAPIList(e,r){let n=this.makeRequest(r,null);return new aqe(this,n,e)}buildURL(e,r){let n=_yn(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return E6t(o)||(r={...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(n.search=this.stringifyQuery(r)),n.toString()}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new qt(`Cannot stringify type ${typeof n}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout(e,r,n,o){let{signal:i,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let s=setTimeout(()=>o.abort(),n),u={signal:o.signal,...a};return u.method&&(u.method=u.method.toUpperCase()),this.fetch.call(void 0,e,u).finally(()=>{clearTimeout(s)})}shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n){let o,i=n?.["retry-after-ms"];if(i){let s=parseFloat(i);Number.isNaN(s)||(o=s)}let a=n?.["retry-after"];if(a&&!o){let s=parseFloat(a);Number.isNaN(s)?o=Date.parse(a)-Date.now():o=s*1e3}if(!(o&&0<=o&&o<60*1e3)){let s=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,s)}return await iT(o),this.makeRequest(e,r-1)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}getUserAgent(){return`${this.constructor.name}/JS ${DF}`}},nJ=class{constructor(e,r,n,o){ope.set(this,void 0),dyn(this,ope,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){let e=this.nextPageInfo();if(!e)throw new qt("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let r={...this.options};if("params"in e&&typeof r.query=="object")r.query={...r.query,...e.params};else if("url"in e){let n=[...Object.entries(r.query||{}),...e.url.searchParams.entries()];for(let[o,i]of n)e.url.searchParams.set(o,i);r.query=void 0,r.path=e.url.toString()}return await fyn(this,ope,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(ope=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},aqe=class extends ape{constructor(e,r,n){super(r,async o=>new n(e,o.response,await C6t(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},eqe=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),pyn={method:!0,path:!0,query:!0,body:!0,headers:!0,maxRetries:!0,stream:!0,timeout:!0,httpAgent:!0,signal:!0,idempotencyKey:!0,__metadata:!0,__binaryRequest:!0,__binaryResponse:!0,__streamClass:!0},pn=t=>typeof t=="object"&&t!==null&&!E6t(t)&&Object.keys(t).every(e=>P6t(pyn,e)),myn=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":DF,"X-Stainless-OS":v6t(Deno.build.os),"X-Stainless-Arch":_6t(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":DF,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":process.version};if(Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":DF,"X-Stainless-OS":v6t(process.platform),"X-Stainless-Arch":_6t(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=hyn();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":DF,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":DF,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};_6t=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",v6t=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),gyn=()=>w6t??(w6t=myn()),yyn=t=>{try{return JSON.parse(t)}catch{return}},byn=/^[a-z][a-z0-9+.-]*:/i,_yn=t=>byn.test(t),iT=t=>new Promise(e=>setTimeout(e,t)),iqe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new qt(`${t} must be an integer`);if(e<0)throw new qt(`${t} must be a positive integer`);return e},epe=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null)try{return new Error(JSON.stringify(t))}catch{}return new Error(t)},oJ=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};S6t=new Set(["authorization","api-key"]);vyn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),T6t=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",wyn=t=>typeof t?.get=="function",ipe=(t,e)=>{let r=e.toLowerCase();if(wyn(t)){let n=e[0]?.toUpperCase()+e.substring(1).replace(/([^\w])(\w)/g,(o,i,a)=>i+a.toUpperCase());for(let o of[e,r,e.toUpperCase(),n]){let i=t.get(o);if(i)return i}}for(let[n,o]of Object.entries(t))if(n.toLowerCase()===r)return Array.isArray(o)?(o.length<=1||console.warn(`Received ${o.length} entries for the ${e} header, using the first entry.`),o[0]):o},A6t=t=>{if(typeof Buffer<"u"){let e=Buffer.from(t,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=e.charCodeAt(o);return Array.from(new Float32Array(n.buffer))}}});var wO,Po,Xc=b(()=>{go();wO=class extends nJ{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageParams(){return null}nextPageInfo(){return null}},Po=class extends nJ{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageParams(){let e=this.nextPageInfo();if(!e)return null;if("params"in e)return e.params;let r=Object.fromEntries(e.url.searchParams);return Object.keys(r).length?r:null}nextPageInfo(){let e=this.getPaginatedItems();if(!e.length)return null;let r=e[e.length-1]?.id;return r?{params:{after:r}}:null}}});var nt,xn=b(()=>{nt=class{constructor(e){this._client=e}}});var Y4,sqe=b(()=>{xn();go();aJ();Y4=class extends nt{list(e,r={},n){return pn(r)?this.list(e,{},r):this._client.getAPIList(`/chat/completions/${e}/messages`,upe,{query:r,...n})}}});var RR,NR,upe,aJ=b(()=>{xn();go();sqe();sqe();Xc();RR=class extends nt{constructor(){super(...arguments),this.messages=new Y4(this._client)}create(e,r){return this._client.post("/chat/completions",{body:e,...r,stream:e.stream??!1})}retrieve(e,r){return this._client.get(`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return pn(e)?this.list({},e):this._client.getAPIList("/chat/completions",NR,{query:e,...r})}del(e,r){return this._client.delete(`/chat/completions/${e}`,r)}},NR=class extends Po{},upe=class extends Po{};RR.ChatCompletionsPage=NR;RR.Messages=Y4});var aT,uqe=b(()=>{xn();aJ();aJ();aT=class extends nt{constructor(){super(...arguments),this.completions=new RR(this._client)}};aT.Completions=RR;aT.ChatCompletionsPage=NR});var I6t=b(()=>{uqe()});var M6t=b(()=>{});var X4,lqe=b(()=>{xn();X4=class extends nt{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}}});var Q4,cqe=b(()=>{xn();go();Q4=class extends nt{create(e,r){return this._client.post("/audio/transcriptions",zy({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}}))}}});var e3,dqe=b(()=>{xn();go();e3=class extends nt{create(e,r){return this._client.post("/audio/translations",zy({body:e,...r,__metadata:{model:e.model}}))}}});var xO,fqe=b(()=>{xn();lqe();lqe();cqe();cqe();dqe();dqe();xO=class extends nt{constructor(){super(...arguments),this.transcriptions=new Q4(this._client),this.translations=new e3(this._client),this.speech=new X4(this._client)}};xO.Transcriptions=Q4;xO.Translations=e3;xO.Speech=X4});var jR,$F,pqe=b(()=>{xn();go();Xc();jR=class extends nt{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(`/batches/${e}`,r)}list(e={},r){return pn(e)?this.list({},e):this._client.getAPIList("/batches",$F,{query:e,...r})}cancel(e,r){return this._client.post(`/batches/${e}/cancel`,r)}},$F=class extends Po{};jR.BatchesPage=$F});var BF,t3,mqe=b(()=>{xn();go();Xc();BF=class extends nt{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(e,r){return this._client.get(`/assistants/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(e,r,n){return this._client.post(`/assistants/${e}`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}list(e={},r){return pn(e)?this.list({},e):this._client.getAPIList("/assistants",t3,{query:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}del(e,r){return this._client.delete(`/assistants/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}},t3=class extends Po{};BF.AssistantsPage=t3});function hqe(t){return typeof t.parse=="function"}var R6t=b(()=>{});var DR,gqe,yqe,bqe=b(()=>{DR=t=>t?.role==="assistant",gqe=t=>t?.role==="function",yqe=t=>t?.role==="tool"});var I_,ws,_qe,lpe,cpe,sJ,uJ,dpe,lJ,sT,cJ,fpe,ppe,r3,N6t,LR,mpe=b(()=>{uh();I_=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},ws=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},LR=class{constructor(){_qe.add(this),this.controller=new AbortController,lpe.set(this,void 0),cpe.set(this,()=>{}),sJ.set(this,()=>{}),uJ.set(this,void 0),dpe.set(this,()=>{}),lJ.set(this,()=>{}),sT.set(this,{}),cJ.set(this,!1),fpe.set(this,!1),ppe.set(this,!1),r3.set(this,!1),I_(this,lpe,new Promise((e,r)=>{I_(this,cpe,e,"f"),I_(this,sJ,r,"f")}),"f"),I_(this,uJ,new Promise((e,r)=>{I_(this,dpe,e,"f"),I_(this,lJ,r,"f")}),"f"),ws(this,lpe,"f").catch(()=>{}),ws(this,uJ,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},ws(this,_qe,"m",N6t).bind(this))},0)}_connected(){this.ended||(ws(this,cpe,"f").call(this),this._emit("connect"))}get ended(){return ws(this,cJ,"f")}get errored(){return ws(this,fpe,"f")}get aborted(){return ws(this,ppe,"f")}abort(){this.controller.abort()}on(e,r){return(ws(this,sT,"f")[e]||(ws(this,sT,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=ws(this,sT,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(ws(this,sT,"f")[e]||(ws(this,sT,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{I_(this,r3,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){I_(this,r3,!0,"f"),await ws(this,uJ,"f")}_emit(e,...r){if(ws(this,cJ,"f"))return;e==="end"&&(I_(this,cJ,!0,"f"),ws(this,dpe,"f").call(this));let n=ws(this,sT,"f")[e];if(n&&(ws(this,sT,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!ws(this,r3,"f")&&!n?.length&&Promise.reject(o),ws(this,sJ,"f").call(this,o),ws(this,lJ,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!ws(this,r3,"f")&&!n?.length&&Promise.reject(o),ws(this,sJ,"f").call(this,o),ws(this,lJ,"f").call(this,o),this._emit("end")}}_emitFinal(){}};lpe=new WeakMap,cpe=new WeakMap,sJ=new WeakMap,uJ=new WeakMap,dpe=new WeakMap,lJ=new WeakMap,sT=new WeakMap,cJ=new WeakMap,fpe=new WeakMap,ppe=new WeakMap,r3=new WeakMap,_qe=new WeakSet,N6t=function(e){if(I_(this,fpe,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Ra),e instanceof Ra)return I_(this,ppe,!0,"f"),this._emit("abort",e);if(e instanceof qt)return this._emit("error",e);if(e instanceof Error){let r=new qt(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new qt(String(e)))}});function j6t(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function dJ(t){return t?.$brand==="auto-parseable-response-format"}function D6t(t,{parser:e,callback:r}){let n={...t};return Object.defineProperties(n,{$brand:{value:"auto-parseable-tool",enumerable:!1},$parseRaw:{value:e,enumerable:!1},$callback:{value:r,enumerable:!1}}),n}function zF(t){return t?.$brand==="auto-parseable-tool"}function L6t(t,e){return!e||!vqe(e)?{...t,choices:t.choices.map(r=>({...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:fJ(t,e)}function fJ(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new J4;if(n.finish_reason==="content_filter")throw new Z4;return{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>Ayn(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?Tyn(e,n.message.content):null}}});return{...t,choices:r}}function Tyn(t,e){return t.response_format?.type!=="json_schema"?null:t.response_format?.type==="json_schema"?"$parseRaw"in t.response_format?t.response_format.$parseRaw(e):JSON.parse(e):null}function Ayn(t,e){let r=t.tools?.find(n=>n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:zF(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function F6t(t,e){if(!t)return!1;let r=t.tools?.find(n=>n.function?.name===e.function.name);return zF(r)||r?.function.strict||!1}function vqe(t){return dJ(t.response_format)?!0:t.tools?.some(e=>zF(e)||e.type==="function"&&e.function.strict===!0)??!1}function k6t(t){for(let e of t??[]){if(e.type!=="function")throw new qt(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new qt(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var n3=b(()=>{uh()});var lh,op,wqe,hpe,xqe,Sqe,Cqe,B6t,Oqe,$6t,o3,Eqe=b(()=>{uh();R6t();bqe();mpe();n3();lh=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},$6t=10,o3=class extends LR{constructor(){super(...arguments),op.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);let r=e.choices[0]?.message;return r&&this._addMessage(r),e}_addMessage(e,r=!0){if("content"in e||(e.content=null),this.messages.push(e),r){if(this._emit("message",e),(gqe(e)||yqe(e))&&e.content)this._emit("functionCallResult",e.content);else if(DR(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(DR(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new qt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),lh(this,op,"m",wqe).call(this)}async finalMessage(){return await this.done(),lh(this,op,"m",hpe).call(this)}async finalFunctionCall(){return await this.done(),lh(this,op,"m",xqe).call(this)}async finalFunctionCallResult(){return await this.done(),lh(this,op,"m",Sqe).call(this)}async totalUsage(){return await this.done(),lh(this,op,"m",Cqe).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=lh(this,op,"m",hpe).call(this);r&&this._emit("finalMessage",r);let n=lh(this,op,"m",wqe).call(this);n&&this._emit("finalContent",n);let o=lh(this,op,"m",xqe).call(this);o&&this._emit("finalFunctionCall",o);let i=lh(this,op,"m",Sqe).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",lh(this,op,"m",Cqe).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),lh(this,op,"m",B6t).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(fJ(i,r))}async _runChatCompletion(e,r,n){for(let o of r.messages)this._addMessage(o,!1);return await this._createChatCompletion(e,r,n)}async _runFunctions(e,r,n){let o="function",{function_call:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i?.name,{maxChatCompletions:l=$6t}=n||{},c={};for(let f of r.functions)c[f.name||f.function.name]=f;let d=r.functions.map(f=>({name:f.name||f.function.name,parameters:f.parameters,description:f.description}));for(let f of r.messages)this._addMessage(f,!1);for(let f=0;f<l;++f){let m=(await this._createChatCompletion(e,{...s,function_call:i,functions:d,messages:[...this.messages]},n)).choices[0]?.message;if(!m)throw new qt("missing message in ChatCompletion response");if(!m.function_call)return;let{name:h,arguments:y}=m.function_call,g=c[h];if(g){if(u&&u!==h){let C=`Invalid function_call: ${JSON.stringify(h)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,name:h,content:C});continue}}else{let C=`Invalid function_call: ${JSON.stringify(h)}. Available options are: ${d.map(E=>JSON.stringify(E.name)).join(", ")}. Please try again`;this._addMessage({role:o,name:h,content:C});continue}let _;try{_=hqe(g)?await g.parse(y):y}catch(C){this._addMessage({role:o,name:h,content:C instanceof Error?C.message:String(C)});continue}let w=await g.function(_,this),S=lh(this,op,"m",Oqe).call(this,w);if(this._addMessage({role:o,name:h,content:S}),u)return}}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i?.function?.name,{maxChatCompletions:l=$6t}=n||{},c=r.tools.map(p=>{if(zF(p)){if(!p.$callback)throw new qt("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of c)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?c.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;p<l;++p){let h=(await this._createChatCompletion(e,{...s,tool_choice:i,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!h)throw new qt("missing message in ChatCompletion response");if(!h.tool_calls?.length)return;for(let y of h.tool_calls){if(y.type!=="function")continue;let g=y.id,{name:_,arguments:w}=y.function,S=d[_];if(S){if(u&&u!==_){let T=`Invalid tool_call: ${JSON.stringify(_)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:g,content:T});continue}}else{let T=`Invalid tool_call: ${JSON.stringify(_)}. Available options are: ${Object.keys(d).map(I=>JSON.stringify(I)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:T});continue}let C;try{C=hqe(S)?await S.parse(w):w}catch(T){let I=T instanceof Error?T.message:String(T);this._addMessage({role:o,tool_call_id:g,content:I});continue}let E=await S.function(C,this),P=lh(this,op,"m",Oqe).call(this,E);if(this._addMessage({role:o,tool_call_id:g,content:P}),u)return}}}};op=new WeakSet,wqe=function(){return lh(this,op,"m",hpe).call(this).content??null},hpe=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(DR(r)){let{function_call:n,...o}=r,i={...o,content:r.content??null,refusal:r.refusal??null};return n&&(i.function_call=n),i}}throw new qt("stream ended without producing a ChatCompletionMessage with role=assistant")},xqe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(DR(r)&&r?.function_call)return r.function_call;if(DR(r)&&r?.tool_calls?.length)return r.tool_calls.at(-1)?.function}},Sqe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(gqe(r)&&r.content!=null||yqe(r)&&r.content!=null&&typeof r.content=="string"&&this.messages.some(n=>n.role==="assistant"&&n.tool_calls?.some(o=>o.type==="function"&&o.id===r.tool_call_id)))return r.content}},Cqe=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:r}of this._chatCompletions)r&&(e.completion_tokens+=r.completion_tokens,e.prompt_tokens+=r.prompt_tokens,e.total_tokens+=r.total_tokens);return e},B6t=function(e){if(e.n!=null&&e.n>1)throw new qt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},Oqe=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var pJ,z6t=b(()=>{Eqe();bqe();pJ=class t extends o3{static runFunctions(e,r,n){let o=new t,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return o._run(()=>o._runFunctions(e,r,i)),o}static runTools(e,r,n){let o=new t,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}_addMessage(e,r=!0){super._addMessage(e,r),DR(e)&&e.content&&this._emit("content",e.content)}}});function Iyn(t,e=Qc.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return Myn(t.trim(),e)}var Qc,Pqe,Tqe,Myn,Aqe,U6t=b(()=>{Qc={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511},Pqe=class extends Error{},Tqe=class extends Error{};Myn=(t,e)=>{let r=t.length,n=0,o=f=>{throw new Pqe(`${f} at position ${n}`)},i=f=>{throw new Tqe(`${f} at position ${n}`)},a=()=>(d(),n>=r&&o("Unexpected end of input"),t[n]==='"'?s():t[n]==="{"?u():t[n]==="["?l():t.substring(n,n+4)==="null"||Qc.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Qc.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Qc.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Qc.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Qc.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||Qc.NAN&e&&r-n<3&&"NaN".startsWith(t.substring(n))?(n+=3,NaN):c()),s=()=>{let f=n,p=!1;for(n++;n<r&&(t[n]!=='"'||p&&t[n-1]==="\\");)p=t[n]==="\\"?!p:!1,n++;if(t.charAt(n)=='"')try{return JSON.parse(t.substring(f,++n-Number(p)))}catch(m){i(String(m))}else if(Qc.STR&e)try{return JSON.parse(t.substring(f,n-Number(p))+'"')}catch{return JSON.parse(t.substring(f,t.lastIndexOf("\\"))+'"')}o("Unterminated string literal")},u=()=>{n++,d();let f={};try{for(;t[n]!=="}";){if(d(),n>=r&&Qc.OBJ&e)return f;let p=s();d(),n++;try{let m=a();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(Qc.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Qc.OBJ&e)return f;o("Expected '}' at end of object")}return n++,f},l=()=>{n++;let f=[];try{for(;t[n]!=="]";)f.push(a()),d(),t[n]===","&&n++}catch{if(Qc.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&Qc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Qc.NUM&e)try{return t[t.length-1]==="."?JSON.parse(t.substring(0,t.lastIndexOf("."))):JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch{}i(String(p))}}let f=n;for(t[n]==="-"&&n++;t[n]&&!",]}".includes(t[n]);)n++;n==r&&!(Qc.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Qc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;n<r&&`
\r `.includes(t[n]);)n++};return a()},Aqe=t=>Iyn(t,Qc.ALL^Qc.NUM)});function Ryn(t,e){let{id:r,choices:n,created:o,model:i,system_fingerprint:a,...s}=t,u={...s,id:r,choices:n.map(({message:l,finish_reason:c,index:d,logprobs:f,...p})=>{if(!c)throw new qt(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:y,...g}=l,_=l.role;if(!_)throw new qt(`missing role for choice ${d}`);if(h){let{arguments:w,name:S}=h;if(w==null)throw new qt(`missing function_call.arguments for choice ${d}`);if(!S)throw new qt(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:w,name:S},role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return y?{...p,index:d,finish_reason:c,logprobs:f,message:{...g,role:_,content:m,refusal:l.refusal??null,tool_calls:y.map((w,S)=>{let{function:C,type:E,id:P,...T}=w,{arguments:I,name:N,...M}=C||{};if(P==null)throw new qt(`missing choices[${d}].tool_calls[${S}].id
${bpe(t)}`);if(E==null)throw new qt(`missing choices[${d}].tool_calls[${S}].type
${bpe(t)}`);if(N==null)throw new qt(`missing choices[${d}].tool_calls[${S}].function.name
${bpe(t)}`);if(I==null)throw new qt(`missing choices[${d}].tool_calls[${S}].function.arguments
${bpe(t)}`);return{...T,id:P,type:E,function:{...M,name:N,arguments:I}}})}}:{...p,message:{...g,content:m,role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return L6t(u,e)}function bpe(t){return JSON.stringify(t)}var i3,Yi,Oc,uT,a3,FR,Iqe,gpe,Mqe,Rqe,Nqe,ype,jqe,q6t,s3,Dqe=b(()=>{uh();Eqe();rpe();n3();U6t();i3=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},Yi=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},s3=class t extends o3{constructor(e){super(),Oc.add(this),uT.set(this,void 0),a3.set(this,void 0),FR.set(this,void 0),i3(this,uT,e,"f"),i3(this,a3,[],"f")}get currentChatCompletionSnapshot(){return Yi(this,FR,"f")}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createChatCompletion(e,r,n){let o=new t(r);return o._run(()=>o._runChatCompletion(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(e,r,n){super._createChatCompletion;let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Yi(this,Oc,"m",Iqe).call(this);let i=await e.chat.completions.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)Yi(this,Oc,"m",Mqe).call(this,a);if(i.controller.signal?.aborted)throw new Ra;return this._addChatCompletion(Yi(this,Oc,"m",ype).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),Yi(this,Oc,"m",Iqe).call(this),this._connected();let o=vO.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(Yi(this,Oc,"m",ype).call(this)),Yi(this,Oc,"m",Mqe).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new Ra;return this._addChatCompletion(Yi(this,Oc,"m",ype).call(this))}[(uT=new WeakMap,a3=new WeakMap,FR=new WeakMap,Oc=new WeakSet,Iqe=function(){this.ended||i3(this,FR,void 0,"f")},gpe=function(r){let n=Yi(this,a3,"f")[r.index];return n||(n={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},Yi(this,a3,"f")[r.index]=n,n)},Mqe=function(r){if(this.ended)return;let n=Yi(this,Oc,"m",q6t).call(this,r);this._emit("chunk",r,n);for(let o of r.choices){let i=n.choices[o.index];o.delta.content!=null&&i.message?.role==="assistant"&&i.message?.content&&(this._emit("content",o.delta.content,i.message.content),this._emit("content.delta",{delta:o.delta.content,snapshot:i.message.content,parsed:i.message.parsed})),o.delta.refusal!=null&&i.message?.role==="assistant"&&i.message?.refusal&&this._emit("refusal.delta",{delta:o.delta.refusal,snapshot:i.message.refusal}),o.logprobs?.content!=null&&i.message?.role==="assistant"&&this._emit("logprobs.content.delta",{content:o.logprobs?.content,snapshot:i.logprobs?.content??[]}),o.logprobs?.refusal!=null&&i.message?.role==="assistant"&&this._emit("logprobs.refusal.delta",{refusal:o.logprobs?.refusal,snapshot:i.logprobs?.refusal??[]});let a=Yi(this,Oc,"m",gpe).call(this,i);i.finish_reason&&(Yi(this,Oc,"m",Nqe).call(this,i),a.current_tool_call_index!=null&&Yi(this,Oc,"m",Rqe).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(Yi(this,Oc,"m",Nqe).call(this,i),a.current_tool_call_index!=null&&Yi(this,Oc,"m",Rqe).call(this,i,a.current_tool_call_index)),a.current_tool_call_index=s.index;for(let s of o.delta.tool_calls??[]){let u=i.message.tool_calls?.[s.index];u?.type&&(u?.type==="function"?this._emit("tool_calls.function.arguments.delta",{name:u.function?.name,index:s.index,arguments:u.function.arguments,parsed_arguments:u.function.parsed_arguments,arguments_delta:s.function?.arguments??""}):(u?.type,void 0))}}},Rqe=function(r,n){if(Yi(this,Oc,"m",gpe).call(this,r).done_tool_calls.has(n))return;let i=r.message.tool_calls?.[n];if(!i)throw new Error("no tool call snapshot");if(!i.type)throw new Error("tool call snapshot missing `type`");if(i.type==="function"){let a=Yi(this,uT,"f")?.tools?.find(s=>s.type==="function"&&s.function.name===i.function.name);this._emit("tool_calls.function.arguments.done",{name:i.function.name,index:n,arguments:i.function.arguments,parsed_arguments:zF(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Nqe=function(r){let n=Yi(this,Oc,"m",gpe).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=Yi(this,Oc,"m",jqe).call(this);this._emit("content.done",{content:r.message.content,parsed:o?o.$parseRaw(r.message.content):null})}r.message.refusal&&!n.refusal_done&&(n.refusal_done=!0,this._emit("refusal.done",{refusal:r.message.refusal})),r.logprobs?.content&&!n.logprobs_content_done&&(n.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:r.logprobs.content})),r.logprobs?.refusal&&!n.logprobs_refusal_done&&(n.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:r.logprobs.refusal}))},ype=function(){if(this.ended)throw new qt("stream has ended, this shouldn't happen");let r=Yi(this,FR,"f");if(!r)throw new qt("request ended without sending any chunks");return i3(this,FR,void 0,"f"),i3(this,a3,[],"f"),Ryn(r,Yi(this,uT,"f"))},jqe=function(){let r=Yi(this,uT,"f")?.response_format;return dJ(r)?r:null},q6t=function(r){var n,o,i,a;let s=Yi(this,FR,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=i3(this,FR,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=s.choices[f];if(h||(h=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:E,refusal:P,...T}=p;Object.assign(h.logprobs,T),E&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...E)),P&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...P))}if(d&&(h.finish_reason=d,Yi(this,uT,"f")&&vqe(Yi(this,uT,"f")))){if(d==="length")throw new J4;if(d==="content_filter")throw new Z4}if(Object.assign(h,m),!c)continue;let{content:y,refusal:g,function_call:_,role:w,tool_calls:S,...C}=c;if(Object.assign(h.message,C),g&&(h.message.refusal=(h.message.refusal||"")+g),w&&(h.message.role=w),_&&(h.message.function_call?(_.name&&(h.message.function_call.name=_.name),_.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=_.arguments)):h.message.function_call=_),y&&(h.message.content=(h.message.content||"")+y,!h.message.refusal&&Yi(this,Oc,"m",jqe).call(this)&&(h.message.parsed=Aqe(h.message.content))),S){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:E,id:P,type:T,function:I,...N}of S){let M=(a=h.message.tool_calls)[E]??(a[E]={});Object.assign(M,N),P&&(M.id=P),T&&(M.type=T),I&&(M.function??(M.function={name:I.name??"",arguments:""})),I?.name&&(M.function.name=I.name),I?.arguments&&(M.function.arguments+=I.arguments,F6t(Yi(this,uT,"f"),M)&&(M.function.parsed_arguments=Aqe(M.function.arguments)))}}}return s},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("chunk",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new vO(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var mJ,H6t=b(()=>{Dqe();mJ=class t extends s3{static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static runFunctions(e,r,n){let o=new t(null),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return o._run(()=>o._runFunctions(e,r,i)),o}static runTools(e,r,n){let o=new t(r),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}}});var hJ,V6t=b(()=>{xn();z6t();H6t();Dqe();n3();hJ=class extends nt{parse(e,r){return k6t(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>fJ(n,e))}runFunctions(e,r){return e.stream?mJ.runFunctions(this._client,e,r):pJ.runFunctions(this._client,e,r)}runTools(e,r){return e.stream?mJ.runTools(this._client,e,r):pJ.runTools(this._client,e,r)}stream(e,r){return s3.createChatCompletion(this._client,e,r)}}});var u3,W6t=b(()=>{xn();V6t();u3=class extends nt{constructor(){super(...arguments),this.completions=new hJ(this._client)}};(function(t){t.Completions=hJ})(u3||(u3={}))});var l3,Lqe=b(()=>{xn();l3=class extends nt{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var c3,Fqe=b(()=>{xn();c3=class extends nt{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var kR,kqe=b(()=>{xn();Lqe();Lqe();Fqe();Fqe();kR=class extends nt{constructor(){super(...arguments),this.sessions=new l3(this._client),this.transcriptionSessions=new c3(this._client)}};kR.Sessions=l3;kR.TranscriptionSessions=c3});var tr,hg,Jd,$qe,SO,_pe,M_,qF,d3,UF,xpe,gg,vpe,wpe,bJ,gJ,yJ,K6t,G6t,J6t,Z6t,Y6t,X6t,Q6t,CO,Bqe=b(()=>{go();rpe();uh();mpe();tr=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},hg=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},CO=class t extends LR{constructor(){super(...arguments),Jd.add(this),$qe.set(this,[]),SO.set(this,{}),_pe.set(this,{}),M_.set(this,void 0),qF.set(this,void 0),d3.set(this,void 0),UF.set(this,void 0),xpe.set(this,void 0),gg.set(this,void 0),vpe.set(this,void 0),wpe.set(this,void 0),bJ.set(this,void 0)}[($qe=new WeakMap,SO=new WeakMap,_pe=new WeakMap,M_=new WeakMap,qF=new WeakMap,d3=new WeakMap,UF=new WeakMap,xpe=new WeakMap,gg=new WeakMap,vpe=new WeakMap,wpe=new WeakMap,bJ=new WeakMap,Jd=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=vO.fromReadableStream(e,this.controller);for await(let i of o)tr(this,Jd,"m",gJ).call(this,i);if(o.controller.signal?.aborted)throw new Ra;return this._addRun(tr(this,Jd,"m",yJ).call(this))}toReadableStream(){return new vO(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o,i){let a=new t;return a._run(()=>a._runToolAssistantStream(e,r,n,o,{...i,headers:{...i?.headers,"X-Stainless-Helper-Method":"stream"}})),a}async _createToolAssistantStream(e,r,n,o,i){let a=i?.signal;a&&(a.aborted&&this.controller.abort(),a.addEventListener("abort",()=>this.controller.abort()));let s={...o,stream:!0},u=await e.submitToolOutputs(r,n,s,{...i,signal:this.controller.signal});this._connected();for await(let l of u)tr(this,Jd,"m",gJ).call(this,l);if(u.controller.signal?.aborted)throw new Ra;return this._addRun(tr(this,Jd,"m",yJ).call(this))}static createThreadAssistantStream(e,r,n){let o=new t;return o._run(()=>o._threadAssistantStream(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(e,r,n,o){let i=new t;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return tr(this,vpe,"f")}currentRun(){return tr(this,wpe,"f")}currentMessageSnapshot(){return tr(this,M_,"f")}currentRunStepSnapshot(){return tr(this,bJ,"f")}async finalRunSteps(){return await this.done(),Object.values(tr(this,SO,"f"))}async finalMessages(){return await this.done(),Object.values(tr(this,_pe,"f"))}async finalRun(){if(await this.done(),!tr(this,qF,"f"))throw Error("Final run was not received.");return tr(this,qF,"f")}async _createThreadAssistantStream(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));let i={...r,stream:!0},a=await e.createAndRun(i,{...n,signal:this.controller.signal});this._connected();for await(let s of a)tr(this,Jd,"m",gJ).call(this,s);if(a.controller.signal?.aborted)throw new Ra;return this._addRun(tr(this,Jd,"m",yJ).call(this))}async _createAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let a={...n,stream:!0},s=await e.create(r,a,{...o,signal:this.controller.signal});this._connected();for await(let u of s)tr(this,Jd,"m",gJ).call(this,u);if(s.controller.signal?.aborted)throw new Ra;return this._addRun(tr(this,Jd,"m",yJ).call(this))}static accumulateDelta(e,r){for(let[n,o]of Object.entries(r)){if(!e.hasOwnProperty(n)){e[n]=o;continue}let i=e[n];if(i==null){e[n]=o;continue}if(n==="index"||n==="type"){e[n]=o;continue}if(typeof i=="string"&&typeof o=="string")i+=o;else if(typeof i=="number"&&typeof o=="number")i+=o;else if(iJ(i)&&iJ(o))i=this.accumulateDelta(i,o);else if(Array.isArray(i)&&Array.isArray(o)){if(i.every(a=>typeof a=="string"||typeof a=="number")){i.push(...o);continue}for(let a of o){if(!iJ(a))throw new Error(`Expected array delta entry to be an object but got: ${a}`);let s=a.index;if(s==null)throw console.error(a),new Error("Expected array delta entry to have an `index` property");if(typeof s!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${s}`);let u=i[s];u==null?i.push(a):i[s]=this.accumulateDelta(u,a)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${o}, accValue: ${i}`);e[n]=i}return e}_addRun(e){return e}async _threadAssistantStream(e,r,n){return await this._createThreadAssistantStream(r,e,n)}async _runAssistantStream(e,r,n,o){return await this._createAssistantStream(r,e,n,o)}async _runToolAssistantStream(e,r,n,o,i){return await this._createToolAssistantStream(n,e,r,o,i)}};gJ=function(e){if(!this.ended)switch(hg(this,vpe,e,"f"),tr(this,Jd,"m",J6t).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":tr(this,Jd,"m",Q6t).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":tr(this,Jd,"m",G6t).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":tr(this,Jd,"m",K6t).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},yJ=function(){if(this.ended)throw new qt("stream has ended, this shouldn't happen");if(!tr(this,qF,"f"))throw Error("Final run has not been received");return tr(this,qF,"f")},K6t=function(e){let[r,n]=tr(this,Jd,"m",Y6t).call(this,e,tr(this,M_,"f"));hg(this,M_,r,"f"),tr(this,_pe,"f")[r.id]=r;for(let o of n){let i=r.content[o.index];i?.type=="text"&&this._emit("textCreated",i.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,r),e.data.delta.content)for(let o of e.data.delta.content){if(o.type=="text"&&o.text){let i=o.text,a=r.content[o.index];if(a&&a.type=="text")this._emit("textDelta",i,a.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(o.index!=tr(this,d3,"f")){if(tr(this,UF,"f"))switch(tr(this,UF,"f").type){case"text":this._emit("textDone",tr(this,UF,"f").text,tr(this,M_,"f"));break;case"image_file":this._emit("imageFileDone",tr(this,UF,"f").image_file,tr(this,M_,"f"));break}hg(this,d3,o.index,"f")}hg(this,UF,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(tr(this,d3,"f")!==void 0){let o=e.data.content[tr(this,d3,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,tr(this,M_,"f"));break;case"text":this._emit("textDone",o.text,tr(this,M_,"f"));break}}tr(this,M_,"f")&&this._emit("messageDone",e.data),hg(this,M_,void 0,"f")}},G6t=function(e){let r=tr(this,Jd,"m",Z6t).call(this,e);switch(hg(this,bJ,r,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let n=e.data.delta;if(n.step_details&&n.step_details.type=="tool_calls"&&n.step_details.tool_calls&&r.step_details.type=="tool_calls")for(let i of n.step_details.tool_calls)i.index==tr(this,xpe,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(tr(this,gg,"f")&&this._emit("toolCallDone",tr(this,gg,"f")),hg(this,xpe,i.index,"f"),hg(this,gg,r.step_details.tool_calls[i.index],"f"),tr(this,gg,"f")&&this._emit("toolCallCreated",tr(this,gg,"f")));this._emit("runStepDelta",e.data.delta,r);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":hg(this,bJ,void 0,"f"),e.data.step_details.type=="tool_calls"&&tr(this,gg,"f")&&(this._emit("toolCallDone",tr(this,gg,"f")),hg(this,gg,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},J6t=function(e){tr(this,$qe,"f").push(e),this._emit("event",e)},Z6t=function(e){switch(e.event){case"thread.run.step.created":return tr(this,SO,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=tr(this,SO,"f")[e.data.id];if(!r)throw Error("Received a RunStepDelta before creation of a snapshot");let n=e.data;if(n.delta){let o=CO.accumulateDelta(r,n.delta);tr(this,SO,"f")[e.data.id]=o}return tr(this,SO,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":tr(this,SO,"f")[e.data.id]=e.data;break}if(tr(this,SO,"f")[e.data.id])return tr(this,SO,"f")[e.data.id];throw new Error("No snapshot available")},Y6t=function(e,r){let n=[];switch(e.event){case"thread.message.created":return[e.data,n];case"thread.message.delta":if(!r)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let o=e.data;if(o.delta.content)for(let i of o.delta.content)if(i.index in r.content){let a=r.content[i.index];r.content[i.index]=tr(this,Jd,"m",X6t).call(this,i,a)}else r.content[i.index]=i,n.push(i);return[r,n];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(r)return[r,n];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},X6t=function(e,r){return CO.accumulateDelta(r,e)},Q6t=function(e){switch(hg(this,wpe,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":hg(this,qF,e.data,"f"),tr(this,gg,"f")&&(this._emit("toolCallDone",tr(this,gg,"f")),hg(this,gg,void 0,"f"));break;case"thread.run.cancelling":break}}});var HF,f3,zqe=b(()=>{xn();go();Xc();HF=class extends nt{create(e,r,n){return this._client.post(`/threads/${e}/messages`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}retrieve(e,r,n){return this._client.get(`/threads/${e}/messages/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}update(e,r,n,o){return this._client.post(`/threads/${e}/messages/${r}`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}list(e,r={},n){return pn(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/messages`,f3,{query:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}del(e,r,n){return this._client.delete(`/threads/${e}/messages/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},f3=class extends Po{};HF.MessagesPage=f3});var VF,p3,Uqe=b(()=>{xn();go();Xc();VF=class extends nt{retrieve(e,r,n,o={},i){return pn(o)?this.retrieve(e,r,n,{},o):this._client.get(`/threads/${e}/runs/${r}/steps/${n}`,{query:o,...i,headers:{"OpenAI-Beta":"assistants=v2",...i?.headers}})}list(e,r,n={},o){return pn(n)?this.list(e,r,{},n):this._client.getAPIList(`/threads/${e}/runs/${r}/steps`,p3,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},p3=class extends Po{};VF.RunStepsPage=p3});var lT,m3,qqe=b(()=>{xn();go();Bqe();go();Uqe();Uqe();Xc();lT=class extends nt{constructor(){super(...arguments),this.steps=new VF(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers},stream:r.stream??!1})}retrieve(e,r,n){return this._client.get(`/threads/${e}/runs/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}update(e,r,n,o){return this._client.post(`/threads/${e}/runs/${r}`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}list(e,r={},n){return pn(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/runs`,m3,{query:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}cancel(e,r,n){return this._client.post(`/threads/${e}/runs/${r}/cancel`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(e,o.id,n)}createAndStream(e,r,n){return CO.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o={...n?.headers,"X-Stainless-Poll-Helper":"true"};for(n?.pollIntervalMs&&(o["X-Stainless-Custom-Poll-Interval"]=n.pollIntervalMs.toString());;){let{data:i,response:a}=await this.retrieve(e,r,{...n,headers:{...n?.headers,...o}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=a.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await iT(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return CO.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n,o){return this._client.post(`/threads/${e}/runs/${r}/submit_tool_outputs`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers},stream:n.stream??!1})}async submitToolOutputsAndPoll(e,r,n,o){let i=await this.submitToolOutputs(e,r,n,o);return await this.poll(e,i.id,o)}submitToolOutputsStream(e,r,n,o){return CO.createToolAssistantStream(e,r,this._client.beta.threads.runs,n,o)}},m3=class extends Po{};lT.RunsPage=m3;lT.Steps=VF;lT.RunStepsPage=p3});var OO,Hqe=b(()=>{xn();go();Bqe();zqe();zqe();qqe();qqe();OO=class extends nt{constructor(){super(...arguments),this.runs=new lT(this._client),this.messages=new HF(this._client)}create(e={},r){return pn(e)?this.create({},e):this._client.post("/threads",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(e,r){return this._client.get(`/threads/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(e,r,n){return this._client.post(`/threads/${e}`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}del(e,r){return this._client.delete(`/threads/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers},stream:e.stream??!1})}async createAndRunPoll(e,r){let n=await this.createAndRun(e,r);return await this.runs.poll(n.thread_id,n.id,r)}createAndRunStream(e,r){return CO.createThreadAssistantStream(e,this._client.beta.threads,r)}};OO.Runs=lT;OO.RunsPage=m3;OO.Messages=HF;OO.MessagesPage=f3});var R_,Vqe=b(()=>{xn();mqe();W6t();mqe();kqe();kqe();Hqe();Hqe();R_=class extends nt{constructor(){super(...arguments),this.realtime=new kR(this._client),this.chat=new u3(this._client),this.assistants=new BF(this._client),this.threads=new OO(this._client)}};R_.Realtime=kR;R_.Assistants=BF;R_.AssistantsPage=t3;R_.Threads=OO});var WF,Wqe=b(()=>{xn();WF=class extends nt{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var KF,Kqe=b(()=>{xn();go();KF=class extends nt{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&oT("Request","User defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(oT("response","Decoding base64 embeddings to float32 array"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=A6t(u)}),a)))}}});var GF,h3,Gqe=b(()=>{xn();go();Xc();GF=class extends nt{retrieve(e,r,n,o){return this._client.get(`/evals/${e}/runs/${r}/output_items/${n}`,o)}list(e,r,n={},o){return pn(n)?this.list(e,r,{},n):this._client.getAPIList(`/evals/${e}/runs/${r}/output_items`,h3,{query:n,...o})}},h3=class extends Po{};GF.OutputItemListResponsesPage=h3});var cT,g3,Jqe=b(()=>{xn();go();Gqe();Gqe();Xc();cT=class extends nt{constructor(){super(...arguments),this.outputItems=new GF(this._client)}create(e,r,n){return this._client.post(`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){return this._client.get(`/evals/${e}/runs/${r}`,n)}list(e,r={},n){return pn(r)?this.list(e,{},r):this._client.getAPIList(`/evals/${e}/runs`,g3,{query:r,...n})}del(e,r,n){return this._client.delete(`/evals/${e}/runs/${r}`,n)}cancel(e,r,n){return this._client.post(`/evals/${e}/runs/${r}`,n)}},g3=class extends Po{};cT.RunListResponsesPage=g3;cT.OutputItems=GF;cT.OutputItemListResponsesPage=h3});var EO,JF,Zqe=b(()=>{xn();go();Jqe();Jqe();Xc();EO=class extends nt{constructor(){super(...arguments),this.runs=new cT(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(`/evals/${e}`,r)}update(e,r,n){return this._client.post(`/evals/${e}`,{body:r,...n})}list(e={},r){return pn(e)?this.list({},e):this._client.getAPIList("/evals",JF,{query:e,...r})}del(e,r){return this._client.delete(`/evals/${e}`,r)}},JF=class extends Po{};EO.EvalListResponsesPage=JF;EO.Runs=cT;EO.RunListResponsesPage=g3});var $R,ZF,Yqe=b(()=>{xn();go();go();uh();go();Xc();$R=class extends nt{create(e,r){return this._client.post("/files",zy({body:e,...r}))}retrieve(e,r){return this._client.get(`/files/${e}`,r)}list(e={},r){return pn(e)?this.list({},e):this._client.getAPIList("/files",ZF,{query:e,...r})}del(e,r){return this._client.delete(`/files/${e}`,r)}content(e,r){return this._client.get(`/files/${e}/content`,{...r,headers:{Accept:"application/binary",...r?.headers},__binaryResponse:!0})}retrieveContent(e,r){return this._client.get(`/files/${e}/content`,r)}async waitForProcessing(e,{pollInterval:r=5e3,maxWait:n=30*60*1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),a=await this.retrieve(e);for(;!a.status||!o.has(a.status);)if(await iT(r),a=await this.retrieve(e),Date.now()-i>n)throw new pg({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},ZF=class extends Po{};$R.FileObjectsPage=ZF});var YF,y3,Xqe=b(()=>{xn();go();Xc();YF=class extends nt{create(e,r,n){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,y3,{body:r,method:"post",...n})}retrieve(e,r={},n){return pn(r)?this.retrieve(e,{},r):this._client.get(`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}del(e,r){return this._client.delete(`/fine_tuning/checkpoints/${e}/permissions`,r)}},y3=class extends wO{};YF.PermissionCreateResponsesPage=y3});var BR,Qqe=b(()=>{xn();Xqe();Xqe();BR=class extends nt{constructor(){super(...arguments),this.permissions=new YF(this._client)}};BR.Permissions=YF;BR.PermissionCreateResponsesPage=y3});var XF,b3,e2e=b(()=>{xn();go();Xc();XF=class extends nt{list(e,r={},n){return pn(r)?this.list(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,b3,{query:r,...n})}},b3=class extends Po{};XF.FineTuningJobCheckpointsPage=b3});var PO,_3,v3,t2e=b(()=>{xn();go();e2e();e2e();Xc();PO=class extends nt{constructor(){super(...arguments),this.checkpoints=new XF(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(`/fine_tuning/jobs/${e}`,r)}list(e={},r){return pn(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",_3,{query:e,...r})}cancel(e,r){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return pn(r)?this.listEvents(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,v3,{query:r,...n})}},_3=class extends Po{},v3=class extends Po{};PO.FineTuningJobsPage=_3;PO.FineTuningJobEventsPage=v3;PO.Checkpoints=XF;PO.FineTuningJobCheckpointsPage=b3});var N_,r2e=b(()=>{xn();Qqe();Qqe();t2e();t2e();N_=class extends nt{constructor(){super(...arguments),this.jobs=new PO(this._client),this.checkpoints=new BR(this._client)}};N_.Jobs=PO;N_.FineTuningJobsPage=_3;N_.FineTuningJobEventsPage=v3;N_.Checkpoints=BR});var QF,n2e=b(()=>{xn();go();QF=class extends nt{createVariation(e,r){return this._client.post("/images/variations",zy({body:e,...r}))}edit(e,r){return this._client.post("/images/edits",zy({body:e,...r}))}generate(e,r){return this._client.post("/images/generations",{body:e,...r})}}});var zR,ek,o2e=b(()=>{xn();Xc();zR=class extends nt{retrieve(e,r){return this._client.get(`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",ek,e)}del(e,r){return this._client.delete(`/models/${e}`,r)}},ek=class extends wO{};zR.ModelsPage=ek});var tk,i2e=b(()=>{xn();tk=class extends nt{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});function e8t(t,e){return!e||!Jyn(e)?{...t,output_parsed:null,output:t.output.map(r=>r.type==="function_call"?{...r,parsed_arguments:null}:r.type==="message"?{...r,content:r.content.map(n=>({...n,parsed:null}))}:r)}:a2e(t,e)}function a2e(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:Xyn(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:Gyn(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||s2e(n),Object.defineProperty(n,"output_parsed",{enumerable:!0,get(){for(let o of n.output)if(o.type==="message"){for(let i of o.content)if(i.type==="output_text"&&i.parsed!==null)return i.parsed}return null}}),n}function Gyn(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function Jyn(t){return!!dJ(t.text?.format)}function Zyn(t){return t?.$brand==="auto-parseable-tool"}function Yyn(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function Xyn(t,e){let r=Yyn(t.tools??[],e.name);return{...e,...e,parsed_arguments:Zyn(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function s2e(t){let e=[];for(let r of t.output)if(r.type==="message")for(let n of r.content)n.type==="output_text"&&e.push(n.text);t.output_text=e.join("")}var u2e=b(()=>{n3()});var w3,l2e=b(()=>{xn();go();Cpe();w3=class extends nt{list(e,r={},n){return pn(r)?this.list(e,{},r):this._client.getAPIList(`/responses/${e}/input_items`,Spe,{query:r,...n})}}});function ebn(t,e){return e8t(t,e)}var x3,UR,S3,Ope,qR,Epe,t8t,r8t,n8t,o8t,Ppe,i8t=b(()=>{uh();mpe();u2e();x3=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},UR=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Ppe=class t extends LR{constructor(e){super(),S3.add(this),Ope.set(this,void 0),qR.set(this,void 0),Epe.set(this,void 0),x3(this,Ope,e,"f")}static createResponse(e,r,n){let o=new t(r);return o._run(()=>o._createResponse(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createResponse(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),UR(this,S3,"m",t8t).call(this);let i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)UR(this,S3,"m",r8t).call(this,a);if(i.controller.signal?.aborted)throw new Ra;return UR(this,S3,"m",n8t).call(this)}[(Ope=new WeakMap,qR=new WeakMap,Epe=new WeakMap,S3=new WeakSet,t8t=function(){this.ended||x3(this,qR,void 0,"f")},r8t=function(r){if(this.ended)return;let n=UR(this,S3,"m",o8t).call(this,r);switch(this._emit("event",r),r.type){case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new qt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new qt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new qt(`expected content to be 'output_text', got ${i.type}`);this._emit("response.output_text.delta",{...r,snapshot:i.text})}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new qt(`missing output at index ${r.output_index}`);o.type==="function_call"&&this._emit("response.function_call_arguments.delta",{...r,snapshot:o.arguments});break}default:this._emit(r.type,r);break}},n8t=function(){if(this.ended)throw new qt("stream has ended, this shouldn't happen");let r=UR(this,qR,"f");if(!r)throw new qt("request ended without sending any events");x3(this,qR,void 0,"f");let n=ebn(r,UR(this,Ope,"f"));return x3(this,Epe,n,"f"),n},o8t=function(r){let n=UR(this,qR,"f");if(!n){if(r.type!=="response.created")throw new qt(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=x3(this,qR,r.response,"f"),n}switch(r.type){case"response.output_item.added":{n.output.push(r.item);break}case"response.content_part.added":{let o=n.output[r.output_index];if(!o)throw new qt(`missing output at index ${r.output_index}`);o.type==="message"&&o.content.push(r.part);break}case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new qt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new qt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new qt(`expected content to be 'output_text', got ${i.type}`);i.text+=r.delta}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new qt(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{x3(this,qR,r.response,"f");break}}return n},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=UR(this,Epe,"f");if(!e)throw new qt("stream ended without producing a ChatCompletion");return e}}});var HR,Spe,Cpe=b(()=>{u2e();go();xn();l2e();l2e();i8t();Xc();HR=class extends nt{constructor(){super(...arguments),this.inputItems=new w3(this._client)}create(e,r){return this._client.post("/responses",{body:e,...r,stream:e.stream??!1})._thenUnwrap(n=>("object"in n&&n.object==="response"&&s2e(n),n))}retrieve(e,r={},n){return pn(r)?this.retrieve(e,{},r):this._client.get(`/responses/${e}`,{query:r,...n})}del(e,r){return this._client.delete(`/responses/${e}`,{...r,headers:{Accept:"*/*",...r?.headers}})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>a2e(n,e))}stream(e,r){return Ppe.createResponse(this._client,e,r)}},Spe=class extends Po{};HR.InputItems=w3});var C3,c2e=b(()=>{xn();go();C3=class extends nt{create(e,r,n){return this._client.post(`/uploads/${e}/parts`,zy({body:r,...n}))}}});var VR,d2e=b(()=>{xn();c2e();c2e();VR=class extends nt{constructor(){super(...arguments),this.parts=new C3(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(`/uploads/${e}/complete`,{body:r,...n})}};VR.Parts=C3});var a8t,s8t=b(()=>{a8t=async t=>{let e=await Promise.allSettled(t),r=e.filter(o=>o.status==="rejected");if(r.length){for(let o of r)console.error(o.reason);throw new Error(`${r.length} promise(s) failed - see the above errors`)}let n=[];for(let o of e)o.status==="fulfilled"&&n.push(o.value);return n}});var WR,KR,O3,Tpe=b(()=>{xn();go();Xc();WR=class extends nt{create(e,r,n){return this._client.post(`/vector_stores/${e}/files`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}retrieve(e,r,n){return this._client.get(`/vector_stores/${e}/files/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}update(e,r,n,o){return this._client.post(`/vector_stores/${e}/files/${r}`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}list(e,r={},n){return pn(r)?this.list(e,{},r):this._client.getAPIList(`/vector_stores/${e}/files`,KR,{query:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}del(e,r,n){return this._client.delete(`/vector_stores/${e}/files/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(e,o.id,n)}async poll(e,r,n){let o={...n?.headers,"X-Stainless-Poll-Helper":"true"};for(n?.pollIntervalMs&&(o["X-Stainless-Custom-Poll-Interval"]=n.pollIntervalMs.toString());;){let i=await this.retrieve(e,r,{...n,headers:o}).withResponse(),a=i.data;switch(a.status){case"in_progress":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=i.response.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await iT(s);break;case"failed":case"completed":return a}}}async upload(e,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(e,{file_id:o.id},n)}async uploadAndPoll(e,r,n){let o=await this.upload(e,r,n);return await this.poll(e,o.id,n)}content(e,r,n){return this._client.getAPIList(`/vector_stores/${e}/files/${r}/content`,O3,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},KR=class extends Po{},O3=class extends wO{};WR.VectorStoreFilesPage=KR;WR.FileContentResponsesPage=O3});var E3,f2e=b(()=>{xn();go();go();s8t();Tpe();E3=class extends nt{create(e,r,n){return this._client.post(`/vector_stores/${e}/file_batches`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}retrieve(e,r,n){return this._client.get(`/vector_stores/${e}/file_batches/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}cancel(e,r,n){return this._client.post(`/vector_stores/${e}/file_batches/${r}/cancel`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}async createAndPoll(e,r,n){let o=await this.create(e,r);return await this.poll(e,o.id,n)}listFiles(e,r,n={},o){return pn(n)?this.listFiles(e,r,{},n):this._client.getAPIList(`/vector_stores/${e}/file_batches/${r}/files`,KR,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}async poll(e,r,n){let o={...n?.headers,"X-Stainless-Poll-Helper":"true"};for(n?.pollIntervalMs&&(o["X-Stainless-Custom-Poll-Interval"]=n.pollIntervalMs.toString());;){let{data:i,response:a}=await this.retrieve(e,r,{...n,headers:o}).withResponse();switch(i.status){case"in_progress":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=a.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await iT(s);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,a=Math.min(i,r.length),s=this._client,u=r.values(),l=[...n];async function c(f){for(let p of f){let m=await s.files.create({file:p,purpose:"assistants"},o);l.push(m.id)}}let d=Array(a).fill(u).map(c);return await a8t(d),await this.createAndPoll(e,{file_ids:l})}}});var yg,rk,nk,p2e=b(()=>{xn();go();f2e();f2e();Tpe();Tpe();Xc();yg=class extends nt{constructor(){super(...arguments),this.files=new WR(this._client),this.fileBatches=new E3(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(e,r){return this._client.get(`/vector_stores/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(e,r,n){return this._client.post(`/vector_stores/${e}`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}list(e={},r){return pn(e)?this.list({},e):this._client.getAPIList("/vector_stores",rk,{query:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}del(e,r){return this._client.delete(`/vector_stores/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}search(e,r,n){return this._client.getAPIList(`/vector_stores/${e}/search`,nk,{body:r,method:"post",...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},rk=class extends Po{},nk=class extends wO{};yg.VectorStoresPage=rk;yg.VectorStoreSearchResponsesPage=nk;yg.Files=WR;yg.VectorStoreFilesPage=KR;yg.FileContentResponsesPage=O3;yg.FileBatches=E3});var u8t=b(()=>{I6t();M6t();fqe();pqe();Vqe();Wqe();Kqe();Zqe();Yqe();r2e();n2e();o2e();i2e();Cpe();d2e();p2e()});var l8t,Cr,ok=b(()=>{i6t();go();uh();npe();u8t();pqe();Wqe();Kqe();Yqe();n2e();o2e();i2e();fqe();Vqe();uqe();Zqe();r2e();Cpe();d2e();p2e();aJ();uh();Cr=class extends spe{constructor({baseURL:e=oJ("OPENAI_BASE_URL"),apiKey:r=oJ("OPENAI_API_KEY"),organization:n=oJ("OPENAI_ORG_ID")??null,project:o=oJ("OPENAI_PROJECT_ID")??null,...i}={}){if(r===void 0)throw new qt("The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).");let a={apiKey:r,organization:n,project:o,...i,baseURL:e||"https://api.openai.com/v1"};if(!a.dangerouslyAllowBrowser&&T6t())throw new qt(`It looks like you're running in a browser-like environment.
This is disabled by default, as it risks exposing your secret API credentials to attackers.
If you understand the risks and have appropriate mitigations in place,
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
`);super({baseURL:a.baseURL,timeout:a.timeout??6e5,httpAgent:a.httpAgent,maxRetries:a.maxRetries,fetch:a.fetch}),this.completions=new WF(this),this.chat=new aT(this),this.embeddings=new KF(this),this.files=new $R(this),this.images=new QF(this),this.audio=new xO(this),this.moderations=new tk(this),this.models=new zR(this),this.fineTuning=new N_(this),this.vectorStores=new yg(this),this.beta=new R_(this),this.batches=new jR(this),this.uploads=new VR(this),this.responses=new HR(this),this.evals=new EO(this),this._options=a,this.apiKey=r,this.organization=n,this.project=o}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project,...this._options.defaultHeaders}}authHeaders(e){return{Authorization:`Bearer ${this.apiKey}`}}stringifyQuery(e){return qUe(e,{arrayFormat:"brackets"})}};l8t=Cr;Cr.OpenAI=l8t;Cr.DEFAULT_TIMEOUT=6e5;Cr.OpenAIError=qt;Cr.APIError=ju;Cr.APIConnectionError=nT;Cr.APIConnectionTimeoutError=pg;Cr.APIUserAbortError=Ra;Cr.NotFoundError=H4;Cr.ConflictError=V4;Cr.RateLimitError=K4;Cr.BadRequestError=z4;Cr.AuthenticationError=U4;Cr.InternalServerError=G4;Cr.PermissionDeniedError=q4;Cr.UnprocessableEntityError=W4;Cr.toFile=nqe;Cr.fileFromPath=Xfe;Cr.Completions=WF;Cr.Chat=aT;Cr.ChatCompletionsPage=NR;Cr.Embeddings=KF;Cr.Files=$R;Cr.FileObjectsPage=ZF;Cr.Images=QF;Cr.Audio=xO;Cr.Moderations=tk;Cr.Models=zR;Cr.ModelsPage=ek;Cr.FineTuning=N_;Cr.VectorStores=yg;Cr.VectorStoresPage=rk;Cr.VectorStoreSearchResponsesPage=nk;Cr.Beta=R_;Cr.Batches=jR;Cr.BatchesPage=$F;Cr.Uploads=VR;Cr.Responses=HR;Cr.Evals=EO;Cr.EvalListResponsesPage=JF});var d8t,c8t,f8t,Ape=b(()=>{d8t=Symbol("Let zodToJsonSchema decide on which parser to use"),c8t={name:void 0,$refStrategy:"root",effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",nullableStrategy:"from-target",removeAdditionalStrategy:"passthrough",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},f8t=t=>typeof t=="string"?{...c8t,basePath:["#"],definitions:{},name:t}:{...c8t,basePath:["#"],definitions:{},...t}});function p8t(t){if(!t)return!0;for(let e in t)return!1;return!0}var _J,m2e=b(()=>{_J=t=>"_def"in t?t._def:t});var m8t,h2e=b(()=>{Ape();m2e();m8t=t=>{let e=f8t(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:r,propertyPath:void 0,seenRefs:new Set,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[_J(o),{def:_J(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function g2e(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function yo(t,e,r,n,o){t[e]=r,g2e(t,e,n,o)}var GR=b(()=>{});function h8t(){return{}}var y2e=b(()=>{});function g8t(t,e){let r={type:"array"};return t.type?._def?.typeName!==re.ZodAny&&(r.items=Or(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&yo(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&yo(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(yo(r,"minItems",t.exactLength.value,t.exactLength.message,e),yo(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var b2e=b(()=>{xd();GR();Du()});function y8t(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?yo(r,"minimum",n.value,n.message,e):yo(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),yo(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?yo(r,"maximum",n.value,n.message,e):yo(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),yo(r,"maximum",n.value,n.message,e));break;case"multipleOf":yo(r,"multipleOf",n.value,n.message,e);break}return r}var _2e=b(()=>{GR()});function b8t(){return{type:"boolean"}}var v2e=b(()=>{});function _8t(t,e){return Or(t.type._def,e)}var w2e=b(()=>{Du()});var v8t,x2e=b(()=>{Du();v8t=(t,e)=>Or(t.innerType._def,e)});function S2e(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>S2e(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return ibn(t,e)}}var ibn,C2e=b(()=>{GR();ibn=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":yo(r,"minimum",n.value,n.message,e);break;case"max":yo(r,"maximum",n.value,n.message,e);break}return r}});function w8t(t,e){return{...Or(t.innerType._def,e),default:t.defaultValue()}}var O2e=b(()=>{Du()});function x8t(t,e,r){return e.effectStrategy==="input"?Or(t.schema._def,e,r):{}}var E2e=b(()=>{Du()});function S8t(t){return{type:"string",enum:[...t.values]}}var P2e=b(()=>{});function C8t(t,e){let r=[Or(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Or(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(abn(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:s,...u}=i;a=u}else n=void 0;o.push(a)}}),o.length?{allOf:o,...n}:void 0}var abn,T2e=b(()=>{Du();abn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function O8t(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var A2e=b(()=>{});function Ipe(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?sbn(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":yo(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":yo(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"email":switch(e.emailStrategy){case"format:email":j_(r,"email",o.message,e);break;case"format:idn-email":j_(r,"idn-email",o.message,e);break;case"pattern:zod":D_(r,ik.email,o.message,e);break}break;case"url":j_(r,"uri",o.message,e);break;case"uuid":j_(r,"uuid",o.message,e);break;case"regex":D_(r,o.regex,o.message,e);break;case"cuid":D_(r,ik.cuid,o.message,e);break;case"cuid2":D_(r,ik.cuid2,o.message,e);break;case"startsWith":D_(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":D_(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":j_(r,"date-time",o.message,e);break;case"date":j_(r,"date",o.message,e);break;case"time":j_(r,"time",o.message,e);break;case"duration":j_(r,"duration",o.message,e);break;case"length":yo(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),yo(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{D_(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&j_(r,"ipv4",o.message,e),o.version!=="v4"&&j_(r,"ipv6",o.message,e);break}case"emoji":D_(r,ik.emoji,o.message,e);break;case"ulid":{D_(r,ik.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{j_(r,"binary",o.message,e);break}case"contentEncoding:base64":{yo(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{D_(r,ik.base64,o.message,e);break}}break}case"nanoid":D_(r,ik.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var I2e,ik,sbn,j_,D_,E8t,Mpe=b(()=>{GR();ik={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:()=>(I2e===void 0&&(I2e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),I2e),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])$/,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})))$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/};sbn=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),j_=(t,e,r,n)=>{t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):yo(t,"format",e,r,n)},D_=(t,e,r,n)=>{t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:E8t(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):yo(t,"pattern",E8t(e,n),r,n)},E8t=(t,e)=>{let r=typeof t=="function"?t():t;if(!e.applyRegexFlags||!r.flags)return r.source;let n={i:r.flags.includes("i"),m:r.flags.includes("m"),s:r.flags.includes("s")},o=n.i?r.source.toLowerCase():r.source,i="",a=!1,s=!1,u=!1;for(let l=0;l<o.length;l++){if(a){i+=o[l],a=!1;continue}if(n.i){if(s){if(o[l].match(/[a-z]/)){u?(i+=o[l],i+=`${o[l-2]}-${o[l]}`.toUpperCase(),u=!1):o[l+1]==="-"&&o[l+2]?.match(/[a-z]/)?(i+=o[l],u=!0):i+=`${o[l]}${o[l].toUpperCase()}`;continue}}else if(o[l].match(/[a-z]/)){i+=`[${o[l]}${o[l].toUpperCase()}]`;continue}}if(n.m){if(o[l]==="^"){i+=`(^|(?<=[\r
]))`;continue}else if(o[l]==="$"){i+=`($|(?=[\r
]))`;continue}}if(n.s&&o[l]==="."){i+=s?`${o[l]}\r
`:`[${o[l]}\r
]`;continue}i+=o[l],o[l]==="\\"?a=!0:s&&o[l]==="]"?s=!1:!s&&o[l]==="["&&(s=!0)}try{let l=new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),r.source}return i}});function Rpe(t,e){if(e.target==="openApi3"&&t.keyType?._def.typeName===re.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:Or(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:Or(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===re.ZodString&&t.keyType._def.checks?.length){let n=Object.entries(Ipe(t.keyType._def,e)).reduce((o,[i,a])=>i==="type"?o:{...o,[i]:a},{});return{...r,propertyNames:n}}else if(t.keyType?._def.typeName===re.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};return r}var Npe=b(()=>{xd();Du();Mpe()});function P8t(t,e){if(e.mapStrategy==="record")return Rpe(t,e);let r=Or(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=Or(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}var M2e=b(()=>{Du();Npe()});function T8t(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}var R2e=b(()=>{});function A8t(){return{not:{}}}var N2e=b(()=>{});function I8t(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var j2e=b(()=>{});function R8t(t,e){if(e.target==="openApi3")return M8t(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in vJ&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=vJ[i._def.typeName];return a&&!o.includes(a)?[...o,a]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,i)=>{let a=typeof i._def.value;switch(a){case"string":case"number":case"boolean":return[...o,a];case"bigint":return[...o,"integer"];case"object":if(i._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((i,a,s)=>s.indexOf(i)===a);return{type:o.length>1?o:o[0],enum:r.reduce((i,a)=>i.includes(a._def.value)?i:[...i,a._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return M8t(t,e)}var vJ,M8t,jpe=b(()=>{Du();vJ={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};M8t=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>Or(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0}});function N8t(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"||e.nullableStrategy==="property"?{type:vJ[t.innerType._def.typeName],nullable:!0}:{type:[vJ[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Or(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Or(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var D2e=b(()=>{Du();jpe()});function j8t(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",g2e(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?yo(r,"minimum",n.value,n.message,e):yo(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),yo(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?yo(r,"maximum",n.value,n.message,e):yo(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),yo(r,"maximum",n.value,n.message,e));break;case"multipleOf":yo(r,"multipleOf",n.value,n.message,e);break}return r}var L2e=b(()=>{GR()});function ubn(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":Or(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":Or(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function D8t(t,e){let r={type:"object",...Object.entries(t.shape()).reduce((n,[o,i])=>{if(i===void 0||i._def===void 0)return n;let a=[...e.currentPath,"properties",o],s=Or(i._def,{...e,currentPath:a,propertyPath:a});return s===void 0?n:(e.openaiStrictMode&&i.isOptional()&&!i.isNullable()&&console.warn(`Zod field at \`${a.join("/")}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required
This will become an error in a future version of the SDK.`),{properties:{...n.properties,[o]:s},required:i.isOptional()&&!e.openaiStrictMode?n.required:[...n.required,o]})},{properties:{},required:[]}),additionalProperties:ubn(t,e)};return r.required.length||delete r.required,r}var F2e=b(()=>{Du()});var L8t,k2e=b(()=>{Du();L8t=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Or(t.innerType._def,e);let r=Or(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var F8t,$2e=b(()=>{Du();F8t=(t,e)=>{if(e.pipeStrategy==="input")return Or(t.in._def,e);if(e.pipeStrategy==="output")return Or(t.out._def,e);let r=Or(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Or(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function k8t(t,e){return Or(t.type._def,e)}var B2e=b(()=>{Du()});function $8t(t,e){let n={type:"array",uniqueItems:!0,items:Or(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&yo(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&yo(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var z2e=b(()=>{GR();Du()});function B8t(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>Or(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Or(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>Or(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var U2e=b(()=>{Du()});function z8t(){return{not:{}}}var q2e=b(()=>{});function U8t(){return{}}var H2e=b(()=>{});var q8t,V2e=b(()=>{Du();q8t=(t,e)=>Or(t.innerType._def,e)});function Or(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==d8t)return a}if(n&&!r){let a=lbn(n,e);if(a!==void 0)return"$ref"in a&&e.seenRefs.add(a.$ref),a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=dbn(t,t.typeName,e,r);return i&&fbn(t,e,i),o.jsonSchema=i,i}var lbn,cbn,dbn,fbn,Du=b(()=>{xd();y2e();b2e();_2e();v2e();w2e();x2e();C2e();O2e();E2e();P2e();T2e();A2e();M2e();R2e();N2e();j2e();D2e();L2e();F2e();k2e();$2e();B2e();Npe();z2e();Mpe();U2e();q2e();jpe();H2e();V2e();Ape();lbn=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"extract-to-root":let r=t.path.slice(e.basePath.length+1).join("_");return r!==e.name&&e.nameStrategy==="duplicate-ref"&&(e.definitions[r]=t.def),{$ref:[...e.basePath,e.definitionPath,r].join("/")};case"relative":return{$ref:cbn(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,o)=>e.currentPath[o]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},cbn=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},dbn=(t,e,r,n)=>{switch(e){case re.ZodString:return Ipe(t,r);case re.ZodNumber:return j8t(t,r);case re.ZodObject:return D8t(t,r);case re.ZodBigInt:return y8t(t,r);case re.ZodBoolean:return b8t();case re.ZodDate:return S2e(t,r);case re.ZodUndefined:return z8t();case re.ZodNull:return I8t(r);case re.ZodArray:return g8t(t,r);case re.ZodUnion:case re.ZodDiscriminatedUnion:return R8t(t,r);case re.ZodIntersection:return C8t(t,r);case re.ZodTuple:return B8t(t,r);case re.ZodRecord:return Rpe(t,r);case re.ZodLiteral:return O8t(t,r);case re.ZodEnum:return S8t(t);case re.ZodNativeEnum:return T8t(t);case re.ZodNullable:return N8t(t,r);case re.ZodOptional:return L8t(t,r);case re.ZodMap:return P8t(t,r);case re.ZodSet:return $8t(t,r);case re.ZodLazy:return Or(t.getter()._def,r);case re.ZodPromise:return k8t(t,r);case re.ZodNaN:case re.ZodNever:return A8t();case re.ZodEffects:return x8t(t,r,n);case re.ZodAny:return h8t();case re.ZodUnknown:return U8t();case re.ZodDefault:return w8t(t,r);case re.ZodBranded:return _8t(t,r);case re.ZodReadonly:return q8t(t,r);case re.ZodCatch:return v8t(t,r);case re.ZodPipeline:return F8t(t,r);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(o=>{})(e)}},fbn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var H8t,V8t=b(()=>{Du();h2e();m2e();H8t=(t,e)=>{let r=m8t(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=Or(t._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??{},i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(o.title=i);let a=(()=>{if(p8t(r.definitions))return;let u={},l=new Set;for(let c=0;c<500;c++){let d=Object.entries(r.definitions).filter(([f])=>!l.has(f));if(d.length===0)break;for(let[f,p]of d)u[f]=Or(_J(p),{...r,currentPath:[...r.basePath,r.definitionPath,f]},!0)??{},l.add(f)}return u})(),s=n===void 0?a?{...o,[r.definitionPath]:a}:o:r.nameStrategy==="duplicate-ref"?{...o,...a||r.seenRefs.size?{[r.definitionPath]:{...a,...r.seenRefs.size?{[n]:o}:void 0}}:void 0}:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...a,[n]:o}};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),s}});var W8t=b(()=>{Ape();h2e();GR();Du();y2e();b2e();_2e();v2e();w2e();x2e();C2e();O2e();E2e();P2e();T2e();A2e();M2e();R2e();N2e();j2e();D2e();L2e();F2e();k2e();$2e();B2e();V2e();Npe();z2e();Mpe();U2e();q2e();jpe();H2e();V8t()});function K8t(t,e){return H8t(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function Dpe(t,e,r){return j6t({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:K8t(t,{name:e})}},n=>t.parse(JSON.parse(n)))}function Lpe(t){return D6t({type:"function",function:{name:t.name,parameters:K8t(t.parameters,{name:t.name}),strict:!0,...t.description?{description:t.description}:void 0}},{callback:t.function,parser:e=>t.parameters.parse(JSON.parse(e))})}var wJ=b(()=>{n3();W8t()});function ak(t){let{azureOpenAIApiDeploymentName:e,azureOpenAIApiInstanceName:r,azureOpenAIApiKey:n,azureOpenAIBasePath:o,baseURL:i,azureADTokenProvider:a,azureOpenAIEndpoint:s}=t;if((n||a)&&o&&e)return`${o}/${e}`;if((n||a)&&s&&e)return`${s}/openai/deployments/${e}`;if(n||a){if(!r)throw new Error("azureOpenAIApiInstanceName is required when using azureOpenAIApiKey");if(!e)throw new Error("azureOpenAIApiDeploymentName is a required parameter when using azureOpenAIApiKey");return`https://${r}.openai.azure.com/openai/deployments/${e}`}return i}var JR=b(()=>{});function xJ(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var G8t=b(()=>{});function sk(t){let e;return t.constructor.name===pg.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Ra.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=xJ(t,"INVALID_TOOL_RESULTS"):t.status===401?e=xJ(t,"MODEL_AUTHENTICATION"):t.status===429?e=xJ(t,"MODEL_RATE_LIMIT"):t.status===404?e=xJ(t,"MODEL_NOT_FOUND"):e=t,e}function W2e(t){if(t)return t==="any"||t==="required"?"required":t==="auto"?"auto":t==="none"?"none":typeof t=="string"?{type:"function",function:{name:t}}:t}var P3=b(()=>{ok();Gg();sg();G8t()});function pbn(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function J8t(t){let e=["namespace functions {",""];for(let r of t)r.description&&e.push(`// ${r.description}`),Object.keys(r.parameters.properties??{}).length>0?(e.push(`type ${r.name} = (_: {`),e.push(Z8t(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function Z8t(t,e){let r=[];for(let[n,o]of Object.entries(t.properties??{}))o.description&&e<2&&r.push(`// ${o.description}`),t.required?.includes(n)?r.push(`${n}: ${Fpe(o,e)},`):r.push(`${n}?: ${Fpe(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function Fpe(t,e){if(pbn(t))return t.anyOf.map(r=>Fpe(r,e)).join(" | ");switch(t.type){case"string":return t.enum?t.enum.map(r=>`"${r}"`).join(" | "):"string";case"number":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"integer":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"boolean":return"boolean";case"null":return"null";case"object":return["{",Z8t(t,e+2),"}"].join(`
`);case"array":return t.items?`${Fpe(t.items,e)}[]`:"any[]";default:return""}}var Y8t=b(()=>{});function X8t(t,e){let r;if(Kc(t)){let n=Lpe({name:t.name,parameters:t.schema,description:t.description});n.function.parameters?r={type:n.type,function:{name:n.function.name,description:n.function.description,parameters:n.function.parameters,...e?.strict!==void 0?{strict:e.strict}:{}}}:r={type:"function",function:WM(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}var Q8t=b(()=>{sg();wJ()});function mbn(t){return t.role!=="system"&&t.role!=="developer"&&t.role!=="assistant"&&t.role!=="user"&&t.role!=="function"&&t.role!=="tool"&&console.warn(`Unknown message role: ${t.role}`),t.role}function J2e(t){let e=t._getType();switch(e){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";case"generic":{if(!Qs.isInstance(t))throw new Error("Invalid generic chat message");return mbn(t)}default:throw new Error(`Unknown message type: ${e}`)}}function G2e(t,e){return t.flatMap(r=>{let n=J2e(r);n==="system"&&Z2e(e)&&(n="developer");let o={role:n,content:r.content};if(r.name!=null&&(o.name=r.name),r.additional_kwargs.function_call!=null&&(o.function_call=r.additional_kwargs.function_call,o.content=""),Ki(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(uO),o.content=""):(r.additional_kwargs.tool_calls!=null&&(o.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(o.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let i={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[o,i]}return o})}function e5t(t,e){return t.flatMap(r=>{let n=J2e(r);if(n==="system"&&Z2e(e)&&(n="developer"),n==="function")throw new Error("Function messages are not supported in Responses API");if(n==="tool"){let o=r;return o.additional_kwargs?.type==="computer_call_output"?{type:"computer_call_output",output:(()=>{if(typeof o.content=="string")return{type:"computer_screenshot",image_url:o.content};if(Array.isArray(o.content)){let a=o.content.find(u=>u.type==="computer_screenshot");if(a)return a;let s=o.content.find(u=>u.type==="image_url");if(s)return{type:"computer_screenshot",image_url:typeof s.image_url=="string"?s.image_url:s.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:o.tool_call_id}:{type:"function_call_output",call_id:o.tool_call_id,id:o.id,output:typeof o.content!="string"?JSON.stringify(o.content):o.content}}if(n==="assistant"){let o=[];r.additional_kwargs.reasoning!=null&&(u=>typeof u=="object"&&u!=null&&"type"in u&&u.type==="reasoning")(r.additional_kwargs.reasoning)&&o.push(r.additional_kwargs.reasoning);let{content:i}=r;r.additional_kwargs.refusal!=null&&(typeof i=="string"&&(i=[{type:"output_text",text:i,annotations:[]}]),i=[...i,{type:"refusal",refusal:r.additional_kwargs.refusal}]),o.push({type:"message",role:"assistant",content:typeof i=="string"?i:i.flatMap(s=>s.type==="text"?{type:"output_text",text:s.text,annotations:s.annotations??[]}:s.type==="output_text"||s.type==="refusal"?s:[])});let a=r.additional_kwargs[T3];if(Ki(r)&&r.tool_calls?.length?o.push(...r.tool_calls.map(s=>({type:"function_call",name:s.name,arguments:JSON.stringify(s.args),call_id:s.id,id:a?.[s.id]}))):r.additional_kwargs.tool_calls!=null&&o.push(...r.additional_kwargs.tool_calls.map(s=>({type:"function_call",name:s.function.name,call_id:s.id,id:a?.[s.id],arguments:s.function.arguments}))),r.additional_kwargs.tool_outputs!=null){let u=r.additional_kwargs.tool_outputs?.filter(l=>l.type==="computer_call");u.length>0&&o.push(...u)}return o}return n==="user"?{type:"message",role:"user",content:typeof r.content=="string"?r.content:r.content.flatMap(o=>{if(o.type==="text")return{type:"input_text",text:o.text};if(o.type==="image_url"){let i=typeof o.image_url=="string"?o.image_url:o.image_url.url,a=typeof o.image_url=="string"?"auto":o.image_url.detail;return{type:"input_image",image_url:i,detail:a}}return o.type==="input_text"||o.type==="input_image"||o.type==="input_file"?o:[]})}:[]})}function r5t(t){if(t.error){let a=new Error(t.error.message);throw a.name=t.error.code,a}let e=[],r=[],n=[],o={model:t.model,created_at:t.created_at,id:t.id,incomplete_details:t.incomplete_details,metadata:t.metadata,object:t.object,status:t.status,user:t.user,model_name:t.model},i={};for(let a of t.output)if(a.type==="message")e.push(...a.content.flatMap(s=>s.type==="output_text"?("parsed"in s&&s.parsed!=null&&(i.parsed=s.parsed),{type:"text",text:s.text,annotations:s.annotations}):s.type==="refusal"?(i.refusal=s.refusal,[]):s));else if(a.type==="function_call"){let s={function:{name:a.name,arguments:a.arguments},id:a.call_id};try{r.push(oh(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(ih(s,l))}i[T3]??(i[T3]={}),i[T3][a.call_id]=a.id}else a.type==="reasoning"?i.reasoning=a:(i.tool_outputs??(i.tool_outputs=[]),i.tool_outputs.push(a));return new Ln({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function hbn(t){let e=[],r={},n,o=[],i={},a={},s;if(t.type==="response.output_text.delta")e.push({type:"text",text:t.delta,index:t.content_index});else if(t.type==="response.output_text.annotation.added")e.push({type:"text",text:"",annotations:[t.annotation],index:t.content_index});else if(t.type==="response.output_item.added"&&t.item.type==="message")s=t.item.id;else if(t.type==="response.output_item.added"&&t.item.type==="function_call")o.push({type:"tool_call_chunk",name:t.item.name,args:t.item.arguments,id:t.item.id,index:t.output_index}),a[T3]={[t.item.call_id]:t.item.id};else if(t.type==="response.output_item.done"&&(t.item.type==="web_search_call"||t.item.type==="file_search_call"||t.item.type==="computer_call"))a.tool_outputs=[t.item];else if(t.type==="response.created")i.id=t.response.id,i.model_name=t.response.model,i.model=t.response.model;else if(t.type==="response.completed"){let u=r5t(t.response);n=t.response.usage,t.response.text?.format?.type==="json_schema"&&(a.parsed??(a.parsed=JSON.parse(u.text)));for(let[l,c]of Object.entries(t.response))l!=="id"&&(i[l]=c)}else if(t.type==="response.function_call_arguments.delta")o.push({type:"tool_call_chunk",args:t.delta,index:t.output_index});else if(t.type==="response.web_search_call.completed"||t.type==="response.file_search_call.completed")r={tool_outputs:{id:t.item_id,type:t.type.replace("response.","").replace(".completed",""),status:"completed"}};else if(t.type==="response.refusal.done")a.refusal=t.refusal;else return null;return new co({text:e.map(u=>u.text).join(""),message:new vr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function K2e(t){return"type"in t&&t.type!=="function"}function gbn(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function t5t(t,e){return $d(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:X8t(t,e)}function Z2e(t){return t?.startsWith("o1")||t?.startsWith("o3")}function kpe(t){return typeof t?.parse=="function"}function ybn(t){return t!==void 0&&typeof t.schema=="object"}var T3,SJ,$pe=b(()=>{ok();Bs();Qf();no();GC();ag();Im();$b();Q2();Gg();wJ();JR();P3();Y8t();Q8t();T3="__openai_function_call_ids__";SJ=class extends Au{static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning_effort"]}get lc_secrets(){return{openAIApiKey:"OPENAI_API_KEY",apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{modelName:"model",openAIApiKey:"openai_api_key",apiKey:"openai_api_key"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","reasoningEffort","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","modelName","model","modelKwargs","stop","stopSequences","timeout","openAIApiKey","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming"]}constructor(e){super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"logitBias",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gpt-3.5-turbo"}),Object.defineProperty(this,"modelKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topLogprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"openAIApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__includeRawResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportsStrictToolCalling",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"audio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modalities",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reasoningEffort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useResponsesApi",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.openAIApiKey=e?.apiKey??e?.openAIApiKey??e?.configuration?.apiKey??lt("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??lt("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelName=this.model,this.modelKwargs=e?.modelKwargs??{},this.timeout=e?.timeout,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.logprobs=e?.logprobs,this.topLogprobs=e?.topLogprobs,this.n=e?.n??this.n,this.logitBias=e?.logitBias,this.stop=e?.stopSequences??e?.stop,this.stopSequences=this.stop,this.user=e?.user,this.__includeRawResponse=e?.__includeRawResponse,this.audio=e?.audio,this.modalities=e?.modalities,this.reasoningEffort=e?.reasoningEffort,this.maxTokens=e?.maxCompletionTokens??e?.maxTokens,this.useResponsesApi=e?.useResponsesApi??this.useResponsesApi,this.model==="o1"&&(this.disableStreaming=!0),this.streaming=e?.streaming??!1,this.streamUsage=e?.streamUsage??this.streamUsage,this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration},e?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=e.supportsStrictToolCalling)}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.bind({tools:e.map(o=>K2e(o)?o:t5t(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&kpe(e.json_schema.schema)?Dpe(e.json_schema.schema,e.json_schema.name,{description:e.json_schema.description}):e}invocationParams(e,r){let n;if(e?.strict!==void 0?n=e.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this._useResponseApi(e)){let s={model:this.model,temperature:this.temperature,top_p:this.topP,user:this.user,stream:this.streaming,previous_response_id:e?.previous_response_id,truncation:e?.truncation,include:e?.include,tools:e?.tools?.length?e.tools.map(l=>K2e(l)?l:$d(l)?{type:"function",name:l.function.name,parameters:l.function.parameters,description:l.function.description,strict:n}:null).filter(l=>l!==null):void 0,tool_choice:gbn(e?.tool_choice)?e?.tool_choice:(()=>{let l=W2e(e?.tool_choice);if(typeof l=="object"&&"type"in l)return{type:"function",name:l.function.name}})(),text:(()=>{if(e?.text)return e.text;let l=this.createResponseFormat(e?.response_format);return l?.type==="json_schema"?l.json_schema.schema!=null?{format:{type:"json_schema",schema:l.json_schema.schema,description:l.json_schema.description,name:l.json_schema.name,strict:l.json_schema.strict}}:void 0:{format:l}})(),parallel_tool_calls:e?.parallel_tool_calls,max_output_tokens:this.maxTokens===-1?void 0:this.maxTokens,...this.modelKwargs},u=e?.reasoning_effort??this.reasoningEffort;return u!==void 0&&(s.reasoning={effort:u}),s}let o={};e?.stream_options!==void 0?o={stream_options:e.stream_options}:this.streamUsage&&(this.streaming||r?.streaming)&&(o={stream_options:{include_usage:!0}});let i={model:this.model,temperature:this.temperature,top_p:this.topP,frequency_penalty:this.frequencyPenalty,presence_penalty:this.presencePenalty,logprobs:this.logprobs,top_logprobs:this.topLogprobs,n:this.n,logit_bias:this.logitBias,stop:e?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:e?.functions,function_call:e?.function_call,tools:e?.tools?.length?e.tools.map(s=>t5t(s,{strict:n})):void 0,tool_choice:W2e(e?.tool_choice),response_format:this.createResponseFormat(e?.response_format),seed:e?.seed,...o,parallel_tool_calls:e?.parallel_tool_calls,...this.audio||e?.audio?{audio:this.audio||e?.audio}:{},...this.modalities||e?.modalities?{modalities:this.modalities||e?.modalities}:{},...this.modelKwargs};e?.prediction!==void 0&&(i.prediction=e.prediction);let a=e?.reasoning_effort??this.reasoningEffort;return a!==void 0&&(i.reasoning_effort=a),Z2e(i.model)?i.max_completion_tokens=this.maxTokens===-1?void 0:this.maxTokens:i.max_tokens=this.maxTokens===-1?void 0:this.maxTokens,i}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=e.tool_calls;switch(e.role){case"assistant":{let o=[],i=[];for(let u of n??[])try{o.push(oh(u,{returnId:!0}))}catch(l){i.push(ih(u,l.message))}let a={function_call:e.function_call,tool_calls:n};this.__includeRawResponse!==void 0&&(a.__raw_response=r);let s={model_name:r.model,...r.system_fingerprint?{usage:{...r.usage},system_fingerprint:r.system_fingerprint}:{}};return e.audio&&(a.audio=e.audio),new Ln({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Qs(e.content||"",e.role??"unknown")}}_convertOpenAIDeltaToBaseMessageChunk(e,r,n){let o=e.role??n,i=e.content??"",a;e.function_call?a={function_call:e.function_call}:e.tool_calls?a={tool_calls:e.tool_calls}:a={},this.__includeRawResponse&&(a.__raw_response=r),e.audio&&(a.audio={...e.audio,index:r.choices[0].index});let s={usage:{...r.usage}};if(o==="user")return new Pp({content:i,response_metadata:s});if(o==="assistant"){let u=[];if(Array.isArray(e.tool_calls))for(let l of e.tool_calls)u.push({name:l.function?.name,args:l.function?.arguments,id:l.id,index:l.index,type:"tool_call_chunk"});return new vr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Pf({content:i,response_metadata:s}):o==="developer"?new Pf({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Ih({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Wg({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new Ep({content:i,role:o,response_metadata:s})}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}async*_streamResponseChunks(e,r,n){if(this._useResponseApi(r)){let l=await this.responseApiWithRetry({...this.invocationParams(r,{streaming:!0}),input:e5t(e,this.model),stream:!0},r);for await(let c of l){let d=hbn(c);d!=null&&(yield d)}return}let o=G2e(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new co({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new co({message:new vr({content:"",response_metadata:{usage:{...u}},usage_metadata:{input_tokens:u.prompt_tokens,output_tokens:u.completion_tokens,total_tokens:u.total_tokens,...Object.keys(l).length>0&&{input_token_details:l},...Object.keys(c).length>0&&{output_token_details:c}}}),text:""})}if(r.signal?.aborted)throw new Error("AbortError")}identifyingParams(){return this._identifyingParams()}async _responseApiGenerate(e,r,n){let o=this.invocationParams(r);if(o.stream){let s=this._streamResponseChunks(e,r,n),u;for await(let l of s)l.message.response_metadata={...l.generationInfo,...l.message.response_metadata},u=u?.concat(l)??l;return{generations:u?[u]:[],llmOutput:{estimatedTokenUsage:u?.message?.usage_metadata}}}let i=e5t(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:r5t(a)}],llmOutput:{id:a.id,estimatedTokenUsage:a.usage?{promptTokens:a.usage.input_tokens,completionTokens:a.usage.output_tokens,totalTokens:a.usage.total_tokens}:void 0}}}_useResponseApi(e){let r=e?.tools?.some(K2e),n=e?.previous_response_id!=null||e?.text!=null||e?.truncation!=null||e?.include!=null;return this.useResponsesApi||r||n}async _generate(e,r,n){if(this._useResponseApi(r))return this._responseApiGenerate(e,r,n);let o={},i=this.invocationParams(r),a=G2e(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let y={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};y.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},Ki(y.message)&&(y.message.usage_metadata=o),y.message=new Ln(Object.fromEntries(Object.entries(y.message).filter(([g])=>!g.startsWith("lc_")))),p.push(y)}return{generations:p,llmOutput:{tokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}}async getEstimatedTokenCountFromPrompt(e,r,n){let o=(await this.getNumTokensFromMessages(e)).totalCount;if(r&&n!=="auto"){let i=J8t(r);o+=await this.getNumTokens(i),o+=9}return r&&e.find(i=>i._getType()==="system")&&(o-=4),n==="none"?o+=1:typeof n=="object"&&(o+=await this.getNumTokens(n.name)+4),o}async getNumTokensFromGenerations(e){return(await Promise.all(e.map(async n=>n.message.additional_kwargs?.function_call?(await this.getNumTokensFromMessages([n.message])).countPerMessage[0]:await this.getNumTokens(n.message.content)))).reduce((n,o)=>n+o,0)}async getNumTokensFromMessages(e){let r=0,n=0,o=0;this.model==="gpt-3.5-turbo-0301"?(n=4,o=-1):(n=3,o=1);let i=await Promise.all(e.map(async a=>{let s=await this.getNumTokens(a.content),u=await this.getNumTokens(J2e(a)),l=a.name!==void 0?o+await this.getNumTokens(a.name):0,c=s+n+u+l,d=a;if(d._getType()==="function"&&(c-=2),d.additional_kwargs?.function_call&&(c+=3),d?.additional_kwargs.function_call?.name&&(c+=await this.getNumTokens(d.additional_kwargs.function_call?.name)),d.additional_kwargs.function_call?.arguments)try{c+=await this.getNumTokens(JSON.stringify(JSON.parse(d.additional_kwargs.function_call?.arguments)))}catch(f){console.error("Error parsing function arguments",f,JSON.stringify(d.additional_kwargs.function_call)),c+=await this.getNumTokens(d.additional_kwargs.function_call?.arguments)}return r+=c,c}));return r+=3,{totalCount:r,countPerMessage:i}}async completionWithRetry(e,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.chat.completions.create(e,n)}catch(o){throw sk(o)}})}async responseApiWithRetry(e,r){return this.caller.call(async()=>{let n=this._getClientOptions(r);try{return e.text?.format?.type==="json_schema"&&!e.stream?await this.client.responses.parse(e,n):await this.client.responses.create(e,n)}catch(o){throw sk(o)}})}async betaParsedCompletionWithRetry(e,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.beta.chat.completions.parse(e,n)}catch(o){throw sk(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=ak(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Cr(i)}return{...this.clientConfig,...e}}_llmType(){return"openai"}_combineLLMOutput(...e){return e.reduce((r,n)=>(n&&n.tokenUsage&&(r.tokenUsage.completionTokens+=n.tokenUsage.completionTokens??0,r.tokenUsage.promptTokens+=n.tokenUsage.promptTokens??0,r.tokenUsage.totalTokens+=n.tokenUsage.totalTokens??0),r),{tokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}withStructuredOutput(e,r){let n,o,i,a;ybn(e)?(n=e.schema,o=e.name,i=e.method,a=e.includeRaw):(n=e,o=r?.name,i=r?.method,a=r?.includeRaw);let s,u;if(r?.strict!==void 0&&i==="jsonMode")throw new Error("Argument `strict` is only supported for `method` = 'function_calling'");if(!this.model.startsWith("gpt-3")&&!this.model.startsWith("gpt-4-")&&this.model!=="gpt-4"?i===void 0&&(i="jsonSchema"):i==="jsonSchema"&&console.warn(`[WARNING]: JSON Schema is not supported for model "${this.model}". Falling back to tool calling.`),i==="jsonMode")s=this.bind({response_format:{type:"json_object"}}),kpe(n)?u=Sd.fromZodSchema(n):u=new Cd;else if(i==="jsonSchema")if(s=this.bind({response_format:{type:"json_schema",json_schema:{name:o??"extract",description:n.description,schema:n,strict:r?.strict}}}),kpe(n)){let f=Sd.fromZodSchema(n);u=Mp.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Cd;else{let f=o??"extract";if(kpe(n)){let p=ss(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:f}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new Hd({returnSingle:!0,keyName:f,zodSchema:n})}else{let p;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(p=n,f=n.name):(f=n.title??f,p={name:f,description:n.description??"",parameters:n}),s=this.bind({tools:[{type:"function",function:p}],tool_choice:{type:"function",function:{name:f}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new Hd({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Fo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Fo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Fi.from([{raw:s},d])}}});var n5t=b(()=>{no();$pe();JR()});var Y2e=b(()=>{ag();Qf();no();RL();Ry();JR();P3()});var o5t=b(()=>{no();Y2e();JR()});var X2e=b(()=>{no();NP();Ry();JR();P3()});var i5t=b(()=>{no();X2e();JR();P3()});var a5t=b(()=>{});var Q2e,s5t=b(()=>{no();ok();tG();Q2e=class extends dR{static lc_name(){return"DallEAPIWrapper"}constructor(e){e?.responseFormat!==void 0&&["url","b64_json"].includes(e.responseFormat)&&(e.dallEResponseFormat=e.responseFormat,e.responseFormat="content"),super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:"A wrapper around OpenAI DALL-E API. Useful for when you need to generate images from a text description. Input should be an image description."}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"dall-e-3"}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:"vivid"}),Object.defineProperty(this,"quality",{enumerable:!0,configurable:!0,writable:!0,value:"standard"}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:"1024x1024"}),Object.defineProperty(this,"dallEResponseFormat",{enumerable:!0,configurable:!0,writable:!0,value:"url"}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let r=e?.apiKey??e?.openAIApiKey??lt("OPENAI_API_KEY"),n=e?.organization??lt("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new Cr(o),this.model=e?.model??e?.modelName??this.model,this.style=e?.style??this.style,this.quality=e?.quality??this.quality,this.n=e?.n??this.n,this.size=e?.size??this.size,this.dallEResponseFormat=e?.dallEResponseFormat??this.dallEResponseFormat,this.user=e?.user}processMultipleGeneratedUrls(e){return this.dallEResponseFormat==="url"?e.flatMap(r=>r.data.flatMap(o=>o.url?{type:"image_url",image_url:o.url}:[]).filter(o=>o!==void 0&&o.type==="image_url"&&typeof o.image_url=="string"&&o.image_url!==void 0)):e.flatMap(r=>r.data.flatMap(o=>o.b64_json?{type:"image_url",image_url:{url:o.b64_json}}:[]).filter(o=>o!==void 0&&o.type==="image_url"&&typeof o.image_url=="object"&&"url"in o.image_url&&typeof o.image_url.url=="string"&&o.image_url.url!==void 0))}async _call(e){let r={model:this.model,prompt:e,n:1,size:this.size,response_format:this.dallEResponseFormat,style:this.style,quality:this.quality,user:this.user};if(this.n>1){let i=await Promise.all(Array.from({length:this.n}).map(()=>this.client.images.generate(r)));return this.processMultipleGeneratedUrls(i)}let n=await this.client.images.generate(r),o="";return this.dallEResponseFormat==="url"?[o]=n.data.map(i=>i.url).filter(i=>i!=="undefined"):[o]=n.data.map(i=>i.b64_json).filter(i=>i!=="undefined"),o}};Object.defineProperty(Q2e,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"})});var u5t=b(()=>{s5t()});var l5t=b(()=>{$pe()});var c5t=b(()=>{$pe();n5t();Y2e();o5t();i5t();X2e();a5t();P3();JR();u5t();l5t()});var d5t=b(()=>{c5t()});var Bpe,f5t=b(()=>{no();d5t();Bpe=class extends SJ{static lc_name(){return"ChatDeepSeek"}_llmType(){return"deepseek"}get lc_secrets(){return{apiKey:"DEEPSEEK_API_KEY"}}constructor(e){let r=e?.apiKey||lt("DEEPSEEK_API_KEY");if(!r)throw new Error('Deepseek API key not found. Please set the DEEPSEEK_API_KEY environment variable or pass the key into "apiKey" field.');super({...e,apiKey:r,configuration:{baseURL:"https://api.deepseek.com",...e?.configuration}}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","deepseek"]})}_convertOpenAIDeltaToBaseMessageChunk(e,r,n){let o=super._convertOpenAIDeltaToBaseMessageChunk(e,r,n);return o.additional_kwargs.reasoning_content=e.reasoning_content,o}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=super._convertOpenAIChatCompletionMessageToBaseMessage(e,r);return n.additional_kwargs.reasoning_content=e.reasoning_content,n}withStructuredOutput(e,r){let n={...r};return n?.method===void 0&&(n.method="functionCalling"),super.withStructuredOutput(e,n)}}});var p5t=b(()=>{f5t()});var m5t=b(()=>{p5t()});var uk,h5t=b(()=>{uk="0.5.0"});function y5t(t,e={auto:!1}){if(g5t)throw new Error(`you must \`import 'groq-sdk/shims/${t.kind}'\` before importing anything else from groq-sdk`);if(lk)throw new Error(`can't \`import 'groq-sdk/shims/${t.kind}'\` after \`import 'groq-sdk/shims/${lk}'\``);g5t=e.auto,lk=t.kind,e4e=t.fetch,bbn=t.Request,_bn=t.Response,vbn=t.Headers,t4e=t.FormData,wbn=t.Blob,zpe=t.File,r4e=t.ReadableStream,n4e=t.getMultipartRequestOptions,o4e=t.getDefaultAgent,Upe=t.fileFromPath,i4e=t.isFsReadStream}var g5t,lk,e4e,bbn,_bn,vbn,t4e,wbn,zpe,r4e,n4e,o4e,Upe,i4e,a4e=b(()=>{g5t=!1});var qpe,b5t=b(()=>{qpe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function _5t({manuallyImported:t}={}){let e=t?"You may need to use polyfills":"Add one of these imports before your first `import \u2026 from 'groq-sdk'`:\n- `import 'groq-sdk/shims/node'` (if you're running on Node)\n- `import 'groq-sdk/shims/web'` (otherwise)\n",r,n,o,i;try{r=fetch,n=Request,o=Response,i=Headers}catch(a){throw new Error(`this environment is missing the following Web Fetch API type: ${a.message}. ${e}`)}return{kind:"web",fetch:r,Request:n,Response:o,Headers:i,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`)}},getMultipartRequestOptions:async(a,s)=>({...s,body:new qpe(a)}),getDefaultAgent:a=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/groq/groq-typescript#file-uploads")},isFsReadStream:a=>!1}}var v5t=b(()=>{b5t()});var w5t=b(()=>{v5t()});var CJ=b(()=>{a4e();w5t();a4e();lk||y5t(_5t(),{auto:!0})});var s4e={};as(s4e,{APIConnectionError:()=>dT,APIConnectionTimeoutError:()=>ck,APIError:()=>Ec,APIUserAbortError:()=>ZR,AuthenticationError:()=>I3,BadRequestError:()=>A3,ConflictError:()=>N3,GroqError:()=>ed,InternalServerError:()=>L3,NotFoundError:()=>R3,PermissionDeniedError:()=>M3,RateLimitError:()=>D3,UnprocessableEntityError:()=>j3});var ed,Ec,ZR,dT,ck,A3,I3,M3,R3,N3,j3,D3,L3,OJ=b(()=>{EJ();ed=class extends Error{},Ec=class t extends ed{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.error=r}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e)return new dT({cause:Hpe(r)});let i=r;return e===400?new A3(e,i,n,o):e===401?new I3(e,i,n,o):e===403?new M3(e,i,n,o):e===404?new R3(e,i,n,o):e===409?new N3(e,i,n,o):e===422?new j3(e,i,n,o):e===429?new D3(e,i,n,o):e>=500?new L3(e,i,n,o):new t(e,i,n,o)}},ZR=class extends Ec{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}},dT=class extends Ec{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,r&&(this.cause=r)}},ck=class extends dT{constructor({message:e}={}){super({message:e??"Request timed out."})}},A3=class extends Ec{constructor(){super(...arguments),this.status=400}},I3=class extends Ec{constructor(){super(...arguments),this.status=401}},M3=class extends Ec{constructor(){super(...arguments),this.status=403}},R3=class extends Ec{constructor(){super(...arguments),this.status=404}},N3=class extends Ec{constructor(){super(...arguments),this.status=409}},j3=class extends Ec{constructor(){super(...arguments),this.status=422}},D3=class extends Ec{constructor(){super(...arguments),this.status=429}},L3=class extends Ec{}});function Cbn(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function x5t(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var Vpe,u4e,F3,S5t=b(()=>{CJ();OJ();OJ();Vpe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1,o=new u4e;async function*i(){if(!e.body)throw r.abort(),new ed("Attempted to iterate over a response with no body");let s=new F3,u=x5t(e.body);for await(let l of u)for(let c of s.decode(l)){let d=o.decode(c);d&&(yield d)}for(let l of s.flush()){let c=o.decode(l);c&&(yield c)}}async function*a(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let s=!1;try{for await(let u of i())if(!s){if(u.data.startsWith("[DONE]")){s=!0;continue}if(u.event===null){let l;try{l=JSON.parse(u.data)}catch(c){throw console.error("Could not parse message into JSON:",u.data),console.error("From chunk:",u.raw),c}if(l&&l.error)throw new Ec(void 0,l.error,void 0,void 0);yield l}}s=!0}catch(u){if(u instanceof Error&&u.name==="AbortError")return;throw u}finally{s||r.abort()}}return new t(a,r)}static fromReadableStream(e,r){let n=!1;async function*o(){let a=new F3,s=x5t(e);for await(let u of s)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let s of o())a||s&&(yield JSON.parse(s));a=!0}catch(s){if(s instanceof Error&&s.name==="AbortError")return;throw s}finally{a||r.abort()}}return new t(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller),new t(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new r4e({async start(){r=e[Symbol.asyncIterator]()},async pull(o){try{let{value:i,done:a}=await r.next();if(a)return o.close();let s=n.encode(JSON.stringify(i)+`
`);o.enqueue(s)}catch(i){o.error(i)}},async cancel(){await r.return?.()}})}},u4e=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=Cbn(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},F3=class t{constructor(){this.buffer=[],this.trailingCR=!1}decode(e){let r=this.decodeText(e);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=t.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(t.NEWLINE_REGEXP);return o.length===1&&!n?(this.buffer.push(o[0]),[]):(this.buffer.length>0&&(o=[this.buffer.join("")+o[0],...o.slice(1)],this.buffer=[]),n||(this.buffer=[o.pop()||""]),o)}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new ed(`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new ed(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new ed("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length&&!this.trailingCR)return[];let e=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,e}};F3.NEWLINE_CHARS=new Set([`
`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);F3.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g});async function d4e(t,e,r){if(t=await t,r??(r=O5t(t)?{lastModified:t.lastModified,type:t.type}:{}),C5t(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file"),new zpe([o],e,r)}let n=await Ebn(t);if(e||(e=Tbn(t)??"unknown_file"),!r.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new zpe(n,e,r)}async function Ebn(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Wpe(t))e.push(await t.arrayBuffer());else if(Abn(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${Pbn(t)}`);return e}function Pbn(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function Tbn(t){return l4e(t.name)||l4e(t.filename)||l4e(t.path)?.split(/[\\/]/).pop()}var C5t,O5t,Wpe,Obn,l4e,Abn,f4e,PJ,E5t,c4e,Kpe=b(()=>{CJ();CJ();C5t=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",O5t=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Wpe(t),Wpe=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",Obn=t=>O5t(t)||C5t(t)||i4e(t);l4e=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},Abn=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",f4e=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",PJ=async t=>{let e=await E5t(t.body);return n4e(e,t)},E5t=async t=>{let e=new t4e;return await Promise.all(Object.entries(t||{}).map(([r,n])=>c4e(e,r,n))),e},c4e=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(Obn(r)){let n=await d4e(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>c4e(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>c4e(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}}});async function R5t(t){let{response:e}=t;if(t.options.stream)return k3("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):Vpe.fromSSEResponse(e,t.controller);if(e.status===204)return null;if(t.options.__binaryResponse)return e;let r=e.headers.get("content-type");if(r?.includes("application/json")||r?.includes("application/vnd.api+json")){let i=await e.json();return k3("response",e.status,e.url,e.headers,i),i}let o=await e.text();return k3("response",e.status,e.url,e.headers,o),o}function Dbn(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${o}.${i}.${a}`}}}return null}function zbn(t){if(!t)return!0;for(let e in t)return!1;return!0}function Ubn(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function M5t(t,e){for(let r in e){if(!Ubn(e,r))continue;let n=r.toLowerCase();if(!n)continue;let o=e[r];o===null?delete t[n]:o!==void 0&&(t[n]=o)}}function k3(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${t}`,...e)}var Mbn,Rbn,Gpe,Jpe,Zpe,P5t,m4e,Nbn,jbn,T5t,A5t,I5t,Lbn,Fbn,kbn,$bn,Bbn,p4e,Hpe,h4e,qbn,N5t,EJ=b(()=>{h5t();S5t();OJ();CJ();Kpe();Kpe();Mbn=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},Rbn=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)};Jpe=class t extends Promise{constructor(e,r=R5t){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>e(await this.parseResponse(r)))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}},Zpe=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e4,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=p4e("maxRetries",r),this.timeout=p4e("timeout",n),this.httpAgent=o,this.fetch=i??e4e}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...Lbn(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${qbn()}`}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(async o=>{let i=o&&Wpe(o?.body)?new DataView(await o.body.arrayBuffer()):o?.body instanceof DataView?o.body:o?.body instanceof ArrayBuffer?new DataView(o.body):o&&ArrayBuffer.isView(o?.body)?new DataView(o.body.buffer):o?.body;return{method:e,path:r,...o,body:i}}))}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}calculateContentLength(e){if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length.toString()}else if(ArrayBuffer.isView(e))return e.byteLength.toString();return null}buildRequest(e){let{method:r,path:n,query:o,headers:i={}}=e,a=ArrayBuffer.isView(e.body)||e.__binaryRequest&&typeof e.body=="string"?e.body:f4e(e.body)?e.body.body:e.body?JSON.stringify(e.body,null,2):null,s=this.calculateContentLength(a),u=this.buildURL(n,o);"timeout"in e&&p4e("timeout",e.timeout);let l=e.timeout??this.timeout,c=e.httpAgent??this.httpAgent??o4e(u),d=l+1e3;typeof c?.options?.timeout=="number"&&d>(c.options.timeout??0)&&(c.options.timeout=d),this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let f=this.buildHeaders({options:e,headers:i,contentLength:s});return{req:{method:r,...a&&{body:a},headers:f,...c&&{agent:c},signal:e.signal??null},url:u,timeout:l}}buildHeaders({options:e,headers:r,contentLength:n}){let o={};n&&(o["content-length"]=n);let i=this.defaultHeaders(e);return M5t(o,i),M5t(o,r),f4e(e.body)&&lk!=="node"&&delete o["content-type"],this.validateHeaders(o,r),o}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(r=>[...r])):{...e}:{}}makeStatusError(e,r,n,o){return Ec.generate(e,r,n,o)}request(e,r=null){return new Jpe(this.makeRequest(e,r))}async makeRequest(e,r){let n=await e;r==null&&(r=n.maxRetries??this.maxRetries),await this.prepareOptions(n);let{req:o,url:i,timeout:a}=this.buildRequest(n);if(await this.prepareRequest(o,{url:i,options:n}),k3("request",i,n,o.headers),n.signal?.aborted)throw new ZR;let s=new AbortController,u=await this.fetchWithTimeout(i,o,a,s).catch(Hpe);if(u instanceof Error){if(n.signal?.aborted)throw new ZR;if(r)return this.retryRequest(n,r);throw u.name==="AbortError"?new ck:new dT({cause:u})}let l=Nbn(u.headers);if(!u.ok){if(r&&this.shouldRetry(u)){let h=`retrying, ${r} attempts remaining`;return k3(`response (error; ${h})`,u.status,i,l),this.retryRequest(n,r,l)}let c=await u.text().catch(h=>Hpe(h).message),d=Fbn(c),f=d?void 0:c;throw k3(`response (error; ${r?"(error; no more retries left)":"(error; not retryable)"})`,u.status,i,l,f),this.makeStatusError(u.status,d,f,l)}return{response:u,options:n,controller:s}}requestAPIList(e,r){let n=this.makeRequest(r,null);return new m4e(this,n,e)}buildURL(e,r){let n=$bn(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return zbn(o)||(r={...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(n.search=this.stringifyQuery(r)),n.toString()}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new ed(`Cannot stringify type ${typeof n}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout(e,r,n,o){let{signal:i,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let s=setTimeout(()=>o.abort(),n);return this.getRequestClient().fetch.call(void 0,e,{signal:o.signal,...a}).finally(()=>{clearTimeout(s)})}getRequestClient(){return{fetch:this.fetch}}shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n){let o,i=n?.["retry-after-ms"];if(i){let s=parseFloat(i);Number.isNaN(s)||(o=s)}let a=n?.["retry-after"];if(a&&!o){let s=parseFloat(a);Number.isNaN(s)?o=Date.parse(a)-Date.now():o=s*1e3}if(!(o&&0<=o&&o<60*1e3)){let s=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,s)}return await Bbn(o),this.makeRequest(e,r-1)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}getUserAgent(){return`${this.constructor.name}/JS ${uk}`}},P5t=class{constructor(e,r,n,o){Gpe.set(this,void 0),Mbn(this,Gpe,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){let e=this.nextPageInfo();if(!e)throw new ed("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let r={...this.options};if("params"in e&&typeof r.query=="object")r.query={...r.query,...e.params};else if("url"in e){let n=[...Object.entries(r.query||{}),...e.url.searchParams.entries()];for(let[o,i]of n)e.url.searchParams.set(o,i);r.query=void 0,r.path=e.url.toString()}return await Rbn(this,Gpe,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Gpe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},m4e=class extends Jpe{constructor(e,r,n){super(r,async o=>new n(e,o.response,await R5t(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},Nbn=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),jbn=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uk,"X-Stainless-OS":A5t(Deno.build.os),"X-Stainless-Arch":T5t(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uk,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":process.version};if(Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uk,"X-Stainless-OS":A5t(process.platform),"X-Stainless-Arch":T5t(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=Dbn();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uk,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uk,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};T5t=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",A5t=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),Lbn=()=>I5t??(I5t=jbn()),Fbn=t=>{try{return JSON.parse(t)}catch{return}},kbn=new RegExp("^(?:[a-z]+:)?//","i"),$bn=t=>kbn.test(t),Bbn=t=>new Promise(e=>setTimeout(e,t)),p4e=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new ed(`${t} must be an integer`);if(e<0)throw new ed(`${t} must be a positive integer`);return e},Hpe=t=>t instanceof Error?t:new Error(t),h4e=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};qbn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),N5t=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"});var j5t=b(()=>{});var td,fT=b(()=>{td=class{constructor(e){this._client=e}}});var dk,D5t=b(()=>{fT();EJ();dk=class extends td{create(e,r){return this._client.post("/openai/v1/audio/transcriptions",PJ({body:e,...r}))}};dk||(dk={})});var fk,L5t=b(()=>{fT();EJ();fk=class extends td{create(e,r){return this._client.post("/openai/v1/audio/translations",PJ({body:e,...r}))}};fk||(fk={})});var YR,F5t=b(()=>{fT();D5t();L5t();YR=class extends td{constructor(){super(...arguments),this.transcriptions=new dk(this._client),this.translations=new fk(this._client)}};(function(t){t.Transcriptions=dk,t.Translations=fk})(YR||(YR={}))});var pk,k5t=b(()=>{fT();pk=class extends td{create(e,r){return this._client.post("/openai/v1/chat/completions",{body:e,...r,stream:e.stream??!1})}};pk||(pk={})});var XR,$5t=b(()=>{fT();k5t();XR=class extends td{constructor(){super(...arguments),this.completions=new pk(this._client)}};(function(t){t.Completions=pk})(XR||(XR={}))});var QR,B5t=b(()=>{fT();QR=class extends td{};QR||(QR={})});var e1,z5t=b(()=>{fT();e1=class extends td{create(e,r){return this._client.post("/openai/v1/embeddings",{body:e,...r})}};e1||(e1={})});var t1,U5t=b(()=>{fT();t1=class extends td{retrieve(e,r){return this._client.get(`/openai/v1/models/${e}`,r)}list(e){return this._client.get("/openai/v1/models",e)}delete(e,r){return this._client.delete(`/openai/v1/models/${e}`,r)}};t1||(t1={})});var q5t=b(()=>{j5t();F5t();$5t();B5t();z5t();U5t()});var H5t,qs,pCi,mCi,hCi,gCi,yCi,bCi,_Ci,vCi,wCi,xCi,SCi,CCi,OCi,V5t,W5t=b(()=>{EJ();OJ();Kpe();q5t();qs=class extends Zpe{constructor({baseURL:e=h4e("GROQ_BASE_URL"),apiKey:r=h4e("GROQ_API_KEY"),...n}={}){if(r===void 0)throw new ed("The GROQ_API_KEY environment variable is missing or empty; either provide it, or instantiate the Groq client with an apiKey option, like new Groq({ apiKey: 'My API Key' }).");let o={apiKey:r,...n,baseURL:e||"https://api.groq.com"};if(!o.dangerouslyAllowBrowser&&N5t())throw new ed(`It looks like you're running in a browser-like environment.
This is disabled by default, as it risks exposing your secret API credentials to attackers.
If you understand the risks and have appropriate mitigations in place,
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
new Groq({ apiKey, dangerouslyAllowBrowser: true })`);super({baseURL:o.baseURL,timeout:o.timeout??6e4,httpAgent:o.httpAgent,maxRetries:o.maxRetries,fetch:o.fetch}),this.completions=new QR(this),this.chat=new XR(this),this.embeddings=new e1(this),this.audio=new YR(this),this.models=new t1(this),this._options=o,this.apiKey=r}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),...this._options.defaultHeaders}}authHeaders(e){return{Authorization:`Bearer ${this.apiKey}`}}};H5t=qs;qs.Groq=H5t;qs.GroqError=ed;qs.APIError=Ec;qs.APIConnectionError=dT;qs.APIConnectionTimeoutError=ck;qs.APIUserAbortError=ZR;qs.NotFoundError=R3;qs.ConflictError=N3;qs.RateLimitError=D3;qs.BadRequestError=A3;qs.AuthenticationError=I3;qs.InternalServerError=L3;qs.PermissionDeniedError=M3;qs.UnprocessableEntityError=j3;qs.toFile=d4e;qs.fileFromPath=Upe;({GroqError:pCi,APIError:mCi,APIConnectionError:hCi,APIConnectionTimeoutError:gCi,APIUserAbortError:yCi,NotFoundError:bCi,ConflictError:_Ci,RateLimitError:vCi,BadRequestError:wCi,AuthenticationError:xCi,InternalServerError:SCi,PermissionDeniedError:CCi,UnprocessableEntityError:OCi}=s4e);(function(t){t.Completions=QR,t.Chat=XR,t.Embeddings=e1,t.Audio=YR,t.Models=t1})(qs||(qs={}));V5t=qs});function Jbn(t){let e=t._getType();switch(e){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";default:throw new Error(`Unknown message type: ${e}`)}}function K5t(t){return t.map(e=>{if(typeof e.content!="string")throw new Error("Non string message content not supported");let r={role:Jbn(e),content:e.content,name:e.name,function_call:e.additional_kwargs.function_call,tool_calls:e.additional_kwargs.tool_calls,tool_call_id:e.tool_call_id};return Ki(e)&&e.tool_calls?.length?r.tool_calls=e.tool_calls.map(uO):(e.additional_kwargs.tool_calls!=null&&(r.tool_calls=e.additional_kwargs.tool_calls),e.tool_call_id!=null&&(r.tool_call_id=e.tool_call_id)),r})}function Zbn(t,e){let r=t.tool_calls;switch(t.role){case"assistant":{let n=[],o=[];for(let i of r??[])try{n.push(oh(i,{returnId:!0}))}catch(a){o.push(ih(i,a.message))}return new Ln({content:t.content||"",additional_kwargs:{tool_calls:r},tool_calls:n,invalid_tool_calls:o,usage_metadata:e})}default:return new Qs(t.content||"",t.role??"unknown")}}function Ybn(t,e){if(t?.length)return t.map(r=>({id:r.id,name:r.function?.name,args:r.function?.arguments,type:"tool_call_chunk",index:e}))}function Xbn(t,e,r){let{role:n}=t,o=t.content??"",i;t.function_call?i={function_call:t.function_call}:t.tool_calls?i={tool_calls:t.tool_calls}:i={};let a,s;if(r?.usage&&(a={input_tokens:r.usage.prompt_tokens,output_tokens:r.usage.completion_tokens,total_tokens:r.usage.total_tokens},s=r.id),n==="user")return{message:new Pp({content:o})};if(n==="assistant"){let u=Ybn(t.tool_calls,e);return{message:new vr({content:o,additional_kwargs:i,tool_call_chunks:u?u.map(l=>({type:l.type,args:l.args,index:l.index})):void 0,usage_metadata:a,id:s}),toolCallData:u?u.map(l=>({id:l.id??"",name:l.name??"",index:l.index??e,type:"tool_call_chunk"})):void 0}}else return n==="system"?{message:new Pf({content:o})}:{message:new Ep({content:o,role:n})}}var Ype,G5t=b(()=>{Gg();GC();Bs();Qf();no();kL();W5t();Im();$b();Q2();sg();Ype=class extends Au{static lc_name(){return"ChatGroq"}_llmType(){return"groq"}get lc_secrets(){return{apiKey:"GROQ_API_KEY"}}constructor(e){super(e??{}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","groq"]}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:"mixtral-8x7b-32768"}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"mixtral-8x7b-32768"}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:.7}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0});let r=e?.apiKey||lt("GROQ_API_KEY");if(!r)throw new Error('Groq API key not found. Please set the GROQ_API_KEY environment variable or provide the key into "apiKey"');this.client=new V5t({apiKey:r,dangerouslyAllowBrowser:!0}),this.apiKey=r,this.temperature=e?.temperature??this.temperature,this.modelName=e?.model??e?.modelName??this.model,this.model=this.modelName,this.streaming=e?.streaming??this.streaming,this.stop=e?.stopSequences??(typeof e?.stop=="string"?[e.stop]:e?.stop)??[],this.stopSequences=this.stop,this.maxTokens=e?.maxTokens}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"groq",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??this.temperature,ls_max_tokens:r.max_tokens??this.maxTokens,ls_stop:e.stop}}async completionWithRetry(e,r){return this.caller.call(async()=>this.client.chat.completions.create(e,r))}invocationParams(e){let r=super.invocationParams(e);return e.tool_choice!==void 0&&(r.tool_choice=e.tool_choice),e.tools!==void 0&&(r.tools=e.tools),e.response_format!==void 0&&(r.response_format=e.response_format),{...r,stop:e.stop??this.stopSequences,model:this.model,temperature:this.temperature,max_tokens:this.maxTokens}}bindTools(e,r){return this.bind({tools:e.map(n=>KC(n)),...r})}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=K5t(e),a=await this.completionWithRetry({...o,messages:i,stream:!0},{signal:r?.signal,headers:r?.headers}),s="",u=[],l;for await(let c of a){l=c;let d=c?.choices[0];if(!d)continue;d.delta?.role&&(s=d.delta.role);let{message:f,toolCallData:p}=Xbn({...d.delta,role:s},d.index,c.x_groq);if(p){let h=p.filter(y=>u.every(g=>g.id!==y.id));u.push(...h),yield new co({message:new vr({content:"",tool_call_chunks:h}),text:""})}let m=new co({message:f,text:d.delta.content??"",generationInfo:{finishReason:d.finish_reason}});yield m,n?.handleLLMNewToken(m.text??"")}if(l&&("choices"in l&&delete l.choices,yield new co({message:new vr({content:"",response_metadata:l}),text:""})),r.signal?.aborted)throw new Error("AbortError")}async _generate(e,r,n){if(this.streaming){let o={},i=this._streamResponseChunks(e,r,n),a={};for await(let u of i){let l=u.generationInfo?.completion??0;a[l]===void 0?a[l]=u:a[l]=a[l].concat(u)}return{generations:Object.entries(a).sort(([u],[l])=>parseInt(u,10)-parseInt(l,10)).map(([u,l])=>l),llmOutput:{estimatedTokenUsage:o}}}else return this._generateNonStreaming(e,r,n)}async _generateNonStreaming(e,r,n){let o={},i=this.invocationParams(r),a=K5t(e),s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,headers:r?.headers});if("usage"in s&&s.usage){let{completion_tokens:l,prompt_tokens:c,total_tokens:d}=s.usage;l&&(o.completionTokens=(o.completionTokens??0)+l),c&&(o.promptTokens=(o.promptTokens??0)+c),d&&(o.totalTokens=(o.totalTokens??0)+d)}let u=[];if("choices"in s&&s.choices)for(let l of s.choices){let c=l.message?.content??"",d;o.totalTokens!==void 0&&(d={input_tokens:o.promptTokens??0,output_tokens:o.completionTokens??0,total_tokens:o.totalTokens});let f={text:c,message:Zbn(l.message??{role:"assistant"},d)};f.generationInfo={...l.finish_reason?{finish_reason:l.finish_reason}:{},...l.logprobs?{logprobs:l.logprobs}:{}},u.push(f)}return{generations:u,llmOutput:{tokenUsage:o}}}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw,s=o??"extract",u,l;if(i==="jsonMode")l=this.bind({response_format:{type:"json_object"}}),Av(n)?u=Sd.fromZodSchema(n):u=new Cd;else if(Av(n)){let p=ss(n);l=this.bind({tools:[{type:"function",function:{name:s,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:s}}}),u=new Hd({returnSingle:!0,keyName:s,zodSchema:n})}else{let p;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(p=n,s=n.name):(s=n.title??s,p={name:s,description:n.description??"",parameters:n}),l=this.bind({tools:[{type:"function",function:p}],tool_choice:{type:"function",function:{name:s}}}),u=new Hd({returnSingle:!0,keyName:s})}if(!a)return l.pipe(u).withConfig({runName:"ChatGroqStructuredOutput"});let c=Fo.assign({parsed:(p,m)=>u.invoke(p.raw,m)}),d=Fo.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return Fi.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}}});var J5t=b(()=>{G5t()});var Z5t=b(()=>{J5t()});function Y5t(t,e=0){return(Zd[t[e+0]]+Zd[t[e+1]]+Zd[t[e+2]]+Zd[t[e+3]]+"-"+Zd[t[e+4]]+Zd[t[e+5]]+"-"+Zd[t[e+6]]+Zd[t[e+7]]+"-"+Zd[t[e+8]]+Zd[t[e+9]]+"-"+Zd[t[e+10]]+Zd[t[e+11]]+Zd[t[e+12]]+Zd[t[e+13]]+Zd[t[e+14]]+Zd[t[e+15]]).toLowerCase()}var Zd,Xpe,X5t=b(()=>{Zd=[];for(Xpe=0;Xpe<256;++Xpe)Zd.push((Xpe+256).toString(16).slice(1))});function g4e(){if(!Qpe&&(Qpe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Qpe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Qpe(Qbn)}var Qpe,Qbn,Q5t=b(()=>{Qbn=new Uint8Array(16)});var e_n,y4e,eWt=b(()=>{e_n=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),y4e={randomUUID:e_n}});function t_n(t,e,r){if(y4e.randomUUID&&!e&&!t)return y4e.randomUUID();t=t||{};var n=t.random||(t.rng||g4e)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return Y5t(n)}var eme,tWt=b(()=>{eWt();Q5t();X5t();eme=t_n});var rWt=b(()=>{tWt()});var Ho=x(b4e=>{"use strict";Object.defineProperty(b4e,"__esModule",{value:!0});b4e.pathToFunc=n_n;var r_n=Object.prototype.hasOwnProperty;function n_n(t,e){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return t.replace(r,function(i,a){if(!r_n.call(o,a))throw new Error(`Parameter '${a}' is required`);let s=o[a];if(typeof s!="string"&&typeof s!="number")throw new Error(`Parameter '${a}' must be a string or number`);return e?.charEncoding==="percent"?encodeURIComponent(`${s}`):`${s}`})}}});var tme=x(Uy=>{"use strict";Object.defineProperty(Uy,"__esModule",{value:!0});Uy.SDK_METADATA=Uy.ServerList=Uy.ServerEu=void 0;Uy.serverURLFromOptions=i_n;var o_n=Ho();Uy.ServerEu="eu";Uy.ServerList={[Uy.ServerEu]:"https://api.mistral.ai"};function i_n(t){let e=t.serverURL,r={};if(!e){let o=t.server??Uy.ServerEu;e=Uy.ServerList[o]||""}let n=(0,o_n.pathToFunc)(e)(r);return new URL(n)}Uy.SDK_METADATA={language:"typescript",openapiDocVersion:"0.0.2",sdkVersion:"1.5.0",genVersion:"2.497.0",userAgent:"speakeasy-sdk/typescript 1.5.0 2.497.0 0.0.2 @mistralai/mistralai"}});var v4e=x(_4e=>{"use strict";Object.defineProperty(_4e,"__esModule",{value:!0});_4e.readableStreamToArrayBuffer=a_n;async function a_n(t){let e=t.getReader(),r=[],n=0,o=!1;for(;!o;){let{value:s,done:u}=await e.read();u?o=!0:(r.push(s),n+=s.length)}let i=new Uint8Array(n),a=0;for(let s of r)i.set(s,a),a+=s.length;return i.buffer}});var nWt=x(rme=>{"use strict";Object.defineProperty(rme,"__esModule",{value:!0});rme.CustomUserAgentHook=void 0;var s_n=tme(),w4e=class{beforeRequest(e,r){let o=`mistral-client-typescript/${s_n.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};rme.CustomUserAgentHook=w4e});var iWt=x(nme=>{"use strict";Object.defineProperty(nme,"__esModule",{value:!0});nme.DeprecationWarningHook=void 0;var oWt="x-model-deprecation-timestamp",x4e=class{afterSuccess(e,r){return r.headers.has(oWt)&&r.clone().json().then(n=>{let o=n.model;console.warn(`WARNING: The model ${o} is deprecated and will be removed on ${r.headers.get(oWt)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};nme.DeprecationWarningHook=x4e});var aWt=x(S4e=>{"use strict";Object.defineProperty(S4e,"__esModule",{value:!0});S4e.initHooks=c_n;var u_n=nWt(),l_n=iWt();function c_n(t){let e=new u_n.CustomUserAgentHook;t.registerBeforeRequestHook(e);let r=new l_n.DeprecationWarningHook;t.registerAfterSuccessHook(r)}});var sWt=x(ome=>{"use strict";Object.defineProperty(ome,"__esModule",{value:!0});ome.SDKHooks=void 0;var d_n=aWt(),C4e=class{constructor(){this.sdkInitHooks=[],this.beforeCreateRequestHooks=[],this.beforeRequestHooks=[],this.afterSuccessHooks=[],this.afterErrorHooks=[];let e=[];for(let r of e)"sdkInit"in r&&this.registerSDKInitHook(r),"beforeCreateRequest"in r&&this.registerBeforeCreateRequestHook(r),"beforeRequest"in r&&this.registerBeforeRequestHook(r),"afterSuccess"in r&&this.registerAfterSuccessHook(r),"afterError"in r&&this.registerAfterErrorHook(r);(0,d_n.initHooks)(this)}registerSDKInitHook(e){this.sdkInitHooks.push(e)}registerBeforeCreateRequestHook(e){this.beforeCreateRequestHooks.push(e)}registerBeforeRequestHook(e){this.beforeRequestHooks.push(e)}registerAfterSuccessHook(e){this.afterSuccessHooks.push(e)}registerAfterErrorHook(e){this.afterErrorHooks.push(e)}sdkInit(e){return this.sdkInitHooks.reduce((r,n)=>n.sdkInit(r),e)}beforeCreateRequest(e,r){let n=r;for(let o of this.beforeCreateRequestHooks)n=o.beforeCreateRequest(e,n);return n}async beforeRequest(e,r){let n=r;for(let o of this.beforeRequestHooks)n=await o.beforeRequest(e,n);return n}async afterSuccess(e,r){let n=r;for(let o of this.afterSuccessHooks)n=await o.afterSuccess(e,n);return n}async afterError(e,r,n){let o=r,i=n;for(let a of this.afterErrorHooks){let s=await a.afterError(e,o,i);o=s.response,i=s.error}return{response:o,error:i}}};ome.SDKHooks=C4e});var I4e=x(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});ch.ConnectionError=ch.RequestTimeoutError=ch.RequestAbortedError=ch.InvalidRequestError=ch.UnexpectedClientError=ch.HTTPClientError=void 0;var r1=class extends Error{constructor(e,r){let n=e;r?.cause&&(n+=`: ${r.cause}`),super(n,r),this.name="HTTPClientError",typeof this.cause>"u"&&(this.cause=r?.cause)}};ch.HTTPClientError=r1;var O4e=class extends r1{constructor(){super(...arguments),this.name="UnexpectedClientError"}};ch.UnexpectedClientError=O4e;var E4e=class extends r1{constructor(){super(...arguments),this.name="InvalidRequestError"}};ch.InvalidRequestError=E4e;var P4e=class extends r1{constructor(){super(...arguments),this.name="RequestAbortedError"}};ch.RequestAbortedError=P4e;var T4e=class extends r1{constructor(){super(...arguments),this.name="RequestTimeoutError"}};ch.RequestTimeoutError=T4e;var A4e=class extends r1{constructor(){super(...arguments),this.name="ConnectionError"}};ch.ConnectionError=A4e});var qy=x($3=>{"use strict";Object.defineProperty($3,"__esModule",{value:!0});$3.OK=f_n;$3.ERR=p_n;$3.unwrap=m_n;$3.unwrapAsync=h_n;function f_n(t){return{ok:!0,value:t}}function p_n(t){return{ok:!1,error:t}}function m_n(t){if(!t.ok)throw t.error;return t.value}async function h_n(t){let e=await t;if(!e.ok)throw e.error;return e.value}});var TJ=x(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.getParsedType=ma.ZodParsedType=ma.objectUtil=ma.util=void 0;var M4e;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(M4e||(ma.util=M4e={}));var uWt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(uWt||(ma.objectUtil=uWt={}));ma.ZodParsedType=M4e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var g_n=t=>{switch(typeof t){case"undefined":return ma.ZodParsedType.undefined;case"string":return ma.ZodParsedType.string;case"number":return Number.isNaN(t)?ma.ZodParsedType.nan:ma.ZodParsedType.number;case"boolean":return ma.ZodParsedType.boolean;case"function":return ma.ZodParsedType.function;case"bigint":return ma.ZodParsedType.bigint;case"symbol":return ma.ZodParsedType.symbol;case"object":return Array.isArray(t)?ma.ZodParsedType.array:t===null?ma.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ma.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?ma.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?ma.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?ma.ZodParsedType.date:ma.ZodParsedType.object;default:return ma.ZodParsedType.unknown}};ma.getParsedType=g_n});var ime=x(n1=>{"use strict";Object.defineProperty(n1,"__esModule",{value:!0});n1.ZodError=n1.quotelessJson=n1.ZodIssueCode=void 0;var lWt=TJ();n1.ZodIssueCode=lWt.util.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"]);var y_n=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");n1.quotelessJson=y_n;var AJ=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let l=a.path[u];u===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],u++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,lWt.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};n1.ZodError=AJ;AJ.create=t=>new AJ(t)});var N4e=x(R4e=>{"use strict";Object.defineProperty(R4e,"__esModule",{value:!0});var ip=ime(),mk=TJ(),b_n=(t,e)=>{let r;switch(t.code){case ip.ZodIssueCode.invalid_type:t.received===mk.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case ip.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,mk.util.jsonStringifyReplacer)}`;break;case ip.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${mk.util.joinValues(t.keys,", ")}`;break;case ip.ZodIssueCode.invalid_union:r="Invalid input";break;case ip.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${mk.util.joinValues(t.options)}`;break;case ip.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${mk.util.joinValues(t.options)}, received '${t.received}'`;break;case ip.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case ip.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case ip.ZodIssueCode.invalid_date:r="Invalid date";break;case ip.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:mk.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case ip.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case ip.ZodIssueCode.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case ip.ZodIssueCode.custom:r="Invalid input";break;case ip.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case ip.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case ip.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,mk.util.assertNever(t)}return{message:r}};R4e.default=b_n});var ame=x(o1=>{"use strict";var __n=o1&&o1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(o1,"__esModule",{value:!0});o1.defaultErrorMap=void 0;o1.setErrorMap=v_n;o1.getErrorMap=w_n;var cWt=__n(N4e());o1.defaultErrorMap=cWt.default;var dWt=cWt.default;function v_n(t){dWt=t}function w_n(){return dWt}});var D4e=x(Ui=>{"use strict";var x_n=Ui&&Ui.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ui,"__esModule",{value:!0});Ui.isAsync=Ui.isValid=Ui.isDirty=Ui.isAborted=Ui.OK=Ui.DIRTY=Ui.INVALID=Ui.ParseStatus=Ui.EMPTY_PATH=Ui.makeIssue=void 0;Ui.addIssueToContext=O_n;var S_n=ame(),fWt=x_n(N4e()),C_n=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",u=n.filter(l=>!!l).slice().reverse();for(let l of u)s=l(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}};Ui.makeIssue=C_n;Ui.EMPTY_PATH=[];function O_n(t,e){let r=(0,S_n.getErrorMap)(),n=(0,Ui.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===fWt.default?void 0:fWt.default].filter(o=>!!o)});t.common.issues.push(n)}var j4e=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return Ui.INVALID;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return Ui.INVALID;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}};Ui.ParseStatus=j4e;Ui.INVALID=Object.freeze({status:"aborted"});var E_n=t=>({status:"dirty",value:t});Ui.DIRTY=E_n;var P_n=t=>({status:"valid",value:t});Ui.OK=P_n;var T_n=t=>t.status==="aborted";Ui.isAborted=T_n;var A_n=t=>t.status==="dirty";Ui.isDirty=A_n;var I_n=t=>t.status==="valid";Ui.isValid=I_n;var M_n=t=>typeof Promise<"u"&&t instanceof Promise;Ui.isAsync=M_n});var mWt=x(pWt=>{"use strict";Object.defineProperty(pWt,"__esModule",{value:!0})});var gWt=x(sme=>{"use strict";Object.defineProperty(sme,"__esModule",{value:!0});sme.errorUtil=void 0;var hWt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(hWt||(sme.errorUtil=hWt={}))});var TWt=x(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.discriminatedUnion=ae.date=ae.boolean=ae.bigint=ae.array=ae.any=ae.coerce=ae.ZodFirstPartyTypeKind=ae.late=ae.ZodSchema=ae.Schema=ae.ZodReadonly=ae.ZodPipeline=ae.ZodBranded=ae.BRAND=ae.ZodNaN=ae.ZodCatch=ae.ZodDefault=ae.ZodNullable=ae.ZodOptional=ae.ZodTransformer=ae.ZodEffects=ae.ZodPromise=ae.ZodNativeEnum=ae.ZodEnum=ae.ZodLiteral=ae.ZodLazy=ae.ZodFunction=ae.ZodSet=ae.ZodMap=ae.ZodRecord=ae.ZodTuple=ae.ZodIntersection=ae.ZodDiscriminatedUnion=ae.ZodUnion=ae.ZodObject=ae.ZodArray=ae.ZodVoid=ae.ZodNever=ae.ZodUnknown=ae.ZodAny=ae.ZodNull=ae.ZodUndefined=ae.ZodSymbol=ae.ZodDate=ae.ZodBoolean=ae.ZodBigInt=ae.ZodNumber=ae.ZodString=ae.ZodType=void 0;ae.NEVER=ae.void=ae.unknown=ae.union=ae.undefined=ae.tuple=ae.transformer=ae.symbol=ae.string=ae.strictObject=ae.set=ae.record=ae.promise=ae.preprocess=ae.pipeline=ae.ostring=ae.optional=ae.onumber=ae.oboolean=ae.object=ae.number=ae.nullable=ae.null=ae.never=ae.nativeEnum=ae.nan=ae.map=ae.literal=ae.lazy=ae.intersection=ae.instanceof=ae.function=ae.enum=ae.effect=void 0;ae.datetimeRegex=wWt;ae.custom=SWt;var Je=ime(),ume=ame(),Zt=gWt(),ue=D4e(),ot=TJ(),Vy=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},yWt=(t,e)=>{if((0,ue.isValid)(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Je.ZodError(t.common.issues);return this._error=r,this._error}}};function mn(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}var hn=class{get description(){return this._def.description}_getType(e){return(0,ot.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,ot.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ue.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,ot.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,ue.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,ot.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return yWt(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,ot.getParsedType)(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return(0,ue.isValid)(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>(0,ue.isValid)(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,ot.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,ue.isAsync)(o)?o:Promise.resolve(o));return yWt(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:Je.ZodIssueCode.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new bg({schema:this,typeName:Rr.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Hy.create(this,this._def)}nullable(){return AO.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hT.create(this)}promise(){return s1.create(this,this._def)}or(e){return wk.create([this,e],this._def)}and(e){return xk.create(this,e,this._def)}transform(e){return new bg({...mn(this._def),schema:this,typeName:Rr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Pk({...mn(this._def),innerType:this,defaultValue:r,typeName:Rr.ZodDefault})}brand(){return new IJ({typeName:Rr.ZodBranded,type:this,...mn(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Tk({...mn(this._def),innerType:this,catchValue:r,typeName:Rr.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return MJ.create(this,e)}readonly(){return Ak.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};ae.ZodType=hn;ae.Schema=hn;ae.ZodSchema=hn;var R_n=/^c[^\s-]{8,}$/i,N_n=/^[0-9a-z]+$/,j_n=/^[0-9A-HJKMNP-TV-Z]{26}$/i,D_n=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,L_n=/^[a-z0-9_-]{21}$/i,F_n=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,k_n=/^[-+]?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)?)??$/,$_n=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,B_n="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",L4e,z_n=/^(?:(?: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])$/,U_n=/^(?:(?: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])$/,q_n=/^(([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]))$/,H_n=/^(([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])$/,V_n=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,W_n=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_Wt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",K_n=new RegExp(`^${_Wt}$`);function vWt(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function G_n(t){return new RegExp(`^${vWt(t)}$`)}function wWt(t){let e=`${_Wt}T${vWt(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function J_n(t,e){return!!((e==="v4"||!e)&&z_n.test(t)||(e==="v6"||!e)&&q_n.test(t))}function Z_n(t,e){if(!F_n.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Y_n(t,e){return!!((e==="v4"||!e)&&U_n.test(t)||(e==="v6"||!e)&&H_n.test(t))}var i1=class t extends hn{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ot.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(i,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.string,received:i.parsedType}),ue.INVALID}let n=new ue.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Je.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Je.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?(0,ue.addIssueToContext)(o,{code:Je.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,ue.addIssueToContext)(o,{code:Je.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")$_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"email",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")L4e||(L4e=new RegExp(B_n,"u")),L4e.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"emoji",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")D_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"uuid",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")L_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"nanoid",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")R_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"cuid",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")N_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"cuid2",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")j_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"ulid",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"url",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"regex",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Je.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Je.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Je.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?wWt(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Je.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?K_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Je.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?G_n(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Je.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?k_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"duration",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?J_n(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"ip",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Z_n(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"jwt",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Y_n(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"cidr",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?V_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"base64",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?W_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"base64url",code:Je.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):ot.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:Je.ZodIssueCode.invalid_string,...Zt.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Zt.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Zt.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Zt.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Zt.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Zt.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Zt.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Zt.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Zt.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Zt.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Zt.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Zt.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Zt.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Zt.errorUtil.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Zt.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Zt.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Zt.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Zt.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Zt.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Zt.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Zt.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Zt.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Zt.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Zt.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,Zt.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};ae.ZodString=i1;i1.create=t=>new i1({checks:[],typeName:Rr.ZodString,coerce:t?.coerce??!1,...mn(t)});function X_n(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}var hk=class t extends hn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ot.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(i,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.number,received:i.parsedType}),ue.INVALID}let n,o=new ue.ParseStatus;for(let i of this._def.checks)i.kind==="int"?ot.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?X_n(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.not_finite,message:i.message}),o.dirty()):ot.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Zt.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Zt.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Zt.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Zt.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Zt.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Zt.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Zt.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Zt.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Zt.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Zt.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Zt.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Zt.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Zt.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Zt.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ot.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};ae.ZodNumber=hk;hk.create=t=>new hk({checks:[],typeName:Rr.ZodNumber,coerce:t?.coerce||!1,...mn(t)});var gk=class t extends hn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ot.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new ue.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):ot.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(r,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.bigint,received:r.parsedType}),ue.INVALID}gte(e,r){return this.setLimit("min",e,!0,Zt.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Zt.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Zt.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Zt.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Zt.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Zt.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Zt.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Zt.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Zt.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Zt.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};ae.ZodBigInt=gk;gk.create=t=>new gk({checks:[],typeName:Rr.ZodBigInt,coerce:t?.coerce??!1,...mn(t)});var yk=class extends hn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ot.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.boolean,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};ae.ZodBoolean=yk;yk.create=t=>new yk({typeName:Rr.ZodBoolean,coerce:t?.coerce||!1,...mn(t)});var bk=class t extends hn{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ot.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(i,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.date,received:i.parsedType}),ue.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(i,{code:Je.ZodIssueCode.invalid_date}),ue.INVALID}let n=new ue.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Je.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Je.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):ot.util.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Zt.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Zt.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};ae.ZodDate=bk;bk.create=t=>new bk({checks:[],coerce:t?.coerce||!1,typeName:Rr.ZodDate,...mn(t)});var z3=class extends hn{_parse(e){if(this._getType(e)!==ot.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.symbol,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};ae.ZodSymbol=z3;z3.create=t=>new z3({typeName:Rr.ZodSymbol,...mn(t)});var _k=class extends hn{_parse(e){if(this._getType(e)!==ot.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.undefined,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};ae.ZodUndefined=_k;_k.create=t=>new _k({typeName:Rr.ZodUndefined,...mn(t)});var vk=class extends hn{_parse(e){if(this._getType(e)!==ot.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.null,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};ae.ZodNull=vk;vk.create=t=>new vk({typeName:Rr.ZodNull,...mn(t)});var a1=class extends hn{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,ue.OK)(e.data)}};ae.ZodAny=a1;a1.create=t=>new a1({typeName:Rr.ZodAny,...mn(t)});var mT=class extends hn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,ue.OK)(e.data)}};ae.ZodUnknown=mT;mT.create=t=>new mT({typeName:Rr.ZodUnknown,...mn(t)});var L_=class extends hn{_parse(e){let r=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(r,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.never,received:r.parsedType}),ue.INVALID}};ae.ZodNever=L_;L_.create=t=>new L_({typeName:Rr.ZodNever,...mn(t)});var U3=class extends hn{_parse(e){if(this._getType(e)!==ot.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.void,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};ae.ZodVoid=U3;U3.create=t=>new U3({typeName:Rr.ZodVoid,...mn(t)});var hT=class t extends hn{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==ot.ZodParsedType.array)return(0,ue.addIssueToContext)(r,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.array,received:r.parsedType}),ue.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,ue.addIssueToContext)(r,{code:a?Je.ZodIssueCode.too_big:Je.ZodIssueCode.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&((0,ue.addIssueToContext)(r,{code:Je.ZodIssueCode.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&((0,ue.addIssueToContext)(r,{code:Je.ZodIssueCode.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new Vy(r,a,r.path,s)))).then(a=>ue.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Vy(r,a,r.path,s)));return ue.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Zt.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Zt.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Zt.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};ae.ZodArray=hT;hT.create=(t,e)=>new hT({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Rr.ZodArray,...mn(e)});function B3(t){if(t instanceof dh){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Hy.create(B3(n))}return new dh({...t._def,shape:()=>e})}else return t instanceof hT?new hT({...t._def,type:B3(t.element)}):t instanceof Hy?Hy.create(B3(t.unwrap())):t instanceof AO?AO.create(B3(t.unwrap())):t instanceof TO?TO.create(t.items.map(e=>B3(e))):t}var dh=class t extends hn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ot.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==ot.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(l,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.object,received:l.parsedType}),ue.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof L_&&this._def.unknownKeys==="strip"))for(let l in o.data)a.includes(l)||s.push(l);let u=[];for(let l of a){let c=i[l],d=o.data[l];u.push({key:{status:"valid",value:l},value:c._parse(new Vy(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof L_){let l=this._def.unknownKeys;if(l==="passthrough")for(let c of s)u.push({key:{status:"valid",value:c},value:{status:"valid",value:o.data[c]}});else if(l==="strict")s.length>0&&((0,ue.addIssueToContext)(o,{code:Je.ZodIssueCode.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let c of s){let d=o.data[c];u.push({key:{status:"valid",value:c},value:l._parse(new Vy(o,d,o.path,c)),alwaysSet:c in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let c of u){let d=await c.key,f=await c.value;l.push({key:d,value:f,alwaysSet:c.alwaysSet})}return l}).then(l=>ue.ParseStatus.mergeObjectSync(n,l)):ue.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Zt.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Zt.errorUtil.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Rr.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of ot.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ot.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return B3(this)}partial(e){let r={};for(let n of ot.util.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ot.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Hy;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return xWt(ot.util.objectKeys(this.shape))}};ae.ZodObject=dh;dh.create=(t,e)=>new dh({shape:()=>t,unknownKeys:"strip",catchall:L_.create(),typeName:Rr.ZodObject,...mn(e)});dh.strictCreate=(t,e)=>new dh({shape:()=>t,unknownKeys:"strict",catchall:L_.create(),typeName:Rr.ZodObject,...mn(e)});dh.lazycreate=(t,e)=>new dh({shape:t,unknownKeys:"strip",catchall:L_.create(),typeName:Rr.ZodObject,...mn(e)});var wk=class extends hn{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new Je.ZodError(s.ctx.common.issues));return(0,ue.addIssueToContext)(r,{code:Je.ZodIssueCode.invalid_union,unionErrors:a}),ue.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let u of n){let l={...r,common:{...r.common,issues:[]},parent:null},c=u._parseSync({data:r.data,path:r.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!i&&(i={result:c,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(u=>new Je.ZodError(u));return(0,ue.addIssueToContext)(r,{code:Je.ZodIssueCode.invalid_union,unionErrors:s}),ue.INVALID}}get options(){return this._def.options}};ae.ZodUnion=wk;wk.create=(t,e)=>new wk({options:t,typeName:Rr.ZodUnion,...mn(e)});var pT=t=>t instanceof Sk?pT(t.schema):t instanceof bg?pT(t.innerType()):t instanceof Ck?[t.value]:t instanceof Ok?t.options:t instanceof Ek?ot.util.objectValues(t.enum):t instanceof Pk?pT(t._def.innerType):t instanceof _k?[void 0]:t instanceof vk?[null]:t instanceof Hy?[void 0,...pT(t.unwrap())]:t instanceof AO?[null,...pT(t.unwrap())]:t instanceof IJ||t instanceof Ak?pT(t.unwrap()):t instanceof Tk?pT(t._def.innerType):[],lme=class t extends hn{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ot.ZodParsedType.object)return(0,ue.addIssueToContext)(r,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.object,received:r.parsedType}),ue.INVALID;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):((0,ue.addIssueToContext)(r,{code:Je.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ue.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=pT(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new t({typeName:Rr.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...mn(n)})}};ae.ZodDiscriminatedUnion=lme;function F4e(t,e){let r=(0,ot.getParsedType)(t),n=(0,ot.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===ot.ZodParsedType.object&&n===ot.ZodParsedType.object){let o=ot.util.objectKeys(e),i=ot.util.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=F4e(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===ot.ZodParsedType.array&&n===ot.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let a=t[i],s=e[i],u=F4e(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===ot.ZodParsedType.date&&n===ot.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var xk=class extends hn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if((0,ue.isAborted)(i)||(0,ue.isAborted)(a))return ue.INVALID;let s=F4e(i.value,a.value);return s.valid?(((0,ue.isDirty)(i)||(0,ue.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.invalid_intersection_types}),ue.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ae.ZodIntersection=xk;xk.create=(t,e,r)=>new xk({left:t,right:e,typeName:Rr.ZodIntersection,...mn(r)});var TO=class t extends hn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ot.ZodParsedType.array)return(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.array,received:n.parsedType}),ue.INVALID;if(n.data.length<this._def.items.length)return(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ue.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let u=this._def.items[s]||this._def.rest;return u?u._parse(new Vy(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>ue.ParseStatus.mergeArray(r,a)):ue.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};ae.ZodTuple=TO;TO.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new TO({items:t,typeName:Rr.ZodTuple,rest:null,...mn(e)})};var cme=class t extends hn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ot.ZodParsedType.object)return(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.object,received:n.parsedType}),ue.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Vy(n,s,n.path,s)),value:a._parse(new Vy(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?ue.ParseStatus.mergeObjectAsync(r,o):ue.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof hn?new t({keyType:e,valueType:r,typeName:Rr.ZodRecord,...mn(n)}):new t({keyType:i1.create(),valueType:e,typeName:Rr.ZodRecord,...mn(r)})}};ae.ZodRecord=cme;var q3=class extends hn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ot.ZodParsedType.map)return(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.map,received:n.parsedType}),ue.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new Vy(n,s,n.path,[l,"key"])),value:i._parse(new Vy(n,u,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let u of a){let l=await u.key,c=await u.value;if(l.status==="aborted"||c.status==="aborted")return ue.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let u of a){let l=u.key,c=u.value;if(l.status==="aborted"||c.status==="aborted")return ue.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};ae.ZodMap=q3;q3.create=(t,e,r)=>new q3({valueType:e,keyType:t,typeName:Rr.ZodMap,...mn(r)});var H3=class t extends hn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ot.ZodParsedType.set)return(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.set,received:n.parsedType}),ue.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&((0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(u){let l=new Set;for(let c of u){if(c.status==="aborted")return ue.INVALID;c.status==="dirty"&&r.dirty(),l.add(c.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((u,l)=>i._parse(new Vy(n,u,n.path,l)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:Zt.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Zt.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};ae.ZodSet=H3;H3.create=(t,e)=>new H3({valueType:t,minSize:null,maxSize:null,typeName:Rr.ZodSet,...mn(e)});var dme=class t extends hn{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ot.ZodParsedType.function)return(0,ue.addIssueToContext)(r,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.function,received:r.parsedType}),ue.INVALID;function n(s,u){return(0,ue.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,ume.getErrorMap)(),ume.defaultErrorMap].filter(l=>!!l),issueData:{code:Je.ZodIssueCode.invalid_arguments,argumentsError:u}})}function o(s,u){return(0,ue.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,ume.getErrorMap)(),ume.defaultErrorMap].filter(l=>!!l),issueData:{code:Je.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof s1){let s=this;return(0,ue.OK)(async function(...u){let l=new Je.ZodError([]),c=await s._def.args.parseAsync(u,i).catch(p=>{throw l.addIssue(n(u,p)),l}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw l.addIssue(o(d,p)),l})})}else{let s=this;return(0,ue.OK)(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new Je.ZodError([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new Je.ZodError([o(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:TO.create(e).rest(mT.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||TO.create([]).rest(mT.create()),returns:r||mT.create(),typeName:Rr.ZodFunction,...mn(n)})}};ae.ZodFunction=dme;var Sk=class extends hn{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ae.ZodLazy=Sk;Sk.create=(t,e)=>new Sk({getter:t,typeName:Rr.ZodLazy,...mn(e)});var Ck=class extends hn{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(r,{received:r.data,code:Je.ZodIssueCode.invalid_literal,expected:this._def.value}),ue.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};ae.ZodLiteral=Ck;Ck.create=(t,e)=>new Ck({value:t,typeName:Rr.ZodLiteral,...mn(e)});function xWt(t,e){return new Ok({values:t,typeName:Rr.ZodEnum,...mn(e)})}var Ok=class t extends hn{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,ue.addIssueToContext)(r,{expected:ot.util.joinValues(n),received:r.parsedType,code:Je.ZodIssueCode.invalid_type}),ue.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,ue.addIssueToContext)(r,{received:r.data,code:Je.ZodIssueCode.invalid_enum_value,options:n}),ue.INVALID}return(0,ue.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};ae.ZodEnum=Ok;Ok.create=xWt;var Ek=class extends hn{_parse(e){let r=ot.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ot.ZodParsedType.string&&n.parsedType!==ot.ZodParsedType.number){let o=ot.util.objectValues(r);return(0,ue.addIssueToContext)(n,{expected:ot.util.joinValues(o),received:n.parsedType,code:Je.ZodIssueCode.invalid_type}),ue.INVALID}if(this._cache||(this._cache=new Set(ot.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=ot.util.objectValues(r);return(0,ue.addIssueToContext)(n,{received:n.data,code:Je.ZodIssueCode.invalid_enum_value,options:o}),ue.INVALID}return(0,ue.OK)(e.data)}get enum(){return this._def.values}};ae.ZodNativeEnum=Ek;Ek.create=(t,e)=>new Ek({values:t,typeName:Rr.ZodNativeEnum,...mn(e)});var s1=class extends hn{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ot.ZodParsedType.promise&&r.common.async===!1)return(0,ue.addIssueToContext)(r,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.promise,received:r.parsedType}),ue.INVALID;let n=r.parsedType===ot.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,ue.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ae.ZodPromise=s1;s1.create=(t,e)=>new s1({type:t,typeName:Rr.ZodPromise,...mn(e)});var bg=class extends hn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Rr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{(0,ue.addIssueToContext)(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return ue.INVALID;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?ue.INVALID:u.status==="dirty"||r.value==="dirty"?(0,ue.DIRTY)(u.value):u});{if(r.value==="aborted")return ue.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?ue.INVALID:s.status==="dirty"||r.value==="dirty"?(0,ue.DIRTY)(s.value):s}}if(o.type==="refinement"){let a=s=>{let u=o.refinement(s,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ue.INVALID:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?ue.INVALID:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,ue.isValid)(a))return ue.INVALID;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>(0,ue.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):ue.INVALID);ot.util.assertNever(o)}};ae.ZodEffects=bg;ae.ZodTransformer=bg;bg.create=(t,e,r)=>new bg({schema:t,typeName:Rr.ZodEffects,effect:e,...mn(r)});bg.createWithPreprocess=(t,e,r)=>new bg({schema:e,effect:{type:"preprocess",transform:t},typeName:Rr.ZodEffects,...mn(r)});var Hy=class extends hn{_parse(e){return this._getType(e)===ot.ZodParsedType.undefined?(0,ue.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ae.ZodOptional=Hy;Hy.create=(t,e)=>new Hy({innerType:t,typeName:Rr.ZodOptional,...mn(e)});var AO=class extends hn{_parse(e){return this._getType(e)===ot.ZodParsedType.null?(0,ue.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ae.ZodNullable=AO;AO.create=(t,e)=>new AO({innerType:t,typeName:Rr.ZodNullable,...mn(e)});var Pk=class extends hn{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===ot.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ae.ZodDefault=Pk;Pk.create=(t,e)=>new Pk({innerType:t,typeName:Rr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...mn(e)});var Tk=class extends hn{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,ue.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Je.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Je.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ae.ZodCatch=Tk;Tk.create=(t,e)=>new Tk({innerType:t,typeName:Rr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...mn(e)});var V3=class extends hn{_parse(e){if(this._getType(e)!==ot.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Je.ZodIssueCode.invalid_type,expected:ot.ZodParsedType.nan,received:n.parsedType}),ue.INVALID}return{status:"valid",value:e.data}}};ae.ZodNaN=V3;V3.create=t=>new V3({typeName:Rr.ZodNaN,...mn(t)});ae.BRAND=Symbol("zod_brand");var IJ=class extends hn{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};ae.ZodBranded=IJ;var MJ=class t extends hn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ue.INVALID:i.status==="dirty"?(r.dirty(),(0,ue.DIRTY)(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ue.INVALID:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:Rr.ZodPipeline})}};ae.ZodPipeline=MJ;var Ak=class extends hn{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,ue.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,ue.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};ae.ZodReadonly=Ak;Ak.create=(t,e)=>new Ak({innerType:t,typeName:Rr.ZodReadonly,...mn(e)});function bWt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function SWt(t,e={},r){return t?a1.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=bWt(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=bWt(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):a1.create()}ae.late={object:dh.lazycreate};var Rr;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Rr||(ae.ZodFirstPartyTypeKind=Rr={}));var Q_n=(t,e={message:`Input not instance of ${t.name}`})=>SWt(r=>r instanceof t,e);ae.instanceof=Q_n;var CWt=i1.create;ae.string=CWt;var OWt=hk.create;ae.number=OWt;var evn=V3.create;ae.nan=evn;var tvn=gk.create;ae.bigint=tvn;var EWt=yk.create;ae.boolean=EWt;var rvn=bk.create;ae.date=rvn;var nvn=z3.create;ae.symbol=nvn;var ovn=_k.create;ae.undefined=ovn;var ivn=vk.create;ae.null=ivn;var avn=a1.create;ae.any=avn;var svn=mT.create;ae.unknown=svn;var uvn=L_.create;ae.never=uvn;var lvn=U3.create;ae.void=lvn;var cvn=hT.create;ae.array=cvn;var dvn=dh.create;ae.object=dvn;var fvn=dh.strictCreate;ae.strictObject=fvn;var pvn=wk.create;ae.union=pvn;var mvn=lme.create;ae.discriminatedUnion=mvn;var hvn=xk.create;ae.intersection=hvn;var gvn=TO.create;ae.tuple=gvn;var yvn=cme.create;ae.record=yvn;var bvn=q3.create;ae.map=bvn;var _vn=H3.create;ae.set=_vn;var vvn=dme.create;ae.function=vvn;var wvn=Sk.create;ae.lazy=wvn;var xvn=Ck.create;ae.literal=xvn;var Svn=Ok.create;ae.enum=Svn;var Cvn=Ek.create;ae.nativeEnum=Cvn;var Ovn=s1.create;ae.promise=Ovn;var PWt=bg.create;ae.effect=PWt;ae.transformer=PWt;var Evn=Hy.create;ae.optional=Evn;var Pvn=AO.create;ae.nullable=Pvn;var Tvn=bg.createWithPreprocess;ae.preprocess=Tvn;var Avn=MJ.create;ae.pipeline=Avn;var Ivn=()=>CWt().optional();ae.ostring=Ivn;var Mvn=()=>OWt().optional();ae.onumber=Mvn;var Rvn=()=>EWt().optional();ae.oboolean=Rvn;ae.coerce={string:t=>i1.create({...t,coerce:!0}),number:t=>hk.create({...t,coerce:!0}),boolean:t=>yk.create({...t,coerce:!0}),bigint:t=>gk.create({...t,coerce:!0}),date:t=>bk.create({...t,coerce:!0})};ae.NEVER=ue.INVALID});var k4e=x(Wy=>{"use strict";var Nvn=Wy&&Wy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W3=Wy&&Wy.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Nvn(e,t,r)};Object.defineProperty(Wy,"__esModule",{value:!0});W3(ame(),Wy);W3(D4e(),Wy);W3(mWt(),Wy);W3(TJ(),Wy);W3(TWt(),Wy);W3(ime(),Wy)});var Ae=x(fh=>{"use strict";var AWt=fh&&fh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jvn=fh&&fh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dvn=fh&&fh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&AWt(e,t,r);return jvn(e,t),e},Lvn=fh&&fh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&AWt(e,t,r)};Object.defineProperty(fh,"__esModule",{value:!0});fh.z=void 0;var IWt=Dvn(k4e());fh.z=IWt;Lvn(k4e(),fh);fh.default=IWt});var z4e=x(rd=>{"use strict";var Fvn=rd&&rd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kvn=rd&&rd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$vn=rd&&rd.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Fvn(e,t,r);return kvn(e,t),e};Object.defineProperty(rd,"__esModule",{value:!0});rd.zodInbound=rd.zodOutbound=void 0;rd.bytesToBase64=MWt;rd.bytesFromBase64=$4e;rd.stringToBytes=B4e;rd.stringFromBytes=RWt;rd.stringToBase64=Bvn;rd.stringFromBase64=zvn;var fme=$vn(Ae());function MWt(t){return btoa(String.fromCodePoint(...t))}function $4e(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function B4e(t){return new TextEncoder().encode(t)}function RWt(t){return new TextDecoder().decode(t)}function Bvn(t){return MWt(B4e(t))}function zvn(t){return RWt($4e(t))}rd.zodOutbound=fme.instanceof(Uint8Array).or(fme.string().transform(B4e));rd.zodInbound=fme.instanceof(Uint8Array).or(fme.string().transform($4e))});var q4e=x(U4e=>{"use strict";Object.defineProperty(U4e,"__esModule",{value:!0});U4e.isPlainObject=Uvn;function Uvn(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}});var xi=x(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.encodeDeepObjectQuery=To.encodePipeDelimitedQuery=To.encodeSpaceDelimitedQuery=To.encodeFormQuery=To.encodeJSONQuery=To.encodeSimple=To.encodePipeDelimited=To.encodeSpaceDelimited=To.encodeForm=To.EncodingError=void 0;To.encodeMatrix=qvn;To.encodeLabel=Hvn;To.encodeBodyForm=Vvn;To.encodeDeepObject=jWt;To.encodeDeepObjectObject=V4e;To.encodeJSON=DWt;To.queryJoin=LWt;To.queryEncoder=G3;To.appendForm=Kvn;var NWt=z4e(),F_=q4e(),RJ=class extends Error{constructor(e){super(e),this.name="EncodingError"}};To.EncodingError=RJ;function qvn(t,e,r){let n="",o=r?.explode?NJ(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(K3(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=jJ(u,f=>`${a(f)}`)?.join(","):(0,F_.isPlainObject)(u)?c=mme(Object.entries(u),([p,m])=>`,${i(p)},${a(m)}`)?.join("").slice(1):c=`${a(u)}`,c==null))return;let d=i(s);l=`${d}=${c}`,l===`${d}=`&&(l=l.slice(0,-1)),l&&(n+=`;${l}`)}),n}function Hvn(t,e,r){let n="",o=r?.explode?NJ(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(K3(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=jJ(u,c=>`${a(c)}`)?.join("."):(0,F_.isPlainObject)(u)?l=mme(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,F_.isPlainObject)(e)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function H4e(t){return(e,r,n)=>{let o="",i=n?.explode?NJ(e,r):[[e,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(K3(l)),u=a(t);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=jJ(c,p=>`${s(p)}`)?.join(u):(0,F_.isPlainObject)(c)?f=mme(Object.entries(c),([p,m])=>`${a(p)}${u}${s(m)}`)?.join(u):f=`${s(c)}`,f!=null&&(d=`${a(l)}=${f}`,!(!d||d==="=")&&(o+=`&${d}`)))}),o.slice(1)}}To.encodeForm=H4e(",");To.encodeSpaceDelimited=H4e(" ");To.encodePipeDelimited=H4e("|");function Vvn(t,e,r){let n="",o=r?.explode?NJ(t,e):[[t,e]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(K3(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,F_.isPlainObject)(u)?c=JSON.stringify(u,pme):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function jWt(t,e,r){if(e!=null){if(!(0,F_.isPlainObject)(e))throw new RJ(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return V4e(t,e,r)}}function V4e(t,e,r){if(e==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,F_.isPlainObject)(e))throw new RJ(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([i,a])=>{if(a==null)return;let s=`${t}[${i}]`;if((0,F_.isPlainObject)(a)){let c=V4e(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=jJ(u,c=>`${o(s)}=${o(K3(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function DWt(t,e,r){if(typeof e>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(e,pme));return r?.explode?o:`${n(t)}=${o}`}var Wvn=(t,e,r)=>{let n="",o=r?.explode?NJ(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(K3(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=jJ(u,c=>`${a(c)}`)?.join(","):(0,F_.isPlainObject)(u)?l=mme(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,F_.isPlainObject)(e)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};To.encodeSimple=Wvn;function NJ(t,e){return Array.isArray(e)?e.map(r=>[t,r]):(0,F_.isPlainObject)(e)?Object.entries(e??{}).map(([n,o])=>[n,o]):[[t,e]]}function K3(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?(0,NWt.bytesToBase64)(t):typeof t=="object"?JSON.stringify(t,pme):`${t}`}function pme(t,e){return e instanceof Uint8Array?(0,NWt.bytesToBase64)(e):e}function jJ(t,e){let r=t.reduce((n,o)=>{if(o==null)return n;let i=e(o);return i==null||n.push(i),n},[]);return r.length?r:null}function mme(t,e){let r=[];for(let[n,o]of t){if(o==null)continue;let i=e([n,o]);i!=null&&r.push(i)}return r.length?r:null}function LWt(...t){return t.filter(Boolean).join("&")}function G3(t){return function(r,n){let o={...n,explode:n?.explode??!0,charEncoding:n?.charEncoding??"percent"},i=Object.entries(r).map(([a,s])=>t(a,s,o));return LWt(...i)}}To.encodeJSONQuery=G3(DWt);To.encodeFormQuery=G3(To.encodeForm);To.encodeSpaceDelimitedQuery=G3(To.encodeSpaceDelimited);To.encodePipeDelimitedQuery=G3(To.encodePipeDelimited);To.encodeDeepObjectQuery=G3(jWt);function Kvn(t,e,r,n){r!=null&&(r instanceof Blob&&n?t.append(e,r,n):r instanceof Blob?t.append(e,r):t.append(e,String(r)))}});var FWt=x(W4e=>{"use strict";Object.defineProperty(W4e,"__esModule",{value:!0});W4e.dlv=Gvn;function Gvn(t,e,r,n,o){for(e=Array.isArray(e)?e:e.split("."),n=0;n<e.length;n++){let i=e[n];t=i!=null&&t?t[i]:o}return t===o?r:t}});var G4e=x(_g=>{"use strict";var Jvn=_g&&_g.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zvn=_g&&_g.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yvn=_g&&_g.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Jvn(e,t,r);return Zvn(e,t),e};Object.defineProperty(_g,"__esModule",{value:!0});_g.envSchema=void 0;_g.env=Xvn;_g.resetEnv=Qvn;var kWt=FWt(),K4e=Yvn(Ae());_g.envSchema=K4e.object({MISTRAL_API_KEY:K4e.string().optional(),MISTRAL_DEBUG:K4e.coerce.boolean().optional()});var DJ;function Xvn(){return DJ||(DJ=_g.envSchema.parse((0,kWt.dlv)(globalThis,"process.env")??(0,kWt.dlv)(globalThis,"Deno.env")??{}),DJ)}function Qvn(){DJ=void 0}});var LJ=x(IO=>{"use strict";Object.defineProperty(IO,"__esModule",{value:!0});IO.HTTPClient=void 0;IO.matchContentType=BWt;IO.matchStatusCode=zWt;IO.matchResponse=rwn;IO.isConnectionError=nwn;IO.isTimeoutError=own;IO.isAbortError=iwn;var ewn=(t,e)=>e==null?fetch(t):fetch(t,e),J4e=class t{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||ewn}async request(e){let r=e;for(let n of this.requestHooks){let o=await n(r);o&&(r=o)}try{let n=await this.fetcher(r);for(let o of this.responseHooks)await o(n,r);return n}catch(n){for(let o of this.requestErrorHooks)await o(n,r);throw n}}addHook(...e){if(e[0]==="beforeRequest")this.requestHooks.push(e[1]);else if(e[0]==="requestError")this.requestErrorHooks.push(e[1]);else if(e[0]==="response")this.responseHooks.push(e[1]);else throw new Error(`Invalid hook type: ${e[0]}`);return this}removeHook(...e){let r;if(e[0]==="beforeRequest")r=this.requestHooks;else if(e[0]==="requestError")r=this.requestErrorHooks;else if(e[0]==="response")r=this.responseHooks;else throw new Error(`Invalid hook type: ${e[0]}`);let n=r.findIndex(o=>o===e[1]);return n>=0&&r.splice(n,1),this}clone(){let e=new t(this.options);return e.requestHooks=this.requestHooks.slice(),e.requestErrorHooks=this.requestErrorHooks.slice(),e.responseHooks=this.responseHooks.slice(),e}};IO.HTTPClient=J4e;var $Wt=/\s*;\s*/g;function BWt(t,e){if(e==="*")return!0;let r=t.headers.get("content-type")?.trim()||"application/octet-stream";r=r.toLowerCase();let n=e.toLowerCase().trim().split($Wt),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split($Wt),[s="",...u]=a,[l="",c=""]=s.split("/");if(!l||!c||o!=="*/*"&&s!==o&&`${l}/*`!==o&&`*/${c}`!==o||u.length<i.length)return!1;let d=new Set(u);for(let f of i)if(!d.has(f))return!1;return!0}var twn=new RegExp("^[0-9]xx$","i");function zWt(t,e){let r=`${t.status}`,n=Array.isArray(e)?e:[e];return n.length?n.some(o=>{let i=`${o}`;if(i==="default")return!0;if(!twn.test(`${i}`))return i===r;let a=i.charAt(0);if(!a)throw new Error("Invalid status code range");let s=r.charAt(0);if(!s)throw new Error(`Invalid response status code: ${r}`);return s===a}):!1}function rwn(t,e,r){return zWt(t,e)&&BWt(t,r)}function nwn(t){if(typeof t!="object"||t==null)return!1;let e=t instanceof TypeError&&t.message.toLowerCase().startsWith("failed to fetch"),r=t instanceof TypeError&&t.message.toLowerCase().startsWith("fetch failed"),n="name"in t&&t.name==="ConnectionError",o="code"in t&&typeof t.code=="string"&&t.code.toLowerCase()==="econnreset";return e||r||o||n}function own(t){if(typeof t!="object"||t==null)return!1;let e="name"in t&&t.name==="TimeoutError",r="code"in t&&t.code===23,n="code"in t&&typeof t.code=="string"&&t.code.toLowerCase()==="econnaborted";return e||r||n}function iwn(t){if(typeof t!="object"||t==null)return!1;let e="name"in t&&t.name==="AbortError",r="code"in t&&t.code===20,n="code"in t&&typeof t.code=="string"&&t.code.toLowerCase()==="econnaborted";return e||r||n}});var qWt=x(Mk=>{"use strict";Object.defineProperty(Mk,"__esModule",{value:!0});Mk.TemporaryError=Mk.PermanentError=void 0;Mk.retry=swn;var UWt=LJ(),awn={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},FJ=class t extends Error{constructor(e,r){let n=e;r?.cause&&(n+=`: ${r.cause}`),super(n,r),this.name="PermanentError",typeof this.cause>"u"&&(this.cause=r?.cause),Object.setPrototypeOf(this,t.prototype)}};Mk.PermanentError=FJ;var Ik=class t extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,t.prototype)}};Mk.TemporaryError=Ik;async function swn(t,e){switch(e.config.strategy){case"backoff":return dwn(uwn(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??awn);default:return await t()}}function uwn(t,e){return async()=>{try{let r=await t();if(cwn(r,e.statusCodes))throw new Ik("Response failed with retryable status code",r);return r}catch(r){throw r instanceof Ik||e.retryConnectionErrors&&((0,UWt.isTimeoutError)(r)||(0,UWt.isConnectionError)(r))?r:new FJ("Permanent error",{cause:r})}}}var lwn=new RegExp("^[0-9]xx$","i");function cwn(t,e){let r=`${t.status}`;return e.some(n=>{if(!lwn.test(n))return n===r;let o=n.charAt(0);if(!o)throw new Error("Invalid status code range");let i=r.charAt(0);if(!i)throw new Error(`Invalid response status code: ${r}`);return i===o})}async function dwn(t,e){let{maxElapsedTime:r,initialInterval:n,exponent:o,maxInterval:i}=e,a=Date.now(),s=0;for(;;)try{return await t()}catch(u){if(u instanceof FJ)throw u.cause;if(Date.now()-a>r){if(u instanceof Ik)return u.response;throw u}let c=0;u instanceof Ik&&(c=fwn(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await pwn(d),s++}}function fwn(t){let e=t.headers.get("retry-after")||"";if(!e)return 0;let r=Number(e);if(Number.isInteger(r))return r*1e3;let n=Date.parse(e);if(Number.isInteger(n)){let o=n-Date.now();return o>0?Math.ceil(o):0}return 0}async function pwn(t){return new Promise(e=>setTimeout(e,t))}});var vg=x(l1=>{"use strict";var kJ=l1&&l1.__classPrivateFieldSet||function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},Ky=l1&&l1.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},gme,MO,gT;Object.defineProperty(l1,"__esModule",{value:!0});l1.ClientSDK=void 0;var HWt=sWt(),J3=I4e(),u1=qy(),mwn=z4e(),VWt=tme(),hwn=xi(),gwn=G4e(),yT=LJ(),ywn=qWt(),hme=typeof globalThis>"u"?null:globalThis,bwn=typeof hme=="object"&&hme!=null&&"importScripts"in hme&&typeof hme.importScripts=="function",_wn=bwn||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",Z4e=class{constructor(e={}){gme.set(this,void 0),MO.set(this,void 0),gT.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof HWt.SDKHooks?kJ(this,MO,r.hooks,"f"):kJ(this,MO,new HWt.SDKHooks,"f"),this._options={...e,hooks:Ky(this,MO,"f")};let n=(0,VWt.serverURLFromOptions)(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=Ky(this,MO,"f").sdkInit({baseURL:n,client:e.httpClient||new yT.HTTPClient});this._baseURL=o,kJ(this,gme,i,"f"),kJ(this,gT,e.debugLogger,"f"),!Ky(this,gT,"f")&&(0,gwn.env)().MISTRAL_DEBUG&&kJ(this,gT,console,"f")}_createRequest(e,r,n){let{method:o,path:i,query:a,headers:s,security:u}=r,l=r.baseURL??this._baseURL;if(!l)return(0,u1.ERR)(new J3.InvalidRequestError("No base URL provided for operation"));let c=new URL(l),d=new URL(i,c);i&&(c.pathname+=c.pathname.endsWith("/")?"":"/",c.pathname+=d.pathname.replace(/^\/+/,""));let f=a||"",p=[];for(let[E,P]of Object.entries(u?.queryParams||{})){let T=(0,hwn.encodeForm)(E,P,{charEncoding:"percent"});typeof T<"u"&&p.push(T)}if(p.length&&(f+=`&${p.join("&")}`),f){let E=f.startsWith("&")?f.slice(1):f;c.search=`?${E}`}let m=new Headers(s),h=u?.basic.username,y=u?.basic.password;if(h!=null||y!=null){let E=(0,mwn.stringToBase64)([h||"",y||""].join(":"));m.set("Authorization",`Basic ${E}`)}let g=new Headers(u?.headers||{});for(let[E,P]of g)m.set(E,P);let _=m.get("cookie")||"";for(let[E,P]of Object.entries(u?.cookies||{}))_+=`; ${E}=${P}`;_=_.startsWith("; ")?_.slice(2):_,m.set("cookie",_);let w=new Headers(n?.fetchOptions?.headers);for(let[E,P]of w)m.set(E,P);_wn||m.set(r.uaHeader??"user-agent",VWt.SDK_METADATA.userAgent);let S=n?.fetchOptions;if(!S?.signal&&r.timeoutMs&&r.timeoutMs>0){let E=AbortSignal.timeout(r.timeoutMs);S?S.signal=E:S={signal:E}}r.body instanceof ReadableStream&&(S?S.duplex="half":S={duplex:"half"});let C;try{C=Ky(this,MO,"f").beforeCreateRequest(e,{url:c,options:{...S,body:r.body??null,headers:m,method:o}})}catch(E){return(0,u1.ERR)(new J3.UnexpectedClientError("Create request hook failed to execute",{cause:E}))}return(0,u1.OK)(new Request(C.url,C.options))}async _do(e,r){let{context:n,errorCodes:o}=r;return(0,ywn.retry)(async()=>{let i=await Ky(this,MO,"f").beforeRequest(n,e.clone());await vwn(Ky(this,gT,"f"),i).catch(s=>Ky(this,gT,"f")?.log("Failed to log request:",s));let a=await Ky(this,gme,"f").request(i);try{if((0,yT.matchStatusCode)(a,o)){let s=await Ky(this,MO,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await Ky(this,MO,"f").afterSuccess(n,a)}finally{await wwn(Ky(this,gT,"f"),a,i).catch(s=>Ky(this,gT,"f")?.log("Failed to log response:",s))}return a},{config:r.retryConfig,statusCodes:r.retryCodes}).then(i=>(0,u1.OK)(i),i=>{switch(!0){case(0,yT.isAbortError)(i):return(0,u1.ERR)(new J3.RequestAbortedError("Request aborted by client",{cause:i}));case(0,yT.isTimeoutError)(i):return(0,u1.ERR)(new J3.RequestTimeoutError("Request timed out",{cause:i}));case(0,yT.isConnectionError)(i):return(0,u1.ERR)(new J3.ConnectionError("Unable to make request",{cause:i}));default:return(0,u1.ERR)(new J3.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};l1.ClientSDK=Z4e;gme=new WeakMap,MO=new WeakMap,gT=new WeakMap;var WWt=/^application\/(?:.{0,100}\+)?json/;async function vwn(t,e){if(!t)return;let r=e.headers.get("content-type"),n=r?.split(";")[0]||"";t.group(`> Request: ${e.method} ${e.url}`),t.group("Headers:");for(let[o,i]of e.headers.entries())t.log(`${o}: ${i}`);switch(t.groupEnd(),t.group("Body:"),!0){case WWt.test(n):t.log(await e.clone().json());break;case n.startsWith("text/"):t.log(await e.clone().text());break;case n==="multipart/form-data":{let o=await e.clone().formData();for(let[i,a]of o){let s=a instanceof Blob?"<Blob>":a;t.log(`${i}: ${s}`)}break}default:t.log(`<${r}>`);break}t.groupEnd(),t.groupEnd()}async function wwn(t,e,r){if(!t)return;let n=e.headers.get("content-type"),o=n?.split(";")[0]||"";t.group(`< Response: ${r.method} ${r.url}`),t.log("Status Code:",e.status,e.statusText),t.group("Headers:");for(let[i,a]of e.headers.entries())t.log(`${i}: ${a}`);switch(t.groupEnd(),t.group("Body:"),!0){case((0,yT.matchContentType)(e,"application/json")||WWt.test(o)):t.log(await e.clone().json());break;case(0,yT.matchContentType)(e,"text/event-stream"):t.log(`<${n}>`);break;case(0,yT.matchContentType)(e,"text/*"):t.log(await e.clone().text());break;case(0,yT.matchContentType)(e,"multipart/form-data"):{let i=await e.clone().formData();for(let[a,s]of i){let u=s instanceof Blob?"<Blob>":s;t.log(`${a}: ${u}`)}break}default:t.log(`<${n}>`);break}t.groupEnd(),t.groupEnd()}});var X4e=x(yme=>{"use strict";Object.defineProperty(yme,"__esModule",{value:!0});yme.SDKError=void 0;var Y4e=class extends Error{constructor(e,r,n=""){let o=r.status,i=r.headers.get("content-type")||"",a=n.length>0?`
${n}`:"";super(`${e}: Status ${o} Content-Type ${i} Body ${a}`),this.rawResponse=r,this.body=n,this.statusCode=o,this.contentType=i,this.name="SDKError"}};yme.SDKError=Y4e});var UJ=x(zJ=>{"use strict";Object.defineProperty(zJ,"__esModule",{value:!0});zJ.EventStream=void 0;zJ.discardSentinel=Cwn;var $J=10,BJ=13,KWt=new Set([$J,BJ]),xwn=[new Uint8Array([BJ,$J,BJ,$J]),new Uint8Array([BJ,BJ]),new Uint8Array([$J,$J])],Q4e=class{constructor(e){this.stream=e.stream,this.decoder=e.decoder}async*[Symbol.asyncIterator](){let e=this.stream.getReader(),r=new Uint8Array([]),n=0;try{for(;;){let{done:o,value:i}=await e.read();if(o)break;let a=new Uint8Array(r.length+i.length);a.set(r),a.set(i,r.length),r=a;for(let s=n;s<r.length;s++){let u=GWt(r,s);if(u==null)continue;let l=r.slice(n,s);n=s+u.length;let c=e3e(l,this.decoder);c!=null&&(yield c)}n>0&&(r=r.slice(n),n=0)}if(r.length>0){let o=e3e(r,this.decoder);o!=null&&(yield o)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{e.releaseLock()}}};zJ.EventStream=Q4e;function GWt(t,e){let r=t[e],n=t[e+1];if(r==null||n==null||!KWt.has(r)||!KWt.has(n))return null;for(let o of xwn){let i=Swn(e,t,o);if(i!=null)return i}return null}function Swn(t,e,r){if(r.length>e.length-t)return null;for(let n=0;n<r.length;n++)if(e[t+n]!==r[n])return null;return r}function e3e(t,e){if(!t.length)return null;let o=new TextDecoder().decode(t).split(/\r?\n|\r/g),i=!1,a={};for(let s of o){if(!s)continue;let u=s.indexOf(":");if(u===0)continue;let l=u>0?s.substring(0,u):"",c=u>0?s.substring(u+1):"";switch(c.charAt(0)===" "&&(c=c.substring(1)),l){case"event":{i=!0,a.event=c;break}case"data":{i=!0,a.data??(a.data=""),a.data+=c+`
`;break}case"id":{i=!0,a.id=c;break}case"retry":{let d=parseInt(c,10);Number.isNaN(d)||(i=!0,a.retry=d);break}}}return i?(a.data!=null&&(a.data=a.data.slice(0,-1)),e(a)):null}function Cwn(t,e){return new ReadableStream({async start(r){let n=new Uint8Array([]),o=0,i=!1,a=!1,s=t.getReader();try{for(;!i;){let u=await s.read(),l=u.value;if(i=i||u.done,a||typeof l>"u")continue;let c=new Uint8Array(n.length+l.length);c.set(n),c.set(l,n.length),n=c;for(let d=o;d<n.length;d++){let f=GWt(n,d);if(f==null)continue;let p=o,m=n.slice(p,d);o=d+f.length,e3e(m,Own)?.data===e?(r.enqueue(n.slice(0,p)),a=!0):(r.enqueue(n.slice(0,o)),n=n.slice(o),o=0)}}}catch(u){r.error(u)}finally{r.close(),s.releaseLock()}}})}function Own(t){return t}});var n3e=x(k_=>{"use strict";var Ewn=k_&&k_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pwn=k_&&k_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Twn=k_&&k_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ewn(e,t,r);return Pwn(e,t),e};Object.defineProperty(k_,"__esModule",{value:!0});k_.SDKValidationError=void 0;k_.formatZodError=r3e;var Awn=Twn(Ae()),t3e=class extends Error{constructor(e,r,n){super(`${e}: ${r}`),this.name="SDKValidationError",this.cause=r,this.rawValue=n,this.rawMessage=e}pretty(){return this.cause instanceof Awn.ZodError?`${this.rawMessage}
${r3e(this.cause)}`:this.toString()}};k_.SDKValidationError=t3e;function r3e(t,e=0){let r=" ".repeat(e);r=e>0?`\u2502${r}`:r,r+=" ".repeat(e);let n="",o=s=>n+=`
${r}${s}`,i=t.issues.length,a=i===1?`${i} issue found`:`${i} issues found`;i&&o(`\u250C ${a}:`);for(let s of t.issues){let u=s.path.join(".");switch(u=u?`<root>.${u}`:"<root>",o(`\u2502 \u2022 [${u}]: ${s.message} (${s.code})`),s.code){case"invalid_literal":case"invalid_type":{o(`\u2502 Want: ${s.expected}`),o(`\u2502 Got: ${s.received}`);break}case"unrecognized_keys":{o(`\u2502 Keys: ${s.keys.join(", ")}`);break}case"invalid_enum_value":{o(`\u2502 Allowed: ${s.options.join(", ")}`),o(`\u2502 Got: ${s.received}`);break}case"invalid_union_discriminator":{o(`\u2502 Allowed: ${s.options.join(", ")}`);break}case"invalid_union":{let l=s.unionErrors.length;o(`\u2502 \u2716\uFE0E Attemped to deserialize into one of ${l} union members:`),s.unionErrors.forEach((c,d)=>{o(`\u2502 \u2716\uFE0E Member ${d+1} of ${l}`),o(`${r3e(c,e+1)}`)})}}}return t.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var Oe=x(qJ=>{"use strict";Object.defineProperty(qJ,"__esModule",{value:!0});qJ.parse=Mwn;qJ.safeParse=Rwn;qJ.collectExtraKeys=Nwn;var Iwn=Ae(),ZWt=n3e(),JWt=qy();function Mwn(t,e,r){try{return e(t)}catch(n){throw n instanceof Iwn.ZodError?new ZWt.SDKValidationError(r,n,t):n}}function Rwn(t,e,r){try{return(0,JWt.OK)(e(t))}catch(n){return(0,JWt.ERR)(new ZWt.SDKValidationError(r,n,t))}}function Nwn(t,e,r){return t.transform(n=>{let o={},{shape:i}=t;for(let[a]of Object.entries(n)){if(a in i)continue;let s=n[a];typeof s>"u"||(o[a]=s,delete n[a])}return r&&Object.keys(o).length===0?n:{...n,[e]:o}})}});var Si=x(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.jsonErr=Lwn;nd.json=Fwn;nd.textErr=kwn;nd.text=$wn;nd.bytesErr=Bwn;nd.bytes=zwn;nd.streamErr=Uwn;nd.stream=qwn;nd.sseErr=Hwn;nd.sse=Vwn;nd.nilErr=Wwn;nd.nil=Kwn;nd.fail=Gwn;nd.match=Jwn;nd.unpackHeaders=bme;nd.discardResponseBody=t9t;var YWt=X4e(),jwn=UJ(),XWt=LJ(),QWt=q4e(),e9t=Oe(),Dwn={json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function Lwn(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function Fwn(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function kwn(t,e,r){return{...r,err:!0,enc:"text",codes:t,schema:e}}function $wn(t,e,r){return{...r,enc:"text",codes:t,schema:e}}function Bwn(t,e,r){return{...r,err:!0,enc:"bytes",codes:t,schema:e}}function zwn(t,e,r){return{...r,enc:"bytes",codes:t,schema:e}}function Uwn(t,e,r){return{...r,err:!0,enc:"stream",codes:t,schema:e}}function qwn(t,e,r){return{...r,enc:"stream",codes:t,schema:e}}function Hwn(t,e,r){return{...r,err:!0,enc:"sse",codes:t,schema:e}}function Vwn(t,e,r){return{...r,enc:"sse",codes:t,schema:e}}function Wwn(t,e,r){return{...r,err:!0,enc:"nil",codes:t,schema:e}}function Kwn(t,e,r){return{...r,enc:"nil",codes:t,schema:e}}function Gwn(t){return{enc:"fail",codes:t}}function Jwn(...t){return async function(r,n){let o,i;for(let l of t){let{codes:c}=l,d="ctype"in l?l.ctype:Dwn[l.enc];if(d&&(0,XWt.matchResponse)(r,c,d)){i=l;break}else if(!d&&(0,XWt.matchStatusCode)(r,c)){i=l;break}}if(!i){let l=await r.text();return[{ok:!1,error:new YWt.SDKError("Unexpected API response status or content-type",r,l)},l]}let a=i.enc;switch(a){case"json":o=await r.json();break;case"bytes":o=new Uint8Array(await r.arrayBuffer());break;case"stream":o=r.body;break;case"text":o=await r.text();break;case"sse":o=r.body&&i.sseSentinel?(0,jwn.discardSentinel)(r.body,i.sseSentinel):r.body;break;case"nil":o=await t9t(r);break;case"fail":o=await r.text();break;default:throw new Error(`Unsupported response type: ${a}`)}if(i.enc==="fail")return[{ok:!1,error:new YWt.SDKError("API error occurred",r,typeof o=="string"?o:"")},o];let s=i.key||n?.resultKey,u;if("err"in i?u={...n?.extraFields,...i.hdrs?{Headers:bme(r.headers)}:null,...(0,QWt.isPlainObject)(o)?o:null}:s?u={...n?.extraFields,...i.hdrs?{Headers:bme(r.headers)}:null,[s]:o}:i.hdrs?u={...n?.extraFields,...i.hdrs?{Headers:bme(r.headers)}:null,...(0,QWt.isPlainObject)(o)?o:null}:u=o,"err"in i){let l=(0,e9t.safeParse)(u,c=>i.schema.parse(c),"Response validation failed");return[l.ok?{ok:!1,error:l.value}:l,o]}else return[(0,e9t.safeParse)(u,l=>i.schema.parse(l),"Response validation failed"),o]}}var Zwn=/, */;function bme(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(Zwn);return e}async function t9t(t){let e=t.body?.getReader();if(e!=null)try{let r=!1;for(;!r;)r=(await e.read()).done}finally{e.releaseLock()}}});var He=x(Rk=>{"use strict";Object.defineProperty(Rk,"__esModule",{value:!0});Rk.invariant=Ywn;Rk.remap=Xwn;Rk.combineSignals=Qwn;Rk.abortSignalAny=r9t;Rk.compactMap=e0n;var o3e=class extends Error{constructor(e){super(e),this.name="InvariantError"}};function Ywn(t,e){if(!t)throw new o3e(e)}function Xwn(t,e){let r={};if(!Object.keys(e).length)return r=t,r;for(let[n,o]of Object.entries(t)){let i=e[n];i!==null&&(r[i??n]=o)}return r}function Qwn(...t){let e=[];for(let r of t)r&&e.push(r);switch(e.length){case 0:case 1:return e[0]||null;default:return"any"in AbortSignal&&typeof AbortSignal.any=="function"?AbortSignal.any(e):r9t(e)}}function r9t(t){let e=new AbortController,r=e.signal;if(!t.length)return e.signal;if(t.length===1)return t[0]||e.signal;for(let a of t)if(a.aborted)return a;function n(){e.abort(this.reason),i()}let o=[];function i(){for(let a of o){let s=a.deref();s&&s.removeEventListener("abort",n)}}for(let a of t)o.push(new WeakRef(a)),a.addEventListener("abort",n);return r}function e0n(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}});var Ci=x(bT=>{"use strict";Object.defineProperty(bT,"__esModule",{value:!0});bT.SecurityError=bT.SecurityErrorCode=void 0;bT.resolveSecurity=n9t;bT.resolveGlobalSecurity=n0n;bT.extractSecurity=o0n;var t0n=G4e(),vme;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(vme||(bT.SecurityErrorCode=vme={}));var wme=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(vme.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(vme.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};bT.SecurityError=wme;function n9t(...t){let e={basic:{},headers:{},queryParams:{},cookies:{},oauth2:{type:"none"}},r=t.find(n=>n.every(o=>{if(o.value==null)return!1;if(o.type==="http:basic")return o.value.username!=null||o.value.password!=null;if(o.type==="http:custom")return null;if(o.type==="oauth2:password")return typeof o.value=="string"&&!!o.value;if(o.type==="oauth2:client_credentials")return o.value.clientID!=null||o.value.clientSecret!=null;if(typeof o.value=="string")return!!o.value;throw new Error(`Unrecognized security type: ${o.type} (value type: ${typeof o.value})`)}));return r==null?null:(r.forEach(n=>{if(n.value==null)return;let{type:o}=n;switch(o){case"apiKey:header":e.headers[n.fieldName]=n.value;break;case"apiKey:query":e.queryParams[n.fieldName]=n.value;break;case"apiKey:cookie":e.cookies[n.fieldName]=n.value;break;case"http:basic":r0n(e,n);break;case"http:custom":break;case"http:bearer":_me(e,n);break;case"oauth2":_me(e,n);break;case"oauth2:password":_me(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":_me(e,n);break;default:throw wme.unrecognizedType(o)}}),e)}function r0n(t,e){e.value!=null&&(t.basic=e.value)}function _me(t,e){if(typeof e.value!="string"||!e.value)return;let r=e.value;r.slice(0,7).toLowerCase()!=="bearer "&&(r=`Bearer ${r}`),t.headers[e.fieldName]=r}function n0n(t){return n9t([{fieldName:"Authorization",type:"http:bearer",value:t?.apiKey??(0,t0n.env)().MISTRAL_API_KEY}])}async function o0n(t){if(t!=null)return typeof t=="function"?t():t}});var i3e=x(Lu=>{"use strict";var i0n=Lu&&Lu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),a0n=Lu&&Lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s0n=Lu&&Lu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&i0n(e,t,r);return a0n(e,t),e};Object.defineProperty(Lu,"__esModule",{value:!0});Lu.ImageURL$=Lu.ImageURL$outboundSchema=Lu.ImageURL$inboundSchema=void 0;Lu.imageURLToJSON=l0n;Lu.imageURLFromJSON=c0n;var c1=s0n(Ae()),u0n=Oe();Lu.ImageURL$inboundSchema=c1.object({url:c1.string(),detail:c1.nullable(c1.string()).optional()});Lu.ImageURL$outboundSchema=c1.object({url:c1.string(),detail:c1.nullable(c1.string()).optional()});var o9t;(function(t){t.inboundSchema=Lu.ImageURL$inboundSchema,t.outboundSchema=Lu.ImageURL$outboundSchema})(o9t||(Lu.ImageURL$=o9t={}));function l0n(t){return JSON.stringify(Lu.ImageURL$outboundSchema.parse(t))}function c0n(t){return(0,u0n.safeParse)(t,e=>Lu.ImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURL' from JSON")}});var a3e=x(Hr=>{"use strict";var d0n=Hr&&Hr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f0n=Hr&&Hr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p0n=Hr&&Hr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&d0n(e,t,r);return f0n(e,t),e};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.ImageURLChunk$=Hr.ImageURLChunk$outboundSchema=Hr.ImageURLChunk$inboundSchema=Hr.ImageURLChunkType$=Hr.ImageURLChunkType$outboundSchema=Hr.ImageURLChunkType$inboundSchema=Hr.ImageURLChunkImageURL$=Hr.ImageURLChunkImageURL$outboundSchema=Hr.ImageURLChunkImageURL$inboundSchema=Hr.ImageURLChunkType=void 0;Hr.imageURLChunkImageURLToJSON=m0n;Hr.imageURLChunkImageURLFromJSON=h0n;Hr.imageURLChunkToJSON=g0n;Hr.imageURLChunkFromJSON=y0n;var $_=p0n(Ae()),u9t=He(),l9t=Oe(),xme=i3e();Hr.ImageURLChunkType={ImageUrl:"image_url"};Hr.ImageURLChunkImageURL$inboundSchema=$_.union([xme.ImageURL$inboundSchema,$_.string()]);Hr.ImageURLChunkImageURL$outboundSchema=$_.union([xme.ImageURL$outboundSchema,$_.string()]);var i9t;(function(t){t.inboundSchema=Hr.ImageURLChunkImageURL$inboundSchema,t.outboundSchema=Hr.ImageURLChunkImageURL$outboundSchema})(i9t||(Hr.ImageURLChunkImageURL$=i9t={}));function m0n(t){return JSON.stringify(Hr.ImageURLChunkImageURL$outboundSchema.parse(t))}function h0n(t){return(0,l9t.safeParse)(t,e=>Hr.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}Hr.ImageURLChunkType$inboundSchema=$_.nativeEnum(Hr.ImageURLChunkType);Hr.ImageURLChunkType$outboundSchema=Hr.ImageURLChunkType$inboundSchema;var a9t;(function(t){t.inboundSchema=Hr.ImageURLChunkType$inboundSchema,t.outboundSchema=Hr.ImageURLChunkType$outboundSchema})(a9t||(Hr.ImageURLChunkType$=a9t={}));Hr.ImageURLChunk$inboundSchema=$_.object({image_url:$_.union([xme.ImageURL$inboundSchema,$_.string()]),type:Hr.ImageURLChunkType$inboundSchema.default("image_url")}).transform(t=>(0,u9t.remap)(t,{image_url:"imageUrl"}));Hr.ImageURLChunk$outboundSchema=$_.object({imageUrl:$_.union([xme.ImageURL$outboundSchema,$_.string()]),type:Hr.ImageURLChunkType$outboundSchema.default("image_url")}).transform(t=>(0,u9t.remap)(t,{imageUrl:"image_url"}));var s9t;(function(t){t.inboundSchema=Hr.ImageURLChunk$inboundSchema,t.outboundSchema=Hr.ImageURLChunk$outboundSchema})(s9t||(Hr.ImageURLChunk$=s9t={}));function g0n(t){return JSON.stringify(Hr.ImageURLChunk$outboundSchema.parse(t))}function y0n(t){return(0,l9t.safeParse)(t,e=>Hr.ImageURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunk' from JSON")}});var s3e=x(Ao=>{"use strict";var b0n=Ao&&Ao.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_0n=Ao&&Ao.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v0n=Ao&&Ao.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&b0n(e,t,r);return _0n(e,t),e};Object.defineProperty(Ao,"__esModule",{value:!0});Ao.ReferenceChunk$=Ao.ReferenceChunk$outboundSchema=Ao.ReferenceChunk$inboundSchema=Ao.ReferenceChunkType$=Ao.ReferenceChunkType$outboundSchema=Ao.ReferenceChunkType$inboundSchema=Ao.ReferenceChunkType=void 0;Ao.referenceChunkToJSON=x0n;Ao.referenceChunkFromJSON=S0n;var Nk=v0n(Ae()),f9t=He(),w0n=Oe();Ao.ReferenceChunkType={Reference:"reference"};Ao.ReferenceChunkType$inboundSchema=Nk.nativeEnum(Ao.ReferenceChunkType);Ao.ReferenceChunkType$outboundSchema=Ao.ReferenceChunkType$inboundSchema;var c9t;(function(t){t.inboundSchema=Ao.ReferenceChunkType$inboundSchema,t.outboundSchema=Ao.ReferenceChunkType$outboundSchema})(c9t||(Ao.ReferenceChunkType$=c9t={}));Ao.ReferenceChunk$inboundSchema=Nk.object({reference_ids:Nk.array(Nk.number().int()),type:Ao.ReferenceChunkType$inboundSchema.default("reference")}).transform(t=>(0,f9t.remap)(t,{reference_ids:"referenceIds"}));Ao.ReferenceChunk$outboundSchema=Nk.object({referenceIds:Nk.array(Nk.number().int()),type:Ao.ReferenceChunkType$outboundSchema.default("reference")}).transform(t=>(0,f9t.remap)(t,{referenceIds:"reference_ids"}));var d9t;(function(t){t.inboundSchema=Ao.ReferenceChunk$inboundSchema,t.outboundSchema=Ao.ReferenceChunk$outboundSchema})(d9t||(Ao.ReferenceChunk$=d9t={}));function x0n(t){return JSON.stringify(Ao.ReferenceChunk$outboundSchema.parse(t))}function S0n(t){return(0,w0n.safeParse)(t,e=>Ao.ReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ReferenceChunk' from JSON")}});var Sme=x(Io=>{"use strict";var C0n=Io&&Io.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O0n=Io&&Io.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E0n=Io&&Io.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&C0n(e,t,r);return O0n(e,t),e};Object.defineProperty(Io,"__esModule",{value:!0});Io.TextChunk$=Io.TextChunk$outboundSchema=Io.TextChunk$inboundSchema=Io.TextChunkType$=Io.TextChunkType$outboundSchema=Io.TextChunkType$inboundSchema=Io.TextChunkType=void 0;Io.textChunkToJSON=T0n;Io.textChunkFromJSON=A0n;var HJ=E0n(Ae()),P0n=Oe();Io.TextChunkType={Text:"text"};Io.TextChunkType$inboundSchema=HJ.nativeEnum(Io.TextChunkType);Io.TextChunkType$outboundSchema=Io.TextChunkType$inboundSchema;var p9t;(function(t){t.inboundSchema=Io.TextChunkType$inboundSchema,t.outboundSchema=Io.TextChunkType$outboundSchema})(p9t||(Io.TextChunkType$=p9t={}));Io.TextChunk$inboundSchema=HJ.object({text:HJ.string(),type:Io.TextChunkType$inboundSchema.default("text")});Io.TextChunk$outboundSchema=HJ.object({text:HJ.string(),type:Io.TextChunkType$outboundSchema.default("text")});var m9t;(function(t){t.inboundSchema=Io.TextChunk$inboundSchema,t.outboundSchema=Io.TextChunk$outboundSchema})(m9t||(Io.TextChunk$=m9t={}));function T0n(t){return JSON.stringify(Io.TextChunk$outboundSchema.parse(t))}function A0n(t){return(0,P0n.safeParse)(t,e=>Io.TextChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TextChunk' from JSON")}});var Z3=x(Fu=>{"use strict";var I0n=Fu&&Fu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M0n=Fu&&Fu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R0n=Fu&&Fu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&I0n(e,t,r);return M0n(e,t),e};Object.defineProperty(Fu,"__esModule",{value:!0});Fu.ContentChunk$=Fu.ContentChunk$outboundSchema=Fu.ContentChunk$inboundSchema=void 0;Fu.contentChunkToJSON=j0n;Fu.contentChunkFromJSON=D0n;var ph=R0n(Ae()),N0n=Oe(),g9t=a3e(),y9t=s3e(),b9t=Sme();Fu.ContentChunk$inboundSchema=ph.union([g9t.ImageURLChunk$inboundSchema.and(ph.object({type:ph.literal("image_url")}).transform(t=>({type:t.type}))),b9t.TextChunk$inboundSchema.and(ph.object({type:ph.literal("text")}).transform(t=>({type:t.type}))),y9t.ReferenceChunk$inboundSchema.and(ph.object({type:ph.literal("reference")}).transform(t=>({type:t.type})))]);Fu.ContentChunk$outboundSchema=ph.union([g9t.ImageURLChunk$outboundSchema.and(ph.object({type:ph.literal("image_url")}).transform(t=>({type:t.type}))),b9t.TextChunk$outboundSchema.and(ph.object({type:ph.literal("text")}).transform(t=>({type:t.type}))),y9t.ReferenceChunk$outboundSchema.and(ph.object({type:ph.literal("reference")}).transform(t=>({type:t.type})))]);var h9t;(function(t){t.inboundSchema=Fu.ContentChunk$inboundSchema,t.outboundSchema=Fu.ContentChunk$outboundSchema})(h9t||(Fu.ContentChunk$=h9t={}));function j0n(t){return JSON.stringify(Fu.ContentChunk$outboundSchema.parse(t))}function D0n(t){return(0,N0n.safeParse)(t,e=>Fu.ContentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ContentChunk' from JSON")}});var u3e=x(Vo=>{"use strict";var L0n=Vo&&Vo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F0n=Vo&&Vo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k0n=Vo&&Vo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L0n(e,t,r);return F0n(e,t),e};Object.defineProperty(Vo,"__esModule",{value:!0});Vo.FunctionCall$=Vo.FunctionCall$outboundSchema=Vo.FunctionCall$inboundSchema=Vo.Arguments$=Vo.Arguments$outboundSchema=Vo.Arguments$inboundSchema=void 0;Vo.argumentsToJSON=$0n;Vo.argumentsFromJSON=B0n;Vo.functionCallToJSON=z0n;Vo.functionCallFromJSON=U0n;var ku=k0n(Ae()),w9t=Oe();Vo.Arguments$inboundSchema=ku.union([ku.record(ku.any()),ku.string()]);Vo.Arguments$outboundSchema=ku.union([ku.record(ku.any()),ku.string()]);var _9t;(function(t){t.inboundSchema=Vo.Arguments$inboundSchema,t.outboundSchema=Vo.Arguments$outboundSchema})(_9t||(Vo.Arguments$=_9t={}));function $0n(t){return JSON.stringify(Vo.Arguments$outboundSchema.parse(t))}function B0n(t){return(0,w9t.safeParse)(t,e=>Vo.Arguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Arguments' from JSON")}Vo.FunctionCall$inboundSchema=ku.object({name:ku.string(),arguments:ku.union([ku.record(ku.any()),ku.string()])});Vo.FunctionCall$outboundSchema=ku.object({name:ku.string(),arguments:ku.union([ku.record(ku.any()),ku.string()])});var v9t;(function(t){t.inboundSchema=Vo.FunctionCall$inboundSchema,t.outboundSchema=Vo.FunctionCall$outboundSchema})(v9t||(Vo.FunctionCall$=v9t={}));function z0n(t){return JSON.stringify(Vo.FunctionCall$outboundSchema.parse(t))}function U0n(t){return(0,w9t.safeParse)(t,e=>Vo.FunctionCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCall' from JSON")}});var d1=x(l3e=>{"use strict";Object.defineProperty(l3e,"__esModule",{value:!0});l3e.catchUnrecognizedEnum=q0n;function q0n(t){return t}});var VJ=x($u=>{"use strict";var H0n=$u&&$u.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V0n=$u&&$u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W0n=$u&&$u.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&H0n(e,t,r);return V0n(e,t),e};Object.defineProperty($u,"__esModule",{value:!0});$u.ToolTypes$=$u.ToolTypes$outboundSchema=$u.ToolTypes$inboundSchema=$u.ToolTypes=void 0;var jk=W0n(Ae()),K0n=d1();$u.ToolTypes={Function:"function"};$u.ToolTypes$inboundSchema=jk.union([jk.nativeEnum($u.ToolTypes),jk.string().transform(K0n.catchUnrecognizedEnum)]);$u.ToolTypes$outboundSchema=jk.union([jk.nativeEnum($u.ToolTypes),jk.string().and(jk.custom())]);var x9t;(function(t){t.inboundSchema=$u.ToolTypes$inboundSchema,t.outboundSchema=$u.ToolTypes$outboundSchema})(x9t||($u.ToolTypes$=x9t={}))});var Cme=x(Bu=>{"use strict";var G0n=Bu&&Bu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J0n=Bu&&Bu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z0n=Bu&&Bu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&G0n(e,t,r);return J0n(e,t),e};Object.defineProperty(Bu,"__esModule",{value:!0});Bu.ToolCall$=Bu.ToolCall$outboundSchema=Bu.ToolCall$inboundSchema=void 0;Bu.toolCallToJSON=X0n;Bu.toolCallFromJSON=Q0n;var Y3=Z0n(Ae()),Y0n=Oe(),C9t=u3e(),O9t=VJ();Bu.ToolCall$inboundSchema=Y3.object({id:Y3.string().default("null"),type:O9t.ToolTypes$inboundSchema.optional(),function:C9t.FunctionCall$inboundSchema,index:Y3.number().int().default(0)});Bu.ToolCall$outboundSchema=Y3.object({id:Y3.string().default("null"),type:O9t.ToolTypes$outboundSchema.optional(),function:C9t.FunctionCall$outboundSchema,index:Y3.number().int().default(0)});var S9t;(function(t){t.inboundSchema=Bu.ToolCall$inboundSchema,t.outboundSchema=Bu.ToolCall$outboundSchema})(S9t||(Bu.ToolCall$=S9t={}));function X0n(t){return JSON.stringify(Bu.ToolCall$outboundSchema.parse(t))}function Q0n(t){return(0,Y0n.safeParse)(t,e=>Bu.ToolCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolCall' from JSON")}});var f1=x(Vr=>{"use strict";var exn=Vr&&Vr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),txn=Vr&&Vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rxn=Vr&&Vr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&exn(e,t,r);return txn(e,t),e};Object.defineProperty(Vr,"__esModule",{value:!0});Vr.AssistantMessage$=Vr.AssistantMessage$outboundSchema=Vr.AssistantMessage$inboundSchema=Vr.AssistantMessageRole$=Vr.AssistantMessageRole$outboundSchema=Vr.AssistantMessageRole$inboundSchema=Vr.AssistantMessageContent$=Vr.AssistantMessageContent$outboundSchema=Vr.AssistantMessageContent$inboundSchema=Vr.AssistantMessageRole=void 0;Vr.assistantMessageContentToJSON=nxn;Vr.assistantMessageContentFromJSON=oxn;Vr.assistantMessageToJSON=ixn;Vr.assistantMessageFromJSON=axn;var xs=rxn(Ae()),A9t=He(),I9t=Oe(),Ome=Z3(),M9t=Cme();Vr.AssistantMessageRole={Assistant:"assistant"};Vr.AssistantMessageContent$inboundSchema=xs.union([xs.string(),xs.array(Ome.ContentChunk$inboundSchema)]);Vr.AssistantMessageContent$outboundSchema=xs.union([xs.string(),xs.array(Ome.ContentChunk$outboundSchema)]);var E9t;(function(t){t.inboundSchema=Vr.AssistantMessageContent$inboundSchema,t.outboundSchema=Vr.AssistantMessageContent$outboundSchema})(E9t||(Vr.AssistantMessageContent$=E9t={}));function nxn(t){return JSON.stringify(Vr.AssistantMessageContent$outboundSchema.parse(t))}function oxn(t){return(0,I9t.safeParse)(t,e=>Vr.AssistantMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessageContent' from JSON")}Vr.AssistantMessageRole$inboundSchema=xs.nativeEnum(Vr.AssistantMessageRole);Vr.AssistantMessageRole$outboundSchema=Vr.AssistantMessageRole$inboundSchema;var P9t;(function(t){t.inboundSchema=Vr.AssistantMessageRole$inboundSchema,t.outboundSchema=Vr.AssistantMessageRole$outboundSchema})(P9t||(Vr.AssistantMessageRole$=P9t={}));Vr.AssistantMessage$inboundSchema=xs.object({content:xs.nullable(xs.union([xs.string(),xs.array(Ome.ContentChunk$inboundSchema)])).optional(),tool_calls:xs.nullable(xs.array(M9t.ToolCall$inboundSchema)).optional(),prefix:xs.boolean().default(!1),role:Vr.AssistantMessageRole$inboundSchema.default("assistant")}).transform(t=>(0,A9t.remap)(t,{tool_calls:"toolCalls"}));Vr.AssistantMessage$outboundSchema=xs.object({content:xs.nullable(xs.union([xs.string(),xs.array(Ome.ContentChunk$outboundSchema)])).optional(),toolCalls:xs.nullable(xs.array(M9t.ToolCall$outboundSchema)).optional(),prefix:xs.boolean().default(!1),role:Vr.AssistantMessageRole$outboundSchema.default("assistant")}).transform(t=>(0,A9t.remap)(t,{toolCalls:"tool_calls"}));var T9t;(function(t){t.inboundSchema=Vr.AssistantMessage$inboundSchema,t.outboundSchema=Vr.AssistantMessage$outboundSchema})(T9t||(Vr.AssistantMessage$=T9t={}));function ixn(t){return JSON.stringify(Vr.AssistantMessage$outboundSchema.parse(t))}function axn(t){return(0,I9t.safeParse)(t,e=>Vr.AssistantMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessage' from JSON")}});var X3=x(Wo=>{"use strict";var sxn=Wo&&Wo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uxn=Wo&&Wo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lxn=Wo&&Wo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sxn(e,t,r);return uxn(e,t),e};Object.defineProperty(Wo,"__esModule",{value:!0});Wo.Prediction$=Wo.Prediction$outboundSchema=Wo.Prediction$inboundSchema=Wo.PredictionType$=Wo.PredictionType$outboundSchema=Wo.PredictionType$inboundSchema=Wo.PredictionType=void 0;Wo.predictionToJSON=dxn;Wo.predictionFromJSON=fxn;var Dk=lxn(Ae()),cxn=Oe();Wo.PredictionType={Content:"content"};Wo.PredictionType$inboundSchema=Dk.nativeEnum(Wo.PredictionType);Wo.PredictionType$outboundSchema=Wo.PredictionType$inboundSchema;var R9t;(function(t){t.inboundSchema=Wo.PredictionType$inboundSchema,t.outboundSchema=Wo.PredictionType$outboundSchema})(R9t||(Wo.PredictionType$=R9t={}));Wo.Prediction$inboundSchema=Dk.object({type:Dk.literal("content").default("content"),content:Dk.string().default("")});Wo.Prediction$outboundSchema=Dk.object({type:Dk.literal("content").default("content"),content:Dk.string().default("")});var N9t;(function(t){t.inboundSchema=Wo.Prediction$inboundSchema,t.outboundSchema=Wo.Prediction$outboundSchema})(N9t||(Wo.Prediction$=N9t={}));function dxn(t){return JSON.stringify(Wo.Prediction$outboundSchema.parse(t))}function fxn(t){return(0,cxn.safeParse)(t,e=>Wo.Prediction$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Prediction' from JSON")}});var c3e=x(zu=>{"use strict";var pxn=zu&&zu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mxn=zu&&zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hxn=zu&&zu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pxn(e,t,r);return mxn(e,t),e};Object.defineProperty(zu,"__esModule",{value:!0});zu.JsonSchema$=zu.JsonSchema$outboundSchema=zu.JsonSchema$inboundSchema=void 0;zu.jsonSchemaToJSON=yxn;zu.jsonSchemaFromJSON=bxn;var mh=hxn(Ae()),D9t=He(),gxn=Oe();zu.JsonSchema$inboundSchema=mh.object({name:mh.string(),description:mh.nullable(mh.string()).optional(),schema:mh.record(mh.any()),strict:mh.boolean().default(!1)}).transform(t=>(0,D9t.remap)(t,{schema:"schemaDefinition"}));zu.JsonSchema$outboundSchema=mh.object({name:mh.string(),description:mh.nullable(mh.string()).optional(),schemaDefinition:mh.record(mh.any()),strict:mh.boolean().default(!1)}).transform(t=>(0,D9t.remap)(t,{schemaDefinition:"schema"}));var j9t;(function(t){t.inboundSchema=zu.JsonSchema$inboundSchema,t.outboundSchema=zu.JsonSchema$outboundSchema})(j9t||(zu.JsonSchema$=j9t={}));function yxn(t){return JSON.stringify(zu.JsonSchema$outboundSchema.parse(t))}function bxn(t){return(0,gxn.safeParse)(t,e=>zu.JsonSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JsonSchema' from JSON")}});var d3e=x(Uu=>{"use strict";var _xn=Uu&&Uu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vxn=Uu&&Uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wxn=Uu&&Uu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_xn(e,t,r);return vxn(e,t),e};Object.defineProperty(Uu,"__esModule",{value:!0});Uu.ResponseFormats$=Uu.ResponseFormats$outboundSchema=Uu.ResponseFormats$inboundSchema=Uu.ResponseFormats=void 0;var xxn=wxn(Ae());Uu.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};Uu.ResponseFormats$inboundSchema=xxn.nativeEnum(Uu.ResponseFormats);Uu.ResponseFormats$outboundSchema=Uu.ResponseFormats$inboundSchema;var L9t;(function(t){t.inboundSchema=Uu.ResponseFormats$inboundSchema,t.outboundSchema=Uu.ResponseFormats$outboundSchema})(L9t||(Uu.ResponseFormats$=L9t={}))});var Q3=x(qu=>{"use strict";var Sxn=qu&&qu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cxn=qu&&qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Oxn=qu&&qu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Sxn(e,t,r);return Cxn(e,t),e};Object.defineProperty(qu,"__esModule",{value:!0});qu.ResponseFormat$=qu.ResponseFormat$outboundSchema=qu.ResponseFormat$inboundSchema=void 0;qu.responseFormatToJSON=Pxn;qu.responseFormatFromJSON=Txn;var Eme=Oxn(Ae()),k9t=He(),Exn=Oe(),$9t=c3e(),B9t=d3e();qu.ResponseFormat$inboundSchema=Eme.object({type:B9t.ResponseFormats$inboundSchema.optional(),json_schema:Eme.nullable($9t.JsonSchema$inboundSchema).optional()}).transform(t=>(0,k9t.remap)(t,{json_schema:"jsonSchema"}));qu.ResponseFormat$outboundSchema=Eme.object({type:B9t.ResponseFormats$outboundSchema.optional(),jsonSchema:Eme.nullable($9t.JsonSchema$outboundSchema).optional()}).transform(t=>(0,k9t.remap)(t,{jsonSchema:"json_schema"}));var F9t;(function(t){t.inboundSchema=qu.ResponseFormat$inboundSchema,t.outboundSchema=qu.ResponseFormat$outboundSchema})(F9t||(qu.ResponseFormat$=F9t={}));function Pxn(t){return JSON.stringify(qu.ResponseFormat$outboundSchema.parse(t))}function Txn(t){return(0,Exn.safeParse)(t,e=>qu.ResponseFormat$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseFormat' from JSON")}});var Lk=x(Wr=>{"use strict";var Axn=Wr&&Wr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ixn=Wr&&Wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mxn=Wr&&Wr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Axn(e,t,r);return Ixn(e,t),e};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.SystemMessage$=Wr.SystemMessage$outboundSchema=Wr.SystemMessage$inboundSchema=Wr.Role$=Wr.Role$outboundSchema=Wr.Role$inboundSchema=Wr.SystemMessageContent$=Wr.SystemMessageContent$outboundSchema=Wr.SystemMessageContent$inboundSchema=Wr.Role=void 0;Wr.systemMessageContentToJSON=Rxn;Wr.systemMessageContentFromJSON=Nxn;Wr.systemMessageToJSON=jxn;Wr.systemMessageFromJSON=Dxn;var Qp=Mxn(Ae()),H9t=Oe(),Pme=Sme();Wr.Role={System:"system"};Wr.SystemMessageContent$inboundSchema=Qp.union([Qp.string(),Qp.array(Pme.TextChunk$inboundSchema)]);Wr.SystemMessageContent$outboundSchema=Qp.union([Qp.string(),Qp.array(Pme.TextChunk$outboundSchema)]);var z9t;(function(t){t.inboundSchema=Wr.SystemMessageContent$inboundSchema,t.outboundSchema=Wr.SystemMessageContent$outboundSchema})(z9t||(Wr.SystemMessageContent$=z9t={}));function Rxn(t){return JSON.stringify(Wr.SystemMessageContent$outboundSchema.parse(t))}function Nxn(t){return(0,H9t.safeParse)(t,e=>Wr.SystemMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContent' from JSON")}Wr.Role$inboundSchema=Qp.nativeEnum(Wr.Role);Wr.Role$outboundSchema=Wr.Role$inboundSchema;var U9t;(function(t){t.inboundSchema=Wr.Role$inboundSchema,t.outboundSchema=Wr.Role$outboundSchema})(U9t||(Wr.Role$=U9t={}));Wr.SystemMessage$inboundSchema=Qp.object({content:Qp.union([Qp.string(),Qp.array(Pme.TextChunk$inboundSchema)]),role:Wr.Role$inboundSchema.default("system")});Wr.SystemMessage$outboundSchema=Qp.object({content:Qp.union([Qp.string(),Qp.array(Pme.TextChunk$outboundSchema)]),role:Wr.Role$outboundSchema.default("system")});var q9t;(function(t){t.inboundSchema=Wr.SystemMessage$inboundSchema,t.outboundSchema=Wr.SystemMessage$outboundSchema})(q9t||(Wr.SystemMessage$=q9t={}));function jxn(t){return JSON.stringify(Wr.SystemMessage$outboundSchema.parse(t))}function Dxn(t){return(0,H9t.safeParse)(t,e=>Wr.SystemMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessage' from JSON")}});var f3e=x(Hu=>{"use strict";var Lxn=Hu&&Hu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fxn=Hu&&Hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kxn=Hu&&Hu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lxn(e,t,r);return Fxn(e,t),e};Object.defineProperty(Hu,"__esModule",{value:!0});Hu.FunctionT$=Hu.FunctionT$outboundSchema=Hu.FunctionT$inboundSchema=void 0;Hu.functionToJSON=Bxn;Hu.functionFromJSON=zxn;var Gy=kxn(Ae()),$xn=Oe();Hu.FunctionT$inboundSchema=Gy.object({name:Gy.string(),description:Gy.string().default(""),strict:Gy.boolean().default(!1),parameters:Gy.record(Gy.any())});Hu.FunctionT$outboundSchema=Gy.object({name:Gy.string(),description:Gy.string().default(""),strict:Gy.boolean().default(!1),parameters:Gy.record(Gy.any())});var V9t;(function(t){t.inboundSchema=Hu.FunctionT$inboundSchema,t.outboundSchema=Hu.FunctionT$outboundSchema})(V9t||(Hu.FunctionT$=V9t={}));function Bxn(t){return JSON.stringify(Hu.FunctionT$outboundSchema.parse(t))}function zxn(t){return(0,$xn.safeParse)(t,e=>Hu.FunctionT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionT' from JSON")}});var eH=x(Vu=>{"use strict";var Uxn=Vu&&Vu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qxn=Vu&&Vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hxn=Vu&&Vu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Uxn(e,t,r);return qxn(e,t),e};Object.defineProperty(Vu,"__esModule",{value:!0});Vu.Tool$=Vu.Tool$outboundSchema=Vu.Tool$inboundSchema=void 0;Vu.toolToJSON=Wxn;Vu.toolFromJSON=Kxn;var K9t=Hxn(Ae()),Vxn=Oe(),G9t=f3e(),J9t=VJ();Vu.Tool$inboundSchema=K9t.object({type:J9t.ToolTypes$inboundSchema.optional(),function:G9t.FunctionT$inboundSchema});Vu.Tool$outboundSchema=K9t.object({type:J9t.ToolTypes$outboundSchema.optional(),function:G9t.FunctionT$outboundSchema});var W9t;(function(t){t.inboundSchema=Vu.Tool$inboundSchema,t.outboundSchema=Vu.Tool$outboundSchema})(W9t||(Vu.Tool$=W9t={}));function Wxn(t){return JSON.stringify(Vu.Tool$outboundSchema.parse(t))}function Kxn(t){return(0,Vxn.safeParse)(t,e=>Vu.Tool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tool' from JSON")}});var p3e=x(Wu=>{"use strict";var Gxn=Wu&&Wu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jxn=Wu&&Wu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zxn=Wu&&Wu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Gxn(e,t,r);return Jxn(e,t),e};Object.defineProperty(Wu,"__esModule",{value:!0});Wu.FunctionName$=Wu.FunctionName$outboundSchema=Wu.FunctionName$inboundSchema=void 0;Wu.functionNameToJSON=Xxn;Wu.functionNameFromJSON=Qxn;var Tme=Zxn(Ae()),Yxn=Oe();Wu.FunctionName$inboundSchema=Tme.object({name:Tme.string()});Wu.FunctionName$outboundSchema=Tme.object({name:Tme.string()});var Z9t;(function(t){t.inboundSchema=Wu.FunctionName$inboundSchema,t.outboundSchema=Wu.FunctionName$outboundSchema})(Z9t||(Wu.FunctionName$=Z9t={}));function Xxn(t){return JSON.stringify(Wu.FunctionName$outboundSchema.parse(t))}function Qxn(t){return(0,Yxn.safeParse)(t,e=>Wu.FunctionName$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionName' from JSON")}});var tH=x(Ku=>{"use strict";var eSn=Ku&&Ku.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tSn=Ku&&Ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rSn=Ku&&Ku.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eSn(e,t,r);return tSn(e,t),e};Object.defineProperty(Ku,"__esModule",{value:!0});Ku.ToolChoice$=Ku.ToolChoice$outboundSchema=Ku.ToolChoice$inboundSchema=void 0;Ku.toolChoiceToJSON=oSn;Ku.toolChoiceFromJSON=iSn;var X9t=rSn(Ae()),nSn=Oe(),Q9t=p3e(),eKt=VJ();Ku.ToolChoice$inboundSchema=X9t.object({type:eKt.ToolTypes$inboundSchema.optional(),function:Q9t.FunctionName$inboundSchema});Ku.ToolChoice$outboundSchema=X9t.object({type:eKt.ToolTypes$outboundSchema.optional(),function:Q9t.FunctionName$outboundSchema});var Y9t;(function(t){t.inboundSchema=Ku.ToolChoice$inboundSchema,t.outboundSchema=Ku.ToolChoice$outboundSchema})(Y9t||(Ku.ToolChoice$=Y9t={}));function oSn(t){return JSON.stringify(Ku.ToolChoice$outboundSchema.parse(t))}function iSn(t){return(0,nSn.safeParse)(t,e=>Ku.ToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolChoice' from JSON")}});var rH=x(Gu=>{"use strict";var aSn=Gu&&Gu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sSn=Gu&&Gu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uSn=Gu&&Gu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aSn(e,t,r);return sSn(e,t),e};Object.defineProperty(Gu,"__esModule",{value:!0});Gu.ToolChoiceEnum$=Gu.ToolChoiceEnum$outboundSchema=Gu.ToolChoiceEnum$inboundSchema=Gu.ToolChoiceEnum=void 0;var lSn=uSn(Ae());Gu.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};Gu.ToolChoiceEnum$inboundSchema=lSn.nativeEnum(Gu.ToolChoiceEnum);Gu.ToolChoiceEnum$outboundSchema=Gu.ToolChoiceEnum$inboundSchema;var tKt;(function(t){t.inboundSchema=Gu.ToolChoiceEnum$inboundSchema,t.outboundSchema=Gu.ToolChoiceEnum$outboundSchema})(tKt||(Gu.ToolChoiceEnum$=tKt={}))});var Fk=x(Kr=>{"use strict";var cSn=Kr&&Kr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dSn=Kr&&Kr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fSn=Kr&&Kr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cSn(e,t,r);return dSn(e,t),e};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.ToolMessage$=Kr.ToolMessage$outboundSchema=Kr.ToolMessage$inboundSchema=Kr.ToolMessageRole$=Kr.ToolMessageRole$outboundSchema=Kr.ToolMessageRole$inboundSchema=Kr.ToolMessageContent$=Kr.ToolMessageContent$outboundSchema=Kr.ToolMessageContent$inboundSchema=Kr.ToolMessageRole=void 0;Kr.toolMessageContentToJSON=pSn;Kr.toolMessageContentFromJSON=mSn;Kr.toolMessageToJSON=hSn;Kr.toolMessageFromJSON=gSn;var Na=fSn(Ae()),iKt=He(),aKt=Oe(),Ame=Z3();Kr.ToolMessageRole={Tool:"tool"};Kr.ToolMessageContent$inboundSchema=Na.union([Na.string(),Na.array(Ame.ContentChunk$inboundSchema)]);Kr.ToolMessageContent$outboundSchema=Na.union([Na.string(),Na.array(Ame.ContentChunk$outboundSchema)]);var rKt;(function(t){t.inboundSchema=Kr.ToolMessageContent$inboundSchema,t.outboundSchema=Kr.ToolMessageContent$outboundSchema})(rKt||(Kr.ToolMessageContent$=rKt={}));function pSn(t){return JSON.stringify(Kr.ToolMessageContent$outboundSchema.parse(t))}function mSn(t){return(0,aKt.safeParse)(t,e=>Kr.ToolMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessageContent' from JSON")}Kr.ToolMessageRole$inboundSchema=Na.nativeEnum(Kr.ToolMessageRole);Kr.ToolMessageRole$outboundSchema=Kr.ToolMessageRole$inboundSchema;var nKt;(function(t){t.inboundSchema=Kr.ToolMessageRole$inboundSchema,t.outboundSchema=Kr.ToolMessageRole$outboundSchema})(nKt||(Kr.ToolMessageRole$=nKt={}));Kr.ToolMessage$inboundSchema=Na.object({content:Na.nullable(Na.union([Na.string(),Na.array(Ame.ContentChunk$inboundSchema)])),tool_call_id:Na.nullable(Na.string()).optional(),name:Na.nullable(Na.string()).optional(),role:Kr.ToolMessageRole$inboundSchema.default("tool")}).transform(t=>(0,iKt.remap)(t,{tool_call_id:"toolCallId"}));Kr.ToolMessage$outboundSchema=Na.object({content:Na.nullable(Na.union([Na.string(),Na.array(Ame.ContentChunk$outboundSchema)])),toolCallId:Na.nullable(Na.string()).optional(),name:Na.nullable(Na.string()).optional(),role:Kr.ToolMessageRole$outboundSchema.default("tool")}).transform(t=>(0,iKt.remap)(t,{toolCallId:"tool_call_id"}));var oKt;(function(t){t.inboundSchema=Kr.ToolMessage$inboundSchema,t.outboundSchema=Kr.ToolMessage$outboundSchema})(oKt||(Kr.ToolMessage$=oKt={}));function hSn(t){return JSON.stringify(Kr.ToolMessage$outboundSchema.parse(t))}function gSn(t){return(0,aKt.safeParse)(t,e=>Kr.ToolMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessage' from JSON")}});var kk=x(Gr=>{"use strict";var ySn=Gr&&Gr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bSn=Gr&&Gr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Sn=Gr&&Gr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ySn(e,t,r);return bSn(e,t),e};Object.defineProperty(Gr,"__esModule",{value:!0});Gr.UserMessage$=Gr.UserMessage$outboundSchema=Gr.UserMessage$inboundSchema=Gr.UserMessageRole$=Gr.UserMessageRole$outboundSchema=Gr.UserMessageRole$inboundSchema=Gr.UserMessageContent$=Gr.UserMessageContent$outboundSchema=Gr.UserMessageContent$inboundSchema=Gr.UserMessageRole=void 0;Gr.userMessageContentToJSON=vSn;Gr.userMessageContentFromJSON=wSn;Gr.userMessageToJSON=xSn;Gr.userMessageFromJSON=SSn;var Yd=_Sn(Ae()),cKt=Oe(),Ime=Z3();Gr.UserMessageRole={User:"user"};Gr.UserMessageContent$inboundSchema=Yd.union([Yd.string(),Yd.array(Ime.ContentChunk$inboundSchema)]);Gr.UserMessageContent$outboundSchema=Yd.union([Yd.string(),Yd.array(Ime.ContentChunk$outboundSchema)]);var sKt;(function(t){t.inboundSchema=Gr.UserMessageContent$inboundSchema,t.outboundSchema=Gr.UserMessageContent$outboundSchema})(sKt||(Gr.UserMessageContent$=sKt={}));function vSn(t){return JSON.stringify(Gr.UserMessageContent$outboundSchema.parse(t))}function wSn(t){return(0,cKt.safeParse)(t,e=>Gr.UserMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessageContent' from JSON")}Gr.UserMessageRole$inboundSchema=Yd.nativeEnum(Gr.UserMessageRole);Gr.UserMessageRole$outboundSchema=Gr.UserMessageRole$inboundSchema;var uKt;(function(t){t.inboundSchema=Gr.UserMessageRole$inboundSchema,t.outboundSchema=Gr.UserMessageRole$outboundSchema})(uKt||(Gr.UserMessageRole$=uKt={}));Gr.UserMessage$inboundSchema=Yd.object({content:Yd.nullable(Yd.union([Yd.string(),Yd.array(Ime.ContentChunk$inboundSchema)])),role:Gr.UserMessageRole$inboundSchema.default("user")});Gr.UserMessage$outboundSchema=Yd.object({content:Yd.nullable(Yd.union([Yd.string(),Yd.array(Ime.ContentChunk$outboundSchema)])),role:Gr.UserMessageRole$outboundSchema.default("user")});var lKt;(function(t){t.inboundSchema=Gr.UserMessage$inboundSchema,t.outboundSchema=Gr.UserMessage$outboundSchema})(lKt||(Gr.UserMessage$=lKt={}));function xSn(t){return JSON.stringify(Gr.UserMessage$outboundSchema.parse(t))}function SSn(t){return(0,cKt.safeParse)(t,e=>Gr.UserMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessage' from JSON")}});var _Kt=x(rr=>{"use strict";var CSn=rr&&rr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OSn=rr&&rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ESn=rr&&rr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CSn(e,t,r);return OSn(e,t),e};Object.defineProperty(rr,"__esModule",{value:!0});rr.AgentsCompletionRequest$=rr.AgentsCompletionRequest$outboundSchema=rr.AgentsCompletionRequest$inboundSchema=rr.AgentsCompletionRequestToolChoice$=rr.AgentsCompletionRequestToolChoice$outboundSchema=rr.AgentsCompletionRequestToolChoice$inboundSchema=rr.AgentsCompletionRequestMessages$=rr.AgentsCompletionRequestMessages$outboundSchema=rr.AgentsCompletionRequestMessages$inboundSchema=rr.AgentsCompletionRequestStop$=rr.AgentsCompletionRequestStop$outboundSchema=rr.AgentsCompletionRequestStop$inboundSchema=void 0;rr.agentsCompletionRequestStopToJSON=PSn;rr.agentsCompletionRequestStopFromJSON=TSn;rr.agentsCompletionRequestMessagesToJSON=ASn;rr.agentsCompletionRequestMessagesFromJSON=ISn;rr.agentsCompletionRequestToolChoiceToJSON=MSn;rr.agentsCompletionRequestToolChoiceFromJSON=RSn;rr.agentsCompletionRequestToJSON=NSn;rr.agentsCompletionRequestFromJSON=jSn;var et=ESn(Ae()),hKt=He(),Mme=Oe(),Rme=f1(),gKt=X3(),yKt=Q3(),Nme=Lk(),bKt=eH(),jme=tH(),Dme=rH(),Lme=Fk(),Fme=kk();rr.AgentsCompletionRequestStop$inboundSchema=et.union([et.string(),et.array(et.string())]);rr.AgentsCompletionRequestStop$outboundSchema=et.union([et.string(),et.array(et.string())]);var dKt;(function(t){t.inboundSchema=rr.AgentsCompletionRequestStop$inboundSchema,t.outboundSchema=rr.AgentsCompletionRequestStop$outboundSchema})(dKt||(rr.AgentsCompletionRequestStop$=dKt={}));function PSn(t){return JSON.stringify(rr.AgentsCompletionRequestStop$outboundSchema.parse(t))}function TSn(t){return(0,Mme.safeParse)(t,e=>rr.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}rr.AgentsCompletionRequestMessages$inboundSchema=et.union([Nme.SystemMessage$inboundSchema.and(et.object({role:et.literal("system")}).transform(t=>({role:t.role}))),Fme.UserMessage$inboundSchema.and(et.object({role:et.literal("user")}).transform(t=>({role:t.role}))),Rme.AssistantMessage$inboundSchema.and(et.object({role:et.literal("assistant")}).transform(t=>({role:t.role}))),Lme.ToolMessage$inboundSchema.and(et.object({role:et.literal("tool")}).transform(t=>({role:t.role})))]);rr.AgentsCompletionRequestMessages$outboundSchema=et.union([Nme.SystemMessage$outboundSchema.and(et.object({role:et.literal("system")}).transform(t=>({role:t.role}))),Fme.UserMessage$outboundSchema.and(et.object({role:et.literal("user")}).transform(t=>({role:t.role}))),Rme.AssistantMessage$outboundSchema.and(et.object({role:et.literal("assistant")}).transform(t=>({role:t.role}))),Lme.ToolMessage$outboundSchema.and(et.object({role:et.literal("tool")}).transform(t=>({role:t.role})))]);var fKt;(function(t){t.inboundSchema=rr.AgentsCompletionRequestMessages$inboundSchema,t.outboundSchema=rr.AgentsCompletionRequestMessages$outboundSchema})(fKt||(rr.AgentsCompletionRequestMessages$=fKt={}));function ASn(t){return JSON.stringify(rr.AgentsCompletionRequestMessages$outboundSchema.parse(t))}function ISn(t){return(0,Mme.safeParse)(t,e=>rr.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}rr.AgentsCompletionRequestToolChoice$inboundSchema=et.union([jme.ToolChoice$inboundSchema,Dme.ToolChoiceEnum$inboundSchema]);rr.AgentsCompletionRequestToolChoice$outboundSchema=et.union([jme.ToolChoice$outboundSchema,Dme.ToolChoiceEnum$outboundSchema]);var pKt;(function(t){t.inboundSchema=rr.AgentsCompletionRequestToolChoice$inboundSchema,t.outboundSchema=rr.AgentsCompletionRequestToolChoice$outboundSchema})(pKt||(rr.AgentsCompletionRequestToolChoice$=pKt={}));function MSn(t){return JSON.stringify(rr.AgentsCompletionRequestToolChoice$outboundSchema.parse(t))}function RSn(t){return(0,Mme.safeParse)(t,e=>rr.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestToolChoice' from JSON")}rr.AgentsCompletionRequest$inboundSchema=et.object({max_tokens:et.nullable(et.number().int()).optional(),stream:et.boolean().default(!1),stop:et.union([et.string(),et.array(et.string())]).optional(),random_seed:et.nullable(et.number().int()).optional(),messages:et.array(et.union([Nme.SystemMessage$inboundSchema.and(et.object({role:et.literal("system")}).transform(t=>({role:t.role}))),Fme.UserMessage$inboundSchema.and(et.object({role:et.literal("user")}).transform(t=>({role:t.role}))),Rme.AssistantMessage$inboundSchema.and(et.object({role:et.literal("assistant")}).transform(t=>({role:t.role}))),Lme.ToolMessage$inboundSchema.and(et.object({role:et.literal("tool")}).transform(t=>({role:t.role})))])),response_format:yKt.ResponseFormat$inboundSchema.optional(),tools:et.nullable(et.array(bKt.Tool$inboundSchema)).optional(),tool_choice:et.union([jme.ToolChoice$inboundSchema,Dme.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:et.number().optional(),frequency_penalty:et.number().optional(),n:et.nullable(et.number().int()).optional(),prediction:gKt.Prediction$inboundSchema.optional(),agent_id:et.string()}).transform(t=>(0,hKt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));rr.AgentsCompletionRequest$outboundSchema=et.object({maxTokens:et.nullable(et.number().int()).optional(),stream:et.boolean().default(!1),stop:et.union([et.string(),et.array(et.string())]).optional(),randomSeed:et.nullable(et.number().int()).optional(),messages:et.array(et.union([Nme.SystemMessage$outboundSchema.and(et.object({role:et.literal("system")}).transform(t=>({role:t.role}))),Fme.UserMessage$outboundSchema.and(et.object({role:et.literal("user")}).transform(t=>({role:t.role}))),Rme.AssistantMessage$outboundSchema.and(et.object({role:et.literal("assistant")}).transform(t=>({role:t.role}))),Lme.ToolMessage$outboundSchema.and(et.object({role:et.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:yKt.ResponseFormat$outboundSchema.optional(),tools:et.nullable(et.array(bKt.Tool$outboundSchema)).optional(),toolChoice:et.union([jme.ToolChoice$outboundSchema,Dme.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:et.number().optional(),frequencyPenalty:et.number().optional(),n:et.nullable(et.number().int()).optional(),prediction:gKt.Prediction$outboundSchema.optional(),agentId:et.string()}).transform(t=>(0,hKt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var mKt;(function(t){t.inboundSchema=rr.AgentsCompletionRequest$inboundSchema,t.outboundSchema=rr.AgentsCompletionRequest$outboundSchema})(mKt||(rr.AgentsCompletionRequest$=mKt={}));function NSn(t){return JSON.stringify(rr.AgentsCompletionRequest$outboundSchema.parse(t))}function jSn(t){return(0,Mme.safeParse)(t,e=>rr.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var TKt=x(nr=>{"use strict";var DSn=nr&&nr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LSn=nr&&nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FSn=nr&&nr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DSn(e,t,r);return LSn(e,t),e};Object.defineProperty(nr,"__esModule",{value:!0});nr.AgentsCompletionStreamRequest$=nr.AgentsCompletionStreamRequest$outboundSchema=nr.AgentsCompletionStreamRequest$inboundSchema=nr.AgentsCompletionStreamRequestToolChoice$=nr.AgentsCompletionStreamRequestToolChoice$outboundSchema=nr.AgentsCompletionStreamRequestToolChoice$inboundSchema=nr.AgentsCompletionStreamRequestMessages$=nr.AgentsCompletionStreamRequestMessages$outboundSchema=nr.AgentsCompletionStreamRequestMessages$inboundSchema=nr.AgentsCompletionStreamRequestStop$=nr.AgentsCompletionStreamRequestStop$outboundSchema=nr.AgentsCompletionStreamRequestStop$inboundSchema=void 0;nr.agentsCompletionStreamRequestStopToJSON=kSn;nr.agentsCompletionStreamRequestStopFromJSON=$Sn;nr.agentsCompletionStreamRequestMessagesToJSON=BSn;nr.agentsCompletionStreamRequestMessagesFromJSON=zSn;nr.agentsCompletionStreamRequestToolChoiceToJSON=USn;nr.agentsCompletionStreamRequestToolChoiceFromJSON=qSn;nr.agentsCompletionStreamRequestToJSON=HSn;nr.agentsCompletionStreamRequestFromJSON=VSn;var tt=FSn(Ae()),CKt=He(),kme=Oe(),$me=f1(),OKt=X3(),EKt=Q3(),Bme=Lk(),PKt=eH(),zme=tH(),Ume=rH(),qme=Fk(),Hme=kk();nr.AgentsCompletionStreamRequestStop$inboundSchema=tt.union([tt.string(),tt.array(tt.string())]);nr.AgentsCompletionStreamRequestStop$outboundSchema=tt.union([tt.string(),tt.array(tt.string())]);var vKt;(function(t){t.inboundSchema=nr.AgentsCompletionStreamRequestStop$inboundSchema,t.outboundSchema=nr.AgentsCompletionStreamRequestStop$outboundSchema})(vKt||(nr.AgentsCompletionStreamRequestStop$=vKt={}));function kSn(t){return JSON.stringify(nr.AgentsCompletionStreamRequestStop$outboundSchema.parse(t))}function $Sn(t){return(0,kme.safeParse)(t,e=>nr.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}nr.AgentsCompletionStreamRequestMessages$inboundSchema=tt.union([Bme.SystemMessage$inboundSchema.and(tt.object({role:tt.literal("system")}).transform(t=>({role:t.role}))),Hme.UserMessage$inboundSchema.and(tt.object({role:tt.literal("user")}).transform(t=>({role:t.role}))),$me.AssistantMessage$inboundSchema.and(tt.object({role:tt.literal("assistant")}).transform(t=>({role:t.role}))),qme.ToolMessage$inboundSchema.and(tt.object({role:tt.literal("tool")}).transform(t=>({role:t.role})))]);nr.AgentsCompletionStreamRequestMessages$outboundSchema=tt.union([Bme.SystemMessage$outboundSchema.and(tt.object({role:tt.literal("system")}).transform(t=>({role:t.role}))),Hme.UserMessage$outboundSchema.and(tt.object({role:tt.literal("user")}).transform(t=>({role:t.role}))),$me.AssistantMessage$outboundSchema.and(tt.object({role:tt.literal("assistant")}).transform(t=>({role:t.role}))),qme.ToolMessage$outboundSchema.and(tt.object({role:tt.literal("tool")}).transform(t=>({role:t.role})))]);var wKt;(function(t){t.inboundSchema=nr.AgentsCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=nr.AgentsCompletionStreamRequestMessages$outboundSchema})(wKt||(nr.AgentsCompletionStreamRequestMessages$=wKt={}));function BSn(t){return JSON.stringify(nr.AgentsCompletionStreamRequestMessages$outboundSchema.parse(t))}function zSn(t){return(0,kme.safeParse)(t,e=>nr.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}nr.AgentsCompletionStreamRequestToolChoice$inboundSchema=tt.union([zme.ToolChoice$inboundSchema,Ume.ToolChoiceEnum$inboundSchema]);nr.AgentsCompletionStreamRequestToolChoice$outboundSchema=tt.union([zme.ToolChoice$outboundSchema,Ume.ToolChoiceEnum$outboundSchema]);var xKt;(function(t){t.inboundSchema=nr.AgentsCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=nr.AgentsCompletionStreamRequestToolChoice$outboundSchema})(xKt||(nr.AgentsCompletionStreamRequestToolChoice$=xKt={}));function USn(t){return JSON.stringify(nr.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function qSn(t){return(0,kme.safeParse)(t,e=>nr.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestToolChoice' from JSON")}nr.AgentsCompletionStreamRequest$inboundSchema=tt.object({max_tokens:tt.nullable(tt.number().int()).optional(),stream:tt.boolean().default(!0),stop:tt.union([tt.string(),tt.array(tt.string())]).optional(),random_seed:tt.nullable(tt.number().int()).optional(),messages:tt.array(tt.union([Bme.SystemMessage$inboundSchema.and(tt.object({role:tt.literal("system")}).transform(t=>({role:t.role}))),Hme.UserMessage$inboundSchema.and(tt.object({role:tt.literal("user")}).transform(t=>({role:t.role}))),$me.AssistantMessage$inboundSchema.and(tt.object({role:tt.literal("assistant")}).transform(t=>({role:t.role}))),qme.ToolMessage$inboundSchema.and(tt.object({role:tt.literal("tool")}).transform(t=>({role:t.role})))])),response_format:EKt.ResponseFormat$inboundSchema.optional(),tools:tt.nullable(tt.array(PKt.Tool$inboundSchema)).optional(),tool_choice:tt.union([zme.ToolChoice$inboundSchema,Ume.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:tt.number().optional(),frequency_penalty:tt.number().optional(),n:tt.nullable(tt.number().int()).optional(),prediction:OKt.Prediction$inboundSchema.optional(),agent_id:tt.string()}).transform(t=>(0,CKt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));nr.AgentsCompletionStreamRequest$outboundSchema=tt.object({maxTokens:tt.nullable(tt.number().int()).optional(),stream:tt.boolean().default(!0),stop:tt.union([tt.string(),tt.array(tt.string())]).optional(),randomSeed:tt.nullable(tt.number().int()).optional(),messages:tt.array(tt.union([Bme.SystemMessage$outboundSchema.and(tt.object({role:tt.literal("system")}).transform(t=>({role:t.role}))),Hme.UserMessage$outboundSchema.and(tt.object({role:tt.literal("user")}).transform(t=>({role:t.role}))),$me.AssistantMessage$outboundSchema.and(tt.object({role:tt.literal("assistant")}).transform(t=>({role:t.role}))),qme.ToolMessage$outboundSchema.and(tt.object({role:tt.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:EKt.ResponseFormat$outboundSchema.optional(),tools:tt.nullable(tt.array(PKt.Tool$outboundSchema)).optional(),toolChoice:tt.union([zme.ToolChoice$outboundSchema,Ume.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:tt.number().optional(),frequencyPenalty:tt.number().optional(),n:tt.nullable(tt.number().int()).optional(),prediction:OKt.Prediction$outboundSchema.optional(),agentId:tt.string()}).transform(t=>(0,CKt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var SKt;(function(t){t.inboundSchema=nr.AgentsCompletionStreamRequest$inboundSchema,t.outboundSchema=nr.AgentsCompletionStreamRequest$outboundSchema})(SKt||(nr.AgentsCompletionStreamRequest$=SKt={}));function HSn(t){return JSON.stringify(nr.AgentsCompletionStreamRequest$outboundSchema.parse(t))}function VSn(t){return(0,kme.safeParse)(t,e=>nr.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var m3e=x(Ju=>{"use strict";var WSn=Ju&&Ju.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KSn=Ju&&Ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GSn=Ju&&Ju.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WSn(e,t,r);return KSn(e,t),e};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.ApiEndpoint$=Ju.ApiEndpoint$outboundSchema=Ju.ApiEndpoint$inboundSchema=Ju.ApiEndpoint=void 0;var $k=GSn(Ae()),JSn=d1();Ju.ApiEndpoint={RootV1ChatCompletions:"/v1/chat/completions",RootV1Embeddings:"/v1/embeddings",RootV1FimCompletions:"/v1/fim/completions",RootV1Moderations:"/v1/moderations",RootV1ChatModerations:"/v1/chat/moderations"};Ju.ApiEndpoint$inboundSchema=$k.union([$k.nativeEnum(Ju.ApiEndpoint),$k.string().transform(JSn.catchUnrecognizedEnum)]);Ju.ApiEndpoint$outboundSchema=$k.union([$k.nativeEnum(Ju.ApiEndpoint),$k.string().and($k.custom())]);var AKt;(function(t){t.inboundSchema=Ju.ApiEndpoint$inboundSchema,t.outboundSchema=Ju.ApiEndpoint$outboundSchema})(AKt||(Ju.ApiEndpoint$=AKt={}))});var RKt=x(Ko=>{"use strict";var ZSn=Ko&&Ko.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YSn=Ko&&Ko.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XSn=Ko&&Ko.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZSn(e,t,r);return YSn(e,t),e};Object.defineProperty(Ko,"__esModule",{value:!0});Ko.ArchiveFTModelOut$=Ko.ArchiveFTModelOut$outboundSchema=Ko.ArchiveFTModelOut$inboundSchema=Ko.ArchiveFTModelOutObject$=Ko.ArchiveFTModelOutObject$outboundSchema=Ko.ArchiveFTModelOutObject$inboundSchema=Ko.ArchiveFTModelOutObject=void 0;Ko.archiveFTModelOutToJSON=eCn;Ko.archiveFTModelOutFromJSON=tCn;var _T=XSn(Ae()),QSn=Oe();Ko.ArchiveFTModelOutObject={Model:"model"};Ko.ArchiveFTModelOutObject$inboundSchema=_T.nativeEnum(Ko.ArchiveFTModelOutObject);Ko.ArchiveFTModelOutObject$outboundSchema=Ko.ArchiveFTModelOutObject$inboundSchema;var IKt;(function(t){t.inboundSchema=Ko.ArchiveFTModelOutObject$inboundSchema,t.outboundSchema=Ko.ArchiveFTModelOutObject$outboundSchema})(IKt||(Ko.ArchiveFTModelOutObject$=IKt={}));Ko.ArchiveFTModelOut$inboundSchema=_T.object({id:_T.string(),object:_T.literal("model").default("model"),archived:_T.boolean().default(!0)});Ko.ArchiveFTModelOut$outboundSchema=_T.object({id:_T.string(),object:_T.literal("model").default("model"),archived:_T.boolean().default(!0)});var MKt;(function(t){t.inboundSchema=Ko.ArchiveFTModelOut$inboundSchema,t.outboundSchema=Ko.ArchiveFTModelOut$outboundSchema})(MKt||(Ko.ArchiveFTModelOut$=MKt={}));function eCn(t){return JSON.stringify(Ko.ArchiveFTModelOut$outboundSchema.parse(t))}function tCn(t){return(0,QSn.safeParse)(t,e=>Ko.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var Vme=x(Zu=>{"use strict";var rCn=Zu&&Zu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nCn=Zu&&Zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oCn=Zu&&Zu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rCn(e,t,r);return nCn(e,t),e};Object.defineProperty(Zu,"__esModule",{value:!0});Zu.ModelCapabilities$=Zu.ModelCapabilities$outboundSchema=Zu.ModelCapabilities$inboundSchema=void 0;Zu.modelCapabilitiesToJSON=aCn;Zu.modelCapabilitiesFromJSON=sCn;var Jy=oCn(Ae()),jKt=He(),iCn=Oe();Zu.ModelCapabilities$inboundSchema=Jy.object({completion_chat:Jy.boolean().default(!0),completion_fim:Jy.boolean().default(!1),function_calling:Jy.boolean().default(!0),fine_tuning:Jy.boolean().default(!1),vision:Jy.boolean().default(!1)}).transform(t=>(0,jKt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));Zu.ModelCapabilities$outboundSchema=Jy.object({completionChat:Jy.boolean().default(!0),completionFim:Jy.boolean().default(!1),functionCalling:Jy.boolean().default(!0),fineTuning:Jy.boolean().default(!1),vision:Jy.boolean().default(!1)}).transform(t=>(0,jKt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var NKt;(function(t){t.inboundSchema=Zu.ModelCapabilities$inboundSchema,t.outboundSchema=Zu.ModelCapabilities$outboundSchema})(NKt||(Zu.ModelCapabilities$=NKt={}));function aCn(t){return JSON.stringify(Zu.ModelCapabilities$outboundSchema.parse(t))}function sCn(t){return(0,iCn.safeParse)(t,e=>Zu.ModelCapabilities$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelCapabilities' from JSON")}});var h3e=x(Go=>{"use strict";var uCn=Go&&Go.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lCn=Go&&Go.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cCn=Go&&Go.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uCn(e,t,r);return lCn(e,t),e};Object.defineProperty(Go,"__esModule",{value:!0});Go.BaseModelCard$=Go.BaseModelCard$outboundSchema=Go.BaseModelCard$inboundSchema=Go.Type$=Go.Type$outboundSchema=Go.Type$inboundSchema=Go.Type=void 0;Go.baseModelCardToJSON=fCn;Go.baseModelCardFromJSON=pCn;var bo=cCn(Ae()),FKt=He(),dCn=Oe(),kKt=Vme();Go.Type={Base:"base"};Go.Type$inboundSchema=bo.nativeEnum(Go.Type);Go.Type$outboundSchema=Go.Type$inboundSchema;var DKt;(function(t){t.inboundSchema=Go.Type$inboundSchema,t.outboundSchema=Go.Type$outboundSchema})(DKt||(Go.Type$=DKt={}));Go.BaseModelCard$inboundSchema=bo.object({id:bo.string(),object:bo.string().default("model"),created:bo.number().int().optional(),owned_by:bo.string().default("mistralai"),capabilities:kKt.ModelCapabilities$inboundSchema,name:bo.nullable(bo.string()).optional(),description:bo.nullable(bo.string()).optional(),max_context_length:bo.number().int().default(32768),aliases:bo.array(bo.string()).optional(),deprecation:bo.nullable(bo.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:bo.nullable(bo.number()).optional(),type:bo.literal("base").default("base")}).transform(t=>(0,FKt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Go.BaseModelCard$outboundSchema=bo.object({id:bo.string(),object:bo.string().default("model"),created:bo.number().int().optional(),ownedBy:bo.string().default("mistralai"),capabilities:kKt.ModelCapabilities$outboundSchema,name:bo.nullable(bo.string()).optional(),description:bo.nullable(bo.string()).optional(),maxContextLength:bo.number().int().default(32768),aliases:bo.array(bo.string()).optional(),deprecation:bo.nullable(bo.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:bo.nullable(bo.number()).optional(),type:bo.literal("base").default("base")}).transform(t=>(0,FKt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var LKt;(function(t){t.inboundSchema=Go.BaseModelCard$inboundSchema,t.outboundSchema=Go.BaseModelCard$outboundSchema})(LKt||(Go.BaseModelCard$=LKt={}));function fCn(t){return JSON.stringify(Go.BaseModelCard$outboundSchema.parse(t))}function pCn(t){return(0,dCn.safeParse)(t,e=>Go.BaseModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BaseModelCard' from JSON")}});var g3e=x(Yu=>{"use strict";var mCn=Yu&&Yu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hCn=Yu&&Yu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gCn=Yu&&Yu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mCn(e,t,r);return hCn(e,t),e};Object.defineProperty(Yu,"__esModule",{value:!0});Yu.BatchError$=Yu.BatchError$outboundSchema=Yu.BatchError$inboundSchema=void 0;Yu.batchErrorToJSON=bCn;Yu.batchErrorFromJSON=_Cn;var nH=gCn(Ae()),yCn=Oe();Yu.BatchError$inboundSchema=nH.object({message:nH.string(),count:nH.number().int().default(1)});Yu.BatchError$outboundSchema=nH.object({message:nH.string(),count:nH.number().int().default(1)});var $Kt;(function(t){t.inboundSchema=Yu.BatchError$inboundSchema,t.outboundSchema=Yu.BatchError$outboundSchema})($Kt||(Yu.BatchError$=$Kt={}));function bCn(t){return JSON.stringify(Yu.BatchError$outboundSchema.parse(t))}function _Cn(t){return(0,yCn.safeParse)(t,e=>Yu.BatchError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchError' from JSON")}});var qKt=x(Xu=>{"use strict";var vCn=Xu&&Xu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wCn=Xu&&Xu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xCn=Xu&&Xu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vCn(e,t,r);return wCn(e,t),e};Object.defineProperty(Xu,"__esModule",{value:!0});Xu.BatchJobIn$=Xu.BatchJobIn$outboundSchema=Xu.BatchJobIn$inboundSchema=void 0;Xu.batchJobInToJSON=CCn;Xu.batchJobInFromJSON=OCn;var ap=xCn(Ae()),zKt=He(),SCn=Oe(),UKt=m3e();Xu.BatchJobIn$inboundSchema=ap.object({input_files:ap.array(ap.string()),endpoint:UKt.ApiEndpoint$inboundSchema,model:ap.string(),metadata:ap.nullable(ap.record(ap.string())).optional(),timeout_hours:ap.number().int().default(24)}).transform(t=>(0,zKt.remap)(t,{input_files:"inputFiles",timeout_hours:"timeoutHours"}));Xu.BatchJobIn$outboundSchema=ap.object({inputFiles:ap.array(ap.string()),endpoint:UKt.ApiEndpoint$outboundSchema,model:ap.string(),metadata:ap.nullable(ap.record(ap.string())).optional(),timeoutHours:ap.number().int().default(24)}).transform(t=>(0,zKt.remap)(t,{inputFiles:"input_files",timeoutHours:"timeout_hours"}));var BKt;(function(t){t.inboundSchema=Xu.BatchJobIn$inboundSchema,t.outboundSchema=Xu.BatchJobIn$outboundSchema})(BKt||(Xu.BatchJobIn$=BKt={}));function CCn(t){return JSON.stringify(Xu.BatchJobIn$outboundSchema.parse(t))}function OCn(t){return(0,SCn.safeParse)(t,e=>Xu.BatchJobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobIn' from JSON")}});var y3e=x(Qu=>{"use strict";var ECn=Qu&&Qu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PCn=Qu&&Qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TCn=Qu&&Qu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ECn(e,t,r);return PCn(e,t),e};Object.defineProperty(Qu,"__esModule",{value:!0});Qu.BatchJobStatus$=Qu.BatchJobStatus$outboundSchema=Qu.BatchJobStatus$inboundSchema=Qu.BatchJobStatus=void 0;var ACn=TCn(Ae());Qu.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};Qu.BatchJobStatus$inboundSchema=ACn.nativeEnum(Qu.BatchJobStatus);Qu.BatchJobStatus$outboundSchema=Qu.BatchJobStatus$inboundSchema;var HKt;(function(t){t.inboundSchema=Qu.BatchJobStatus$inboundSchema,t.outboundSchema=Qu.BatchJobStatus$outboundSchema})(HKt||(Qu.BatchJobStatus$=HKt={}))});var b3e=x(Jo=>{"use strict";var ICn=Jo&&Jo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MCn=Jo&&Jo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RCn=Jo&&Jo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ICn(e,t,r);return MCn(e,t),e};Object.defineProperty(Jo,"__esModule",{value:!0});Jo.BatchJobOut$=Jo.BatchJobOut$outboundSchema=Jo.BatchJobOut$inboundSchema=Jo.BatchJobOutObject$=Jo.BatchJobOutObject$outboundSchema=Jo.BatchJobOutObject$inboundSchema=Jo.BatchJobOutObject=void 0;Jo.batchJobOutToJSON=jCn;Jo.batchJobOutFromJSON=DCn;var Ar=RCn(Ae()),KKt=He(),NCn=Oe(),GKt=g3e(),JKt=y3e();Jo.BatchJobOutObject={Batch:"batch"};Jo.BatchJobOutObject$inboundSchema=Ar.nativeEnum(Jo.BatchJobOutObject);Jo.BatchJobOutObject$outboundSchema=Jo.BatchJobOutObject$inboundSchema;var VKt;(function(t){t.inboundSchema=Jo.BatchJobOutObject$inboundSchema,t.outboundSchema=Jo.BatchJobOutObject$outboundSchema})(VKt||(Jo.BatchJobOutObject$=VKt={}));Jo.BatchJobOut$inboundSchema=Ar.object({id:Ar.string(),object:Ar.literal("batch").default("batch"),input_files:Ar.array(Ar.string()),metadata:Ar.nullable(Ar.record(Ar.any())).optional(),endpoint:Ar.string(),model:Ar.string(),output_file:Ar.nullable(Ar.string()).optional(),error_file:Ar.nullable(Ar.string()).optional(),errors:Ar.array(GKt.BatchError$inboundSchema),status:JKt.BatchJobStatus$inboundSchema,created_at:Ar.number().int(),total_requests:Ar.number().int(),completed_requests:Ar.number().int(),succeeded_requests:Ar.number().int(),failed_requests:Ar.number().int(),started_at:Ar.nullable(Ar.number().int()).optional(),completed_at:Ar.nullable(Ar.number().int()).optional()}).transform(t=>(0,KKt.remap)(t,{input_files:"inputFiles",output_file:"outputFile",error_file:"errorFile",created_at:"createdAt",total_requests:"totalRequests",completed_requests:"completedRequests",succeeded_requests:"succeededRequests",failed_requests:"failedRequests",started_at:"startedAt",completed_at:"completedAt"}));Jo.BatchJobOut$outboundSchema=Ar.object({id:Ar.string(),object:Ar.literal("batch").default("batch"),inputFiles:Ar.array(Ar.string()),metadata:Ar.nullable(Ar.record(Ar.any())).optional(),endpoint:Ar.string(),model:Ar.string(),outputFile:Ar.nullable(Ar.string()).optional(),errorFile:Ar.nullable(Ar.string()).optional(),errors:Ar.array(GKt.BatchError$outboundSchema),status:JKt.BatchJobStatus$outboundSchema,createdAt:Ar.number().int(),totalRequests:Ar.number().int(),completedRequests:Ar.number().int(),succeededRequests:Ar.number().int(),failedRequests:Ar.number().int(),startedAt:Ar.nullable(Ar.number().int()).optional(),completedAt:Ar.nullable(Ar.number().int()).optional()}).transform(t=>(0,KKt.remap)(t,{inputFiles:"input_files",outputFile:"output_file",errorFile:"error_file",createdAt:"created_at",totalRequests:"total_requests",completedRequests:"completed_requests",succeededRequests:"succeeded_requests",failedRequests:"failed_requests",startedAt:"started_at",completedAt:"completed_at"}));var WKt;(function(t){t.inboundSchema=Jo.BatchJobOut$inboundSchema,t.outboundSchema=Jo.BatchJobOut$outboundSchema})(WKt||(Jo.BatchJobOut$=WKt={}));function jCn(t){return JSON.stringify(Jo.BatchJobOut$outboundSchema.parse(t))}function DCn(t){return(0,NCn.safeParse)(t,e=>Jo.BatchJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobOut' from JSON")}});var QKt=x(Zo=>{"use strict";var LCn=Zo&&Zo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FCn=Zo&&Zo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kCn=Zo&&Zo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LCn(e,t,r);return FCn(e,t),e};Object.defineProperty(Zo,"__esModule",{value:!0});Zo.BatchJobsOut$=Zo.BatchJobsOut$outboundSchema=Zo.BatchJobsOut$inboundSchema=Zo.BatchJobsOutObject$=Zo.BatchJobsOutObject$outboundSchema=Zo.BatchJobsOutObject$inboundSchema=Zo.BatchJobsOutObject=void 0;Zo.batchJobsOutToJSON=BCn;Zo.batchJobsOutFromJSON=zCn;var vT=kCn(Ae()),$Cn=Oe(),XKt=b3e();Zo.BatchJobsOutObject={List:"list"};Zo.BatchJobsOutObject$inboundSchema=vT.nativeEnum(Zo.BatchJobsOutObject);Zo.BatchJobsOutObject$outboundSchema=Zo.BatchJobsOutObject$inboundSchema;var ZKt;(function(t){t.inboundSchema=Zo.BatchJobsOutObject$inboundSchema,t.outboundSchema=Zo.BatchJobsOutObject$outboundSchema})(ZKt||(Zo.BatchJobsOutObject$=ZKt={}));Zo.BatchJobsOut$inboundSchema=vT.object({data:vT.array(XKt.BatchJobOut$inboundSchema).optional(),object:vT.literal("list").default("list"),total:vT.number().int()});Zo.BatchJobsOut$outboundSchema=vT.object({data:vT.array(XKt.BatchJobOut$outboundSchema).optional(),object:vT.literal("list").default("list"),total:vT.number().int()});var YKt;(function(t){t.inboundSchema=Zo.BatchJobsOut$inboundSchema,t.outboundSchema=Zo.BatchJobsOut$outboundSchema})(YKt||(Zo.BatchJobsOut$=YKt={}));function BCn(t){return JSON.stringify(Zo.BatchJobsOut$outboundSchema.parse(t))}function zCn(t){return(0,$Cn.safeParse)(t,e=>Zo.BatchJobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobsOut' from JSON")}});var iGt=x(or=>{"use strict";var UCn=or&&or.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qCn=or&&or.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HCn=or&&or.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UCn(e,t,r);return qCn(e,t),e};Object.defineProperty(or,"__esModule",{value:!0});or.ChatClassificationRequest$=or.ChatClassificationRequest$outboundSchema=or.ChatClassificationRequest$inboundSchema=or.ChatClassificationRequestInputs$=or.ChatClassificationRequestInputs$outboundSchema=or.ChatClassificationRequestInputs$inboundSchema=or.One$=or.One$outboundSchema=or.One$inboundSchema=or.Two$=or.Two$outboundSchema=or.Two$inboundSchema=void 0;or.twoToJSON=VCn;or.twoFromJSON=WCn;or.oneToJSON=KCn;or.oneFromJSON=GCn;or.chatClassificationRequestInputsToJSON=JCn;or.chatClassificationRequestInputsFromJSON=ZCn;or.chatClassificationRequestToJSON=YCn;or.chatClassificationRequestFromJSON=XCn;var Se=HCn(Ae()),oGt=He(),Wme=Oe(),Zy=f1(),Yy=Lk(),Xy=Fk(),Qy=kk();or.Two$inboundSchema=Se.union([Yy.SystemMessage$inboundSchema.and(Se.object({role:Se.literal("system")}).transform(t=>({role:t.role}))),Qy.UserMessage$inboundSchema.and(Se.object({role:Se.literal("user")}).transform(t=>({role:t.role}))),Zy.AssistantMessage$inboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(t=>({role:t.role}))),Xy.ToolMessage$inboundSchema.and(Se.object({role:Se.literal("tool")}).transform(t=>({role:t.role})))]);or.Two$outboundSchema=Se.union([Yy.SystemMessage$outboundSchema.and(Se.object({role:Se.literal("system")}).transform(t=>({role:t.role}))),Qy.UserMessage$outboundSchema.and(Se.object({role:Se.literal("user")}).transform(t=>({role:t.role}))),Zy.AssistantMessage$outboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(t=>({role:t.role}))),Xy.ToolMessage$outboundSchema.and(Se.object({role:Se.literal("tool")}).transform(t=>({role:t.role})))]);var eGt;(function(t){t.inboundSchema=or.Two$inboundSchema,t.outboundSchema=or.Two$outboundSchema})(eGt||(or.Two$=eGt={}));function VCn(t){return JSON.stringify(or.Two$outboundSchema.parse(t))}function WCn(t){return(0,Wme.safeParse)(t,e=>or.Two$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Two' from JSON")}or.One$inboundSchema=Se.union([Yy.SystemMessage$inboundSchema.and(Se.object({role:Se.literal("system")}).transform(t=>({role:t.role}))),Qy.UserMessage$inboundSchema.and(Se.object({role:Se.literal("user")}).transform(t=>({role:t.role}))),Zy.AssistantMessage$inboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(t=>({role:t.role}))),Xy.ToolMessage$inboundSchema.and(Se.object({role:Se.literal("tool")}).transform(t=>({role:t.role})))]);or.One$outboundSchema=Se.union([Yy.SystemMessage$outboundSchema.and(Se.object({role:Se.literal("system")}).transform(t=>({role:t.role}))),Qy.UserMessage$outboundSchema.and(Se.object({role:Se.literal("user")}).transform(t=>({role:t.role}))),Zy.AssistantMessage$outboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(t=>({role:t.role}))),Xy.ToolMessage$outboundSchema.and(Se.object({role:Se.literal("tool")}).transform(t=>({role:t.role})))]);var tGt;(function(t){t.inboundSchema=or.One$inboundSchema,t.outboundSchema=or.One$outboundSchema})(tGt||(or.One$=tGt={}));function KCn(t){return JSON.stringify(or.One$outboundSchema.parse(t))}function GCn(t){return(0,Wme.safeParse)(t,e=>or.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}or.ChatClassificationRequestInputs$inboundSchema=Se.union([Se.array(Se.union([Yy.SystemMessage$inboundSchema.and(Se.object({role:Se.literal("system")}).transform(t=>({role:t.role}))),Qy.UserMessage$inboundSchema.and(Se.object({role:Se.literal("user")}).transform(t=>({role:t.role}))),Zy.AssistantMessage$inboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(t=>({role:t.role}))),Xy.ToolMessage$inboundSchema.and(Se.object({role:Se.literal("tool")}).transform(t=>({role:t.role})))])),Se.array(Se.array(Se.union([Yy.SystemMessage$inboundSchema.and(Se.object({role:Se.literal("system")}).transform(t=>({role:t.role}))),Qy.UserMessage$inboundSchema.and(Se.object({role:Se.literal("user")}).transform(t=>({role:t.role}))),Zy.AssistantMessage$inboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(t=>({role:t.role}))),Xy.ToolMessage$inboundSchema.and(Se.object({role:Se.literal("tool")}).transform(t=>({role:t.role})))])))]);or.ChatClassificationRequestInputs$outboundSchema=Se.union([Se.array(Se.union([Yy.SystemMessage$outboundSchema.and(Se.object({role:Se.literal("system")}).transform(t=>({role:t.role}))),Qy.UserMessage$outboundSchema.and(Se.object({role:Se.literal("user")}).transform(t=>({role:t.role}))),Zy.AssistantMessage$outboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(t=>({role:t.role}))),Xy.ToolMessage$outboundSchema.and(Se.object({role:Se.literal("tool")}).transform(t=>({role:t.role})))])),Se.array(Se.array(Se.union([Yy.SystemMessage$outboundSchema.and(Se.object({role:Se.literal("system")}).transform(t=>({role:t.role}))),Qy.UserMessage$outboundSchema.and(Se.object({role:Se.literal("user")}).transform(t=>({role:t.role}))),Zy.AssistantMessage$outboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(t=>({role:t.role}))),Xy.ToolMessage$outboundSchema.and(Se.object({role:Se.literal("tool")}).transform(t=>({role:t.role})))])))]);var rGt;(function(t){t.inboundSchema=or.ChatClassificationRequestInputs$inboundSchema,t.outboundSchema=or.ChatClassificationRequestInputs$outboundSchema})(rGt||(or.ChatClassificationRequestInputs$=rGt={}));function JCn(t){return JSON.stringify(or.ChatClassificationRequestInputs$outboundSchema.parse(t))}function ZCn(t){return(0,Wme.safeParse)(t,e=>or.ChatClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequestInputs' from JSON")}or.ChatClassificationRequest$inboundSchema=Se.object({input:Se.union([Se.array(Se.union([Yy.SystemMessage$inboundSchema.and(Se.object({role:Se.literal("system")}).transform(t=>({role:t.role}))),Qy.UserMessage$inboundSchema.and(Se.object({role:Se.literal("user")}).transform(t=>({role:t.role}))),Zy.AssistantMessage$inboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(t=>({role:t.role}))),Xy.ToolMessage$inboundSchema.and(Se.object({role:Se.literal("tool")}).transform(t=>({role:t.role})))])),Se.array(Se.array(Se.union([Yy.SystemMessage$inboundSchema.and(Se.object({role:Se.literal("system")}).transform(t=>({role:t.role}))),Qy.UserMessage$inboundSchema.and(Se.object({role:Se.literal("user")}).transform(t=>({role:t.role}))),Zy.AssistantMessage$inboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(t=>({role:t.role}))),Xy.ToolMessage$inboundSchema.and(Se.object({role:Se.literal("tool")}).transform(t=>({role:t.role})))])))]),model:Se.nullable(Se.string())}).transform(t=>(0,oGt.remap)(t,{input:"inputs"}));or.ChatClassificationRequest$outboundSchema=Se.object({inputs:Se.union([Se.array(Se.union([Yy.SystemMessage$outboundSchema.and(Se.object({role:Se.literal("system")}).transform(t=>({role:t.role}))),Qy.UserMessage$outboundSchema.and(Se.object({role:Se.literal("user")}).transform(t=>({role:t.role}))),Zy.AssistantMessage$outboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(t=>({role:t.role}))),Xy.ToolMessage$outboundSchema.and(Se.object({role:Se.literal("tool")}).transform(t=>({role:t.role})))])),Se.array(Se.array(Se.union([Yy.SystemMessage$outboundSchema.and(Se.object({role:Se.literal("system")}).transform(t=>({role:t.role}))),Qy.UserMessage$outboundSchema.and(Se.object({role:Se.literal("user")}).transform(t=>({role:t.role}))),Zy.AssistantMessage$outboundSchema.and(Se.object({role:Se.literal("assistant")}).transform(t=>({role:t.role}))),Xy.ToolMessage$outboundSchema.and(Se.object({role:Se.literal("tool")}).transform(t=>({role:t.role})))])))]),model:Se.nullable(Se.string())}).transform(t=>(0,oGt.remap)(t,{inputs:"input"}));var nGt;(function(t){t.inboundSchema=or.ChatClassificationRequest$inboundSchema,t.outboundSchema=or.ChatClassificationRequest$outboundSchema})(nGt||(or.ChatClassificationRequest$=nGt={}));function YCn(t){return JSON.stringify(or.ChatClassificationRequest$outboundSchema.parse(t))}function XCn(t){return(0,Wme.safeParse)(t,e=>or.ChatClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var Kme=x(Mo=>{"use strict";var QCn=Mo&&Mo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eOn=Mo&&Mo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tOn=Mo&&Mo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QCn(e,t,r);return eOn(e,t),e};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.ChatCompletionChoice$=Mo.ChatCompletionChoice$outboundSchema=Mo.ChatCompletionChoice$inboundSchema=Mo.FinishReason$=Mo.FinishReason$outboundSchema=Mo.FinishReason$inboundSchema=Mo.FinishReason=void 0;Mo.chatCompletionChoiceToJSON=oOn;Mo.chatCompletionChoiceFromJSON=iOn;var B_=tOn(Ae()),uGt=He(),rOn=Oe(),nOn=d1(),lGt=f1();Mo.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};Mo.FinishReason$inboundSchema=B_.union([B_.nativeEnum(Mo.FinishReason),B_.string().transform(nOn.catchUnrecognizedEnum)]);Mo.FinishReason$outboundSchema=B_.union([B_.nativeEnum(Mo.FinishReason),B_.string().and(B_.custom())]);var aGt;(function(t){t.inboundSchema=Mo.FinishReason$inboundSchema,t.outboundSchema=Mo.FinishReason$outboundSchema})(aGt||(Mo.FinishReason$=aGt={}));Mo.ChatCompletionChoice$inboundSchema=B_.object({index:B_.number().int(),message:lGt.AssistantMessage$inboundSchema,finish_reason:Mo.FinishReason$inboundSchema}).transform(t=>(0,uGt.remap)(t,{finish_reason:"finishReason"}));Mo.ChatCompletionChoice$outboundSchema=B_.object({index:B_.number().int(),message:lGt.AssistantMessage$outboundSchema,finishReason:Mo.FinishReason$outboundSchema}).transform(t=>(0,uGt.remap)(t,{finishReason:"finish_reason"}));var sGt;(function(t){t.inboundSchema=Mo.ChatCompletionChoice$inboundSchema,t.outboundSchema=Mo.ChatCompletionChoice$outboundSchema})(sGt||(Mo.ChatCompletionChoice$=sGt={}));function oOn(t){return JSON.stringify(Mo.ChatCompletionChoice$outboundSchema.parse(t))}function iOn(t){return(0,rOn.safeParse)(t,e=>Mo.ChatCompletionChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var bGt=x(ir=>{"use strict";var aOn=ir&&ir.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sOn=ir&&ir.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uOn=ir&&ir.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aOn(e,t,r);return sOn(e,t),e};Object.defineProperty(ir,"__esModule",{value:!0});ir.ChatCompletionRequest$=ir.ChatCompletionRequest$outboundSchema=ir.ChatCompletionRequest$inboundSchema=ir.ChatCompletionRequestToolChoice$=ir.ChatCompletionRequestToolChoice$outboundSchema=ir.ChatCompletionRequestToolChoice$inboundSchema=ir.Messages$=ir.Messages$outboundSchema=ir.Messages$inboundSchema=ir.Stop$=ir.Stop$outboundSchema=ir.Stop$inboundSchema=void 0;ir.stopToJSON=lOn;ir.stopFromJSON=cOn;ir.messagesToJSON=dOn;ir.messagesFromJSON=fOn;ir.chatCompletionRequestToolChoiceToJSON=pOn;ir.chatCompletionRequestToolChoiceFromJSON=mOn;ir.chatCompletionRequestToJSON=hOn;ir.chatCompletionRequestFromJSON=gOn;var Be=uOn(Ae()),mGt=He(),Gme=Oe(),Jme=f1(),hGt=X3(),gGt=Q3(),Zme=Lk(),yGt=eH(),Yme=tH(),Xme=rH(),Qme=Fk(),ehe=kk();ir.Stop$inboundSchema=Be.union([Be.string(),Be.array(Be.string())]);ir.Stop$outboundSchema=Be.union([Be.string(),Be.array(Be.string())]);var cGt;(function(t){t.inboundSchema=ir.Stop$inboundSchema,t.outboundSchema=ir.Stop$outboundSchema})(cGt||(ir.Stop$=cGt={}));function lOn(t){return JSON.stringify(ir.Stop$outboundSchema.parse(t))}function cOn(t){return(0,Gme.safeParse)(t,e=>ir.Stop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Stop' from JSON")}ir.Messages$inboundSchema=Be.union([Zme.SystemMessage$inboundSchema.and(Be.object({role:Be.literal("system")}).transform(t=>({role:t.role}))),ehe.UserMessage$inboundSchema.and(Be.object({role:Be.literal("user")}).transform(t=>({role:t.role}))),Jme.AssistantMessage$inboundSchema.and(Be.object({role:Be.literal("assistant")}).transform(t=>({role:t.role}))),Qme.ToolMessage$inboundSchema.and(Be.object({role:Be.literal("tool")}).transform(t=>({role:t.role})))]);ir.Messages$outboundSchema=Be.union([Zme.SystemMessage$outboundSchema.and(Be.object({role:Be.literal("system")}).transform(t=>({role:t.role}))),ehe.UserMessage$outboundSchema.and(Be.object({role:Be.literal("user")}).transform(t=>({role:t.role}))),Jme.AssistantMessage$outboundSchema.and(Be.object({role:Be.literal("assistant")}).transform(t=>({role:t.role}))),Qme.ToolMessage$outboundSchema.and(Be.object({role:Be.literal("tool")}).transform(t=>({role:t.role})))]);var dGt;(function(t){t.inboundSchema=ir.Messages$inboundSchema,t.outboundSchema=ir.Messages$outboundSchema})(dGt||(ir.Messages$=dGt={}));function dOn(t){return JSON.stringify(ir.Messages$outboundSchema.parse(t))}function fOn(t){return(0,Gme.safeParse)(t,e=>ir.Messages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Messages' from JSON")}ir.ChatCompletionRequestToolChoice$inboundSchema=Be.union([Yme.ToolChoice$inboundSchema,Xme.ToolChoiceEnum$inboundSchema]);ir.ChatCompletionRequestToolChoice$outboundSchema=Be.union([Yme.ToolChoice$outboundSchema,Xme.ToolChoiceEnum$outboundSchema]);var fGt;(function(t){t.inboundSchema=ir.ChatCompletionRequestToolChoice$inboundSchema,t.outboundSchema=ir.ChatCompletionRequestToolChoice$outboundSchema})(fGt||(ir.ChatCompletionRequestToolChoice$=fGt={}));function pOn(t){return JSON.stringify(ir.ChatCompletionRequestToolChoice$outboundSchema.parse(t))}function mOn(t){return(0,Gme.safeParse)(t,e=>ir.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}ir.ChatCompletionRequest$inboundSchema=Be.object({model:Be.nullable(Be.string()),temperature:Be.nullable(Be.number()).optional(),top_p:Be.number().optional(),max_tokens:Be.nullable(Be.number().int()).optional(),stream:Be.boolean().default(!1),stop:Be.union([Be.string(),Be.array(Be.string())]).optional(),random_seed:Be.nullable(Be.number().int()).optional(),messages:Be.array(Be.union([Zme.SystemMessage$inboundSchema.and(Be.object({role:Be.literal("system")}).transform(t=>({role:t.role}))),ehe.UserMessage$inboundSchema.and(Be.object({role:Be.literal("user")}).transform(t=>({role:t.role}))),Jme.AssistantMessage$inboundSchema.and(Be.object({role:Be.literal("assistant")}).transform(t=>({role:t.role}))),Qme.ToolMessage$inboundSchema.and(Be.object({role:Be.literal("tool")}).transform(t=>({role:t.role})))])),response_format:gGt.ResponseFormat$inboundSchema.optional(),tools:Be.nullable(Be.array(yGt.Tool$inboundSchema)).optional(),tool_choice:Be.union([Yme.ToolChoice$inboundSchema,Xme.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Be.number().optional(),frequency_penalty:Be.number().optional(),n:Be.nullable(Be.number().int()).optional(),prediction:hGt.Prediction$inboundSchema.optional(),safe_prompt:Be.boolean().optional()}).transform(t=>(0,mGt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",safe_prompt:"safePrompt"}));ir.ChatCompletionRequest$outboundSchema=Be.object({model:Be.nullable(Be.string()),temperature:Be.nullable(Be.number()).optional(),topP:Be.number().optional(),maxTokens:Be.nullable(Be.number().int()).optional(),stream:Be.boolean().default(!1),stop:Be.union([Be.string(),Be.array(Be.string())]).optional(),randomSeed:Be.nullable(Be.number().int()).optional(),messages:Be.array(Be.union([Zme.SystemMessage$outboundSchema.and(Be.object({role:Be.literal("system")}).transform(t=>({role:t.role}))),ehe.UserMessage$outboundSchema.and(Be.object({role:Be.literal("user")}).transform(t=>({role:t.role}))),Jme.AssistantMessage$outboundSchema.and(Be.object({role:Be.literal("assistant")}).transform(t=>({role:t.role}))),Qme.ToolMessage$outboundSchema.and(Be.object({role:Be.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:gGt.ResponseFormat$outboundSchema.optional(),tools:Be.nullable(Be.array(yGt.Tool$outboundSchema)).optional(),toolChoice:Be.union([Yme.ToolChoice$outboundSchema,Xme.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Be.number().optional(),frequencyPenalty:Be.number().optional(),n:Be.nullable(Be.number().int()).optional(),prediction:hGt.Prediction$outboundSchema.optional(),safePrompt:Be.boolean().optional()}).transform(t=>(0,mGt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",safePrompt:"safe_prompt"}));var pGt;(function(t){t.inboundSchema=ir.ChatCompletionRequest$inboundSchema,t.outboundSchema=ir.ChatCompletionRequest$outboundSchema})(pGt||(ir.ChatCompletionRequest$=pGt={}));function hOn(t){return JSON.stringify(ir.ChatCompletionRequest$outboundSchema.parse(t))}function gOn(t){return(0,Gme.safeParse)(t,e=>ir.ChatCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var oH=x(el=>{"use strict";var yOn=el&&el.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bOn=el&&el.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_On=el&&el.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yOn(e,t,r);return bOn(e,t),e};Object.defineProperty(el,"__esModule",{value:!0});el.UsageInfo$=el.UsageInfo$outboundSchema=el.UsageInfo$inboundSchema=void 0;el.usageInfoToJSON=wOn;el.usageInfoFromJSON=xOn;var p1=_On(Ae()),vGt=He(),vOn=Oe();el.UsageInfo$inboundSchema=p1.object({prompt_tokens:p1.number().int(),completion_tokens:p1.number().int(),total_tokens:p1.number().int()}).transform(t=>(0,vGt.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens"}));el.UsageInfo$outboundSchema=p1.object({promptTokens:p1.number().int(),completionTokens:p1.number().int(),totalTokens:p1.number().int()}).transform(t=>(0,vGt.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens"}));var _Gt;(function(t){t.inboundSchema=el.UsageInfo$inboundSchema,t.outboundSchema=el.UsageInfo$outboundSchema})(_Gt||(el.UsageInfo$=_Gt={}));function wOn(t){return JSON.stringify(el.UsageInfo$outboundSchema.parse(t))}function xOn(t){return(0,vOn.safeParse)(t,e=>el.UsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UsageInfo' from JSON")}});var CGt=x(tl=>{"use strict";var SOn=tl&&tl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),COn=tl&&tl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OOn=tl&&tl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SOn(e,t,r);return COn(e,t),e};Object.defineProperty(tl,"__esModule",{value:!0});tl.ChatCompletionResponse$=tl.ChatCompletionResponse$outboundSchema=tl.ChatCompletionResponse$inboundSchema=void 0;tl.chatCompletionResponseToJSON=POn;tl.chatCompletionResponseFromJSON=TOn;var eb=OOn(Ae()),EOn=Oe(),xGt=Kme(),SGt=oH();tl.ChatCompletionResponse$inboundSchema=eb.object({id:eb.string(),object:eb.string(),model:eb.string(),usage:SGt.UsageInfo$inboundSchema,created:eb.number().int().optional(),choices:eb.array(xGt.ChatCompletionChoice$inboundSchema).optional()});tl.ChatCompletionResponse$outboundSchema=eb.object({id:eb.string(),object:eb.string(),model:eb.string(),usage:SGt.UsageInfo$outboundSchema,created:eb.number().int().optional(),choices:eb.array(xGt.ChatCompletionChoice$outboundSchema).optional()});var wGt;(function(t){t.inboundSchema=tl.ChatCompletionResponse$inboundSchema,t.outboundSchema=tl.ChatCompletionResponse$outboundSchema})(wGt||(tl.ChatCompletionResponse$=wGt={}));function POn(t){return JSON.stringify(tl.ChatCompletionResponse$outboundSchema.parse(t))}function TOn(t){return(0,EOn.safeParse)(t,e=>tl.ChatCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var NGt=x(ar=>{"use strict";var AOn=ar&&ar.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IOn=ar&&ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MOn=ar&&ar.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&AOn(e,t,r);return IOn(e,t),e};Object.defineProperty(ar,"__esModule",{value:!0});ar.ChatCompletionStreamRequest$=ar.ChatCompletionStreamRequest$outboundSchema=ar.ChatCompletionStreamRequest$inboundSchema=ar.ChatCompletionStreamRequestToolChoice$=ar.ChatCompletionStreamRequestToolChoice$outboundSchema=ar.ChatCompletionStreamRequestToolChoice$inboundSchema=ar.ChatCompletionStreamRequestMessages$=ar.ChatCompletionStreamRequestMessages$outboundSchema=ar.ChatCompletionStreamRequestMessages$inboundSchema=ar.ChatCompletionStreamRequestStop$=ar.ChatCompletionStreamRequestStop$outboundSchema=ar.ChatCompletionStreamRequestStop$inboundSchema=void 0;ar.chatCompletionStreamRequestStopToJSON=ROn;ar.chatCompletionStreamRequestStopFromJSON=NOn;ar.chatCompletionStreamRequestMessagesToJSON=jOn;ar.chatCompletionStreamRequestMessagesFromJSON=DOn;ar.chatCompletionStreamRequestToolChoiceToJSON=LOn;ar.chatCompletionStreamRequestToolChoiceFromJSON=FOn;ar.chatCompletionStreamRequestToJSON=kOn;ar.chatCompletionStreamRequestFromJSON=$On;var ze=MOn(Ae()),AGt=He(),the=Oe(),rhe=f1(),IGt=X3(),MGt=Q3(),nhe=Lk(),RGt=eH(),ohe=tH(),ihe=rH(),ahe=Fk(),she=kk();ar.ChatCompletionStreamRequestStop$inboundSchema=ze.union([ze.string(),ze.array(ze.string())]);ar.ChatCompletionStreamRequestStop$outboundSchema=ze.union([ze.string(),ze.array(ze.string())]);var OGt;(function(t){t.inboundSchema=ar.ChatCompletionStreamRequestStop$inboundSchema,t.outboundSchema=ar.ChatCompletionStreamRequestStop$outboundSchema})(OGt||(ar.ChatCompletionStreamRequestStop$=OGt={}));function ROn(t){return JSON.stringify(ar.ChatCompletionStreamRequestStop$outboundSchema.parse(t))}function NOn(t){return(0,the.safeParse)(t,e=>ar.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}ar.ChatCompletionStreamRequestMessages$inboundSchema=ze.union([nhe.SystemMessage$inboundSchema.and(ze.object({role:ze.literal("system")}).transform(t=>({role:t.role}))),she.UserMessage$inboundSchema.and(ze.object({role:ze.literal("user")}).transform(t=>({role:t.role}))),rhe.AssistantMessage$inboundSchema.and(ze.object({role:ze.literal("assistant")}).transform(t=>({role:t.role}))),ahe.ToolMessage$inboundSchema.and(ze.object({role:ze.literal("tool")}).transform(t=>({role:t.role})))]);ar.ChatCompletionStreamRequestMessages$outboundSchema=ze.union([nhe.SystemMessage$outboundSchema.and(ze.object({role:ze.literal("system")}).transform(t=>({role:t.role}))),she.UserMessage$outboundSchema.and(ze.object({role:ze.literal("user")}).transform(t=>({role:t.role}))),rhe.AssistantMessage$outboundSchema.and(ze.object({role:ze.literal("assistant")}).transform(t=>({role:t.role}))),ahe.ToolMessage$outboundSchema.and(ze.object({role:ze.literal("tool")}).transform(t=>({role:t.role})))]);var EGt;(function(t){t.inboundSchema=ar.ChatCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=ar.ChatCompletionStreamRequestMessages$outboundSchema})(EGt||(ar.ChatCompletionStreamRequestMessages$=EGt={}));function jOn(t){return JSON.stringify(ar.ChatCompletionStreamRequestMessages$outboundSchema.parse(t))}function DOn(t){return(0,the.safeParse)(t,e=>ar.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}ar.ChatCompletionStreamRequestToolChoice$inboundSchema=ze.union([ohe.ToolChoice$inboundSchema,ihe.ToolChoiceEnum$inboundSchema]);ar.ChatCompletionStreamRequestToolChoice$outboundSchema=ze.union([ohe.ToolChoice$outboundSchema,ihe.ToolChoiceEnum$outboundSchema]);var PGt;(function(t){t.inboundSchema=ar.ChatCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=ar.ChatCompletionStreamRequestToolChoice$outboundSchema})(PGt||(ar.ChatCompletionStreamRequestToolChoice$=PGt={}));function LOn(t){return JSON.stringify(ar.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function FOn(t){return(0,the.safeParse)(t,e=>ar.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}ar.ChatCompletionStreamRequest$inboundSchema=ze.object({model:ze.nullable(ze.string()),temperature:ze.nullable(ze.number()).optional(),top_p:ze.number().optional(),max_tokens:ze.nullable(ze.number().int()).optional(),stream:ze.boolean().default(!0),stop:ze.union([ze.string(),ze.array(ze.string())]).optional(),random_seed:ze.nullable(ze.number().int()).optional(),messages:ze.array(ze.union([nhe.SystemMessage$inboundSchema.and(ze.object({role:ze.literal("system")}).transform(t=>({role:t.role}))),she.UserMessage$inboundSchema.and(ze.object({role:ze.literal("user")}).transform(t=>({role:t.role}))),rhe.AssistantMessage$inboundSchema.and(ze.object({role:ze.literal("assistant")}).transform(t=>({role:t.role}))),ahe.ToolMessage$inboundSchema.and(ze.object({role:ze.literal("tool")}).transform(t=>({role:t.role})))])),response_format:MGt.ResponseFormat$inboundSchema.optional(),tools:ze.nullable(ze.array(RGt.Tool$inboundSchema)).optional(),tool_choice:ze.union([ohe.ToolChoice$inboundSchema,ihe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:ze.number().optional(),frequency_penalty:ze.number().optional(),n:ze.nullable(ze.number().int()).optional(),prediction:IGt.Prediction$inboundSchema.optional(),safe_prompt:ze.boolean().optional()}).transform(t=>(0,AGt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",safe_prompt:"safePrompt"}));ar.ChatCompletionStreamRequest$outboundSchema=ze.object({model:ze.nullable(ze.string()),temperature:ze.nullable(ze.number()).optional(),topP:ze.number().optional(),maxTokens:ze.nullable(ze.number().int()).optional(),stream:ze.boolean().default(!0),stop:ze.union([ze.string(),ze.array(ze.string())]).optional(),randomSeed:ze.nullable(ze.number().int()).optional(),messages:ze.array(ze.union([nhe.SystemMessage$outboundSchema.and(ze.object({role:ze.literal("system")}).transform(t=>({role:t.role}))),she.UserMessage$outboundSchema.and(ze.object({role:ze.literal("user")}).transform(t=>({role:t.role}))),rhe.AssistantMessage$outboundSchema.and(ze.object({role:ze.literal("assistant")}).transform(t=>({role:t.role}))),ahe.ToolMessage$outboundSchema.and(ze.object({role:ze.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:MGt.ResponseFormat$outboundSchema.optional(),tools:ze.nullable(ze.array(RGt.Tool$outboundSchema)).optional(),toolChoice:ze.union([ohe.ToolChoice$outboundSchema,ihe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:ze.number().optional(),frequencyPenalty:ze.number().optional(),n:ze.nullable(ze.number().int()).optional(),prediction:IGt.Prediction$outboundSchema.optional(),safePrompt:ze.boolean().optional()}).transform(t=>(0,AGt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",safePrompt:"safe_prompt"}));var TGt;(function(t){t.inboundSchema=ar.ChatCompletionStreamRequest$inboundSchema,t.outboundSchema=ar.ChatCompletionStreamRequest$outboundSchema})(TGt||(ar.ChatCompletionStreamRequest$=TGt={}));function kOn(t){return JSON.stringify(ar.ChatCompletionStreamRequest$outboundSchema.parse(t))}function $On(t){return(0,the.safeParse)(t,e=>ar.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var _3e=x(rl=>{"use strict";var BOn=rl&&rl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zOn=rl&&rl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UOn=rl&&rl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BOn(e,t,r);return zOn(e,t),e};Object.defineProperty(rl,"__esModule",{value:!0});rl.MetricOut$=rl.MetricOut$outboundSchema=rl.MetricOut$inboundSchema=void 0;rl.metricOutToJSON=HOn;rl.metricOutFromJSON=VOn;var hh=UOn(Ae()),DGt=He(),qOn=Oe();rl.MetricOut$inboundSchema=hh.object({train_loss:hh.nullable(hh.number()).optional(),valid_loss:hh.nullable(hh.number()).optional(),valid_mean_token_accuracy:hh.nullable(hh.number()).optional()}).transform(t=>(0,DGt.remap)(t,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));rl.MetricOut$outboundSchema=hh.object({trainLoss:hh.nullable(hh.number()).optional(),validLoss:hh.nullable(hh.number()).optional(),validMeanTokenAccuracy:hh.nullable(hh.number()).optional()}).transform(t=>(0,DGt.remap)(t,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var jGt;(function(t){t.inboundSchema=rl.MetricOut$inboundSchema,t.outboundSchema=rl.MetricOut$outboundSchema})(jGt||(rl.MetricOut$=jGt={}));function HOn(t){return JSON.stringify(rl.MetricOut$outboundSchema.parse(t))}function VOn(t){return(0,qOn.safeParse)(t,e=>rl.MetricOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MetricOut' from JSON")}});var v3e=x(nl=>{"use strict";var WOn=nl&&nl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KOn=nl&&nl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GOn=nl&&nl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WOn(e,t,r);return KOn(e,t),e};Object.defineProperty(nl,"__esModule",{value:!0});nl.CheckpointOut$=nl.CheckpointOut$outboundSchema=nl.CheckpointOut$inboundSchema=void 0;nl.checkpointOutToJSON=ZOn;nl.checkpointOutFromJSON=YOn;var iH=GOn(Ae()),FGt=He(),JOn=Oe(),kGt=_3e();nl.CheckpointOut$inboundSchema=iH.object({metrics:kGt.MetricOut$inboundSchema,step_number:iH.number().int(),created_at:iH.number().int()}).transform(t=>(0,FGt.remap)(t,{step_number:"stepNumber",created_at:"createdAt"}));nl.CheckpointOut$outboundSchema=iH.object({metrics:kGt.MetricOut$outboundSchema,stepNumber:iH.number().int(),createdAt:iH.number().int()}).transform(t=>(0,FGt.remap)(t,{stepNumber:"step_number",createdAt:"created_at"}));var LGt;(function(t){t.inboundSchema=nl.CheckpointOut$inboundSchema,t.outboundSchema=nl.CheckpointOut$outboundSchema})(LGt||(nl.CheckpointOut$=LGt={}));function ZOn(t){return JSON.stringify(nl.CheckpointOut$outboundSchema.parse(t))}function YOn(t){return(0,JOn.safeParse)(t,e=>nl.CheckpointOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CheckpointOut' from JSON")}});var w3e=x(ol=>{"use strict";var XOn=ol&&ol.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QOn=ol&&ol.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eEn=ol&&ol.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XOn(e,t,r);return QOn(e,t),e};Object.defineProperty(ol,"__esModule",{value:!0});ol.ClassificationObject$=ol.ClassificationObject$outboundSchema=ol.ClassificationObject$inboundSchema=void 0;ol.classificationObjectToJSON=rEn;ol.classificationObjectFromJSON=nEn;var RO=eEn(Ae()),BGt=He(),tEn=Oe();ol.ClassificationObject$inboundSchema=RO.object({categories:RO.record(RO.boolean()).optional(),category_scores:RO.record(RO.number()).optional()}).transform(t=>(0,BGt.remap)(t,{category_scores:"categoryScores"}));ol.ClassificationObject$outboundSchema=RO.object({categories:RO.record(RO.boolean()).optional(),categoryScores:RO.record(RO.number()).optional()}).transform(t=>(0,BGt.remap)(t,{categoryScores:"category_scores"}));var $Gt;(function(t){t.inboundSchema=ol.ClassificationObject$inboundSchema,t.outboundSchema=ol.ClassificationObject$outboundSchema})($Gt||(ol.ClassificationObject$=$Gt={}));function rEn(t){return JSON.stringify(ol.ClassificationObject$outboundSchema.parse(t))}function nEn(t){return(0,tEn.safeParse)(t,e=>ol.ClassificationObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationObject' from JSON")}});var VGt=x(Yo=>{"use strict";var oEn=Yo&&Yo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iEn=Yo&&Yo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aEn=Yo&&Yo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oEn(e,t,r);return iEn(e,t),e};Object.defineProperty(Yo,"__esModule",{value:!0});Yo.ClassificationRequest$=Yo.ClassificationRequest$outboundSchema=Yo.ClassificationRequest$inboundSchema=Yo.ClassificationRequestInputs$=Yo.ClassificationRequestInputs$outboundSchema=Yo.ClassificationRequestInputs$inboundSchema=void 0;Yo.classificationRequestInputsToJSON=sEn;Yo.classificationRequestInputsFromJSON=uEn;Yo.classificationRequestToJSON=lEn;Yo.classificationRequestFromJSON=cEn;var Hs=aEn(Ae()),qGt=He(),HGt=Oe();Yo.ClassificationRequestInputs$inboundSchema=Hs.union([Hs.string(),Hs.array(Hs.string())]);Yo.ClassificationRequestInputs$outboundSchema=Hs.union([Hs.string(),Hs.array(Hs.string())]);var zGt;(function(t){t.inboundSchema=Yo.ClassificationRequestInputs$inboundSchema,t.outboundSchema=Yo.ClassificationRequestInputs$outboundSchema})(zGt||(Yo.ClassificationRequestInputs$=zGt={}));function sEn(t){return JSON.stringify(Yo.ClassificationRequestInputs$outboundSchema.parse(t))}function uEn(t){return(0,HGt.safeParse)(t,e=>Yo.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequestInputs' from JSON")}Yo.ClassificationRequest$inboundSchema=Hs.object({input:Hs.union([Hs.string(),Hs.array(Hs.string())]),model:Hs.nullable(Hs.string()).optional()}).transform(t=>(0,qGt.remap)(t,{input:"inputs"}));Yo.ClassificationRequest$outboundSchema=Hs.object({inputs:Hs.union([Hs.string(),Hs.array(Hs.string())]),model:Hs.nullable(Hs.string()).optional()}).transform(t=>(0,qGt.remap)(t,{inputs:"input"}));var UGt;(function(t){t.inboundSchema=Yo.ClassificationRequest$inboundSchema,t.outboundSchema=Yo.ClassificationRequest$outboundSchema})(UGt||(Yo.ClassificationRequest$=UGt={}));function lEn(t){return JSON.stringify(Yo.ClassificationRequest$outboundSchema.parse(t))}function cEn(t){return(0,HGt.safeParse)(t,e=>Yo.ClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequest' from JSON")}});var GGt=x(il=>{"use strict";var dEn=il&&il.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fEn=il&&il.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pEn=il&&il.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dEn(e,t,r);return fEn(e,t),e};Object.defineProperty(il,"__esModule",{value:!0});il.ClassificationResponse$=il.ClassificationResponse$outboundSchema=il.ClassificationResponse$inboundSchema=void 0;il.classificationResponseToJSON=hEn;il.classificationResponseFromJSON=gEn;var m1=pEn(Ae()),mEn=Oe(),KGt=w3e();il.ClassificationResponse$inboundSchema=m1.object({id:m1.string().optional(),model:m1.string().optional(),results:m1.array(KGt.ClassificationObject$inboundSchema).optional()});il.ClassificationResponse$outboundSchema=m1.object({id:m1.string().optional(),model:m1.string().optional(),results:m1.array(KGt.ClassificationObject$outboundSchema).optional()});var WGt;(function(t){t.inboundSchema=il.ClassificationResponse$inboundSchema,t.outboundSchema=il.ClassificationResponse$outboundSchema})(WGt||(il.ClassificationResponse$=WGt={}));function hEn(t){return JSON.stringify(il.ClassificationResponse$outboundSchema.parse(t))}function gEn(t){return(0,mEn.safeParse)(t,e=>il.ClassificationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationResponse' from JSON")}});var x3e=x(Xo=>{"use strict";var yEn=Xo&&Xo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bEn=Xo&&Xo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_En=Xo&&Xo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yEn(e,t,r);return bEn(e,t),e};Object.defineProperty(Xo,"__esModule",{value:!0});Xo.DeltaMessage$=Xo.DeltaMessage$outboundSchema=Xo.DeltaMessage$inboundSchema=Xo.Content$=Xo.Content$outboundSchema=Xo.Content$inboundSchema=void 0;Xo.contentToJSON=vEn;Xo.contentFromJSON=wEn;Xo.deltaMessageToJSON=xEn;Xo.deltaMessageFromJSON=SEn;var Ya=_En(Ae()),YGt=He(),XGt=Oe(),uhe=Z3(),QGt=Cme();Xo.Content$inboundSchema=Ya.union([Ya.string(),Ya.array(uhe.ContentChunk$inboundSchema)]);Xo.Content$outboundSchema=Ya.union([Ya.string(),Ya.array(uhe.ContentChunk$outboundSchema)]);var JGt;(function(t){t.inboundSchema=Xo.Content$inboundSchema,t.outboundSchema=Xo.Content$outboundSchema})(JGt||(Xo.Content$=JGt={}));function vEn(t){return JSON.stringify(Xo.Content$outboundSchema.parse(t))}function wEn(t){return(0,XGt.safeParse)(t,e=>Xo.Content$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Content' from JSON")}Xo.DeltaMessage$inboundSchema=Ya.object({role:Ya.nullable(Ya.string()).optional(),content:Ya.nullable(Ya.union([Ya.string(),Ya.array(uhe.ContentChunk$inboundSchema)])).optional(),tool_calls:Ya.nullable(Ya.array(QGt.ToolCall$inboundSchema)).optional()}).transform(t=>(0,YGt.remap)(t,{tool_calls:"toolCalls"}));Xo.DeltaMessage$outboundSchema=Ya.object({role:Ya.nullable(Ya.string()).optional(),content:Ya.nullable(Ya.union([Ya.string(),Ya.array(uhe.ContentChunk$outboundSchema)])).optional(),toolCalls:Ya.nullable(Ya.array(QGt.ToolCall$outboundSchema)).optional()}).transform(t=>(0,YGt.remap)(t,{toolCalls:"tool_calls"}));var ZGt;(function(t){t.inboundSchema=Xo.DeltaMessage$inboundSchema,t.outboundSchema=Xo.DeltaMessage$outboundSchema})(ZGt||(Xo.DeltaMessage$=ZGt={}));function xEn(t){return JSON.stringify(Xo.DeltaMessage$outboundSchema.parse(t))}function SEn(t){return(0,XGt.safeParse)(t,e=>Xo.DeltaMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeltaMessage' from JSON")}});var S3e=x(Ro=>{"use strict";var CEn=Ro&&Ro.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OEn=Ro&&Ro.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EEn=Ro&&Ro.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CEn(e,t,r);return OEn(e,t),e};Object.defineProperty(Ro,"__esModule",{value:!0});Ro.CompletionResponseStreamChoice$=Ro.CompletionResponseStreamChoice$outboundSchema=Ro.CompletionResponseStreamChoice$inboundSchema=Ro.CompletionResponseStreamChoiceFinishReason$=Ro.CompletionResponseStreamChoiceFinishReason$outboundSchema=Ro.CompletionResponseStreamChoiceFinishReason$inboundSchema=Ro.CompletionResponseStreamChoiceFinishReason=void 0;Ro.completionResponseStreamChoiceToJSON=AEn;Ro.completionResponseStreamChoiceFromJSON=IEn;var wg=EEn(Ae()),rJt=He(),PEn=Oe(),TEn=d1(),nJt=x3e();Ro.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};Ro.CompletionResponseStreamChoiceFinishReason$inboundSchema=wg.union([wg.nativeEnum(Ro.CompletionResponseStreamChoiceFinishReason),wg.string().transform(TEn.catchUnrecognizedEnum)]);Ro.CompletionResponseStreamChoiceFinishReason$outboundSchema=wg.union([wg.nativeEnum(Ro.CompletionResponseStreamChoiceFinishReason),wg.string().and(wg.custom())]);var eJt;(function(t){t.inboundSchema=Ro.CompletionResponseStreamChoiceFinishReason$inboundSchema,t.outboundSchema=Ro.CompletionResponseStreamChoiceFinishReason$outboundSchema})(eJt||(Ro.CompletionResponseStreamChoiceFinishReason$=eJt={}));Ro.CompletionResponseStreamChoice$inboundSchema=wg.object({index:wg.number().int(),delta:nJt.DeltaMessage$inboundSchema,finish_reason:wg.nullable(Ro.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(t=>(0,rJt.remap)(t,{finish_reason:"finishReason"}));Ro.CompletionResponseStreamChoice$outboundSchema=wg.object({index:wg.number().int(),delta:nJt.DeltaMessage$outboundSchema,finishReason:wg.nullable(Ro.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(t=>(0,rJt.remap)(t,{finishReason:"finish_reason"}));var tJt;(function(t){t.inboundSchema=Ro.CompletionResponseStreamChoice$inboundSchema,t.outboundSchema=Ro.CompletionResponseStreamChoice$outboundSchema})(tJt||(Ro.CompletionResponseStreamChoice$=tJt={}));function AEn(t){return JSON.stringify(Ro.CompletionResponseStreamChoice$outboundSchema.parse(t))}function IEn(t){return(0,PEn.safeParse)(t,e=>Ro.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var C3e=x(al=>{"use strict";var MEn=al&&al.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),REn=al&&al.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NEn=al&&al.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MEn(e,t,r);return REn(e,t),e};Object.defineProperty(al,"__esModule",{value:!0});al.CompletionChunk$=al.CompletionChunk$outboundSchema=al.CompletionChunk$inboundSchema=void 0;al.completionChunkToJSON=DEn;al.completionChunkFromJSON=LEn;var tb=NEn(Ae()),jEn=Oe(),iJt=S3e(),aJt=oH();al.CompletionChunk$inboundSchema=tb.object({id:tb.string(),object:tb.string().optional(),created:tb.number().int().optional(),model:tb.string(),usage:aJt.UsageInfo$inboundSchema.optional(),choices:tb.array(iJt.CompletionResponseStreamChoice$inboundSchema)});al.CompletionChunk$outboundSchema=tb.object({id:tb.string(),object:tb.string().optional(),created:tb.number().int().optional(),model:tb.string(),usage:aJt.UsageInfo$outboundSchema.optional(),choices:tb.array(iJt.CompletionResponseStreamChoice$outboundSchema)});var oJt;(function(t){t.inboundSchema=al.CompletionChunk$inboundSchema,t.outboundSchema=al.CompletionChunk$outboundSchema})(oJt||(al.CompletionChunk$=oJt={}));function DEn(t){return JSON.stringify(al.CompletionChunk$outboundSchema.parse(t))}function LEn(t){return(0,jEn.safeParse)(t,e=>al.CompletionChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionChunk' from JSON")}});var lJt=x(sl=>{"use strict";var FEn=sl&&sl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kEn=sl&&sl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$En=sl&&sl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FEn(e,t,r);return kEn(e,t),e};Object.defineProperty(sl,"__esModule",{value:!0});sl.CompletionEvent$=sl.CompletionEvent$outboundSchema=sl.CompletionEvent$inboundSchema=void 0;sl.completionEventToJSON=zEn;sl.completionEventFromJSON=UEn;var WJ=$En(Ae()),BEn=Oe(),uJt=C3e();sl.CompletionEvent$inboundSchema=WJ.object({data:WJ.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:WJ.ZodIssueCode.custom,message:`malformed json: ${r}`}),WJ.NEVER}}).pipe(uJt.CompletionChunk$inboundSchema)});sl.CompletionEvent$outboundSchema=WJ.object({data:uJt.CompletionChunk$outboundSchema});var sJt;(function(t){t.inboundSchema=sl.CompletionEvent$inboundSchema,t.outboundSchema=sl.CompletionEvent$outboundSchema})(sJt||(sl.CompletionEvent$=sJt={}));function zEn(t){return JSON.stringify(sl.CompletionEvent$outboundSchema.parse(t))}function UEn(t){return(0,BEn.safeParse)(t,e=>sl.CompletionEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionEvent' from JSON")}});var dJt=x(ul=>{"use strict";var qEn=ul&&ul.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HEn=ul&&ul.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VEn=ul&&ul.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qEn(e,t,r);return HEn(e,t),e};Object.defineProperty(ul,"__esModule",{value:!0});ul.DeleteFileOut$=ul.DeleteFileOut$outboundSchema=ul.DeleteFileOut$inboundSchema=void 0;ul.deleteFileOutToJSON=KEn;ul.deleteFileOutFromJSON=GEn;var h1=VEn(Ae()),WEn=Oe();ul.DeleteFileOut$inboundSchema=h1.object({id:h1.string(),object:h1.string(),deleted:h1.boolean()});ul.DeleteFileOut$outboundSchema=h1.object({id:h1.string(),object:h1.string(),deleted:h1.boolean()});var cJt;(function(t){t.inboundSchema=ul.DeleteFileOut$inboundSchema,t.outboundSchema=ul.DeleteFileOut$outboundSchema})(cJt||(ul.DeleteFileOut$=cJt={}));function KEn(t){return JSON.stringify(ul.DeleteFileOut$outboundSchema.parse(t))}function GEn(t){return(0,WEn.safeParse)(t,e=>ul.DeleteFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteFileOut' from JSON")}});var pJt=x(ll=>{"use strict";var JEn=ll&&ll.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZEn=ll&&ll.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YEn=ll&&ll.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JEn(e,t,r);return ZEn(e,t),e};Object.defineProperty(ll,"__esModule",{value:!0});ll.DeleteModelOut$=ll.DeleteModelOut$outboundSchema=ll.DeleteModelOut$inboundSchema=void 0;ll.deleteModelOutToJSON=QEn;ll.deleteModelOutFromJSON=ePn;var g1=YEn(Ae()),XEn=Oe();ll.DeleteModelOut$inboundSchema=g1.object({id:g1.string(),object:g1.string().default("model"),deleted:g1.boolean().default(!0)});ll.DeleteModelOut$outboundSchema=g1.object({id:g1.string(),object:g1.string().default("model"),deleted:g1.boolean().default(!0)});var fJt;(function(t){t.inboundSchema=ll.DeleteModelOut$inboundSchema,t.outboundSchema=ll.DeleteModelOut$outboundSchema})(fJt||(ll.DeleteModelOut$=fJt={}));function QEn(t){return JSON.stringify(ll.DeleteModelOut$outboundSchema.parse(t))}function ePn(t){return(0,XEn.safeParse)(t,e=>ll.DeleteModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelOut' from JSON")}});var O3e=x(cl=>{"use strict";var tPn=cl&&cl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rPn=cl&&cl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nPn=cl&&cl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tPn(e,t,r);return rPn(e,t),e};Object.defineProperty(cl,"__esModule",{value:!0});cl.EventOut$=cl.EventOut$outboundSchema=cl.EventOut$inboundSchema=void 0;cl.eventOutToJSON=iPn;cl.eventOutFromJSON=aPn;var rb=nPn(Ae()),hJt=He(),oPn=Oe();cl.EventOut$inboundSchema=rb.object({name:rb.string(),data:rb.nullable(rb.record(rb.any())).optional(),created_at:rb.number().int()}).transform(t=>(0,hJt.remap)(t,{created_at:"createdAt"}));cl.EventOut$outboundSchema=rb.object({name:rb.string(),data:rb.nullable(rb.record(rb.any())).optional(),createdAt:rb.number().int()}).transform(t=>(0,hJt.remap)(t,{createdAt:"created_at"}));var mJt;(function(t){t.inboundSchema=cl.EventOut$inboundSchema,t.outboundSchema=cl.EventOut$outboundSchema})(mJt||(cl.EventOut$=mJt={}));function iPn(t){return JSON.stringify(cl.EventOut$outboundSchema.parse(t))}function aPn(t){return(0,oPn.safeParse)(t,e=>cl.EventOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EventOut' from JSON")}});var lhe=x(Qo=>{"use strict";var sPn=Qo&&Qo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uPn=Qo&&Qo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lPn=Qo&&Qo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sPn(e,t,r);return uPn(e,t),e};Object.defineProperty(Qo,"__esModule",{value:!0});Qo.GithubRepositoryOut$=Qo.GithubRepositoryOut$outboundSchema=Qo.GithubRepositoryOut$inboundSchema=Qo.GithubRepositoryOutType$=Qo.GithubRepositoryOutType$outboundSchema=Qo.GithubRepositoryOutType$inboundSchema=Qo.GithubRepositoryOutType=void 0;Qo.githubRepositoryOutToJSON=dPn;Qo.githubRepositoryOutFromJSON=fPn;var Xd=lPn(Ae()),bJt=He(),cPn=Oe();Qo.GithubRepositoryOutType={Github:"github"};Qo.GithubRepositoryOutType$inboundSchema=Xd.nativeEnum(Qo.GithubRepositoryOutType);Qo.GithubRepositoryOutType$outboundSchema=Qo.GithubRepositoryOutType$inboundSchema;var gJt;(function(t){t.inboundSchema=Qo.GithubRepositoryOutType$inboundSchema,t.outboundSchema=Qo.GithubRepositoryOutType$outboundSchema})(gJt||(Qo.GithubRepositoryOutType$=gJt={}));Qo.GithubRepositoryOut$inboundSchema=Xd.object({type:Xd.literal("github").default("github"),name:Xd.string(),owner:Xd.string(),ref:Xd.nullable(Xd.string()).optional(),weight:Xd.number().default(1),commit_id:Xd.string()}).transform(t=>(0,bJt.remap)(t,{commit_id:"commitId"}));Qo.GithubRepositoryOut$outboundSchema=Xd.object({type:Xd.literal("github").default("github"),name:Xd.string(),owner:Xd.string(),ref:Xd.nullable(Xd.string()).optional(),weight:Xd.number().default(1),commitId:Xd.string()}).transform(t=>(0,bJt.remap)(t,{commitId:"commit_id"}));var yJt;(function(t){t.inboundSchema=Qo.GithubRepositoryOut$inboundSchema,t.outboundSchema=Qo.GithubRepositoryOut$outboundSchema})(yJt||(Qo.GithubRepositoryOut$=yJt={}));function dPn(t){return JSON.stringify(Qo.GithubRepositoryOut$outboundSchema.parse(t))}function fPn(t){return(0,cPn.safeParse)(t,e=>Qo.GithubRepositoryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var che=x(dl=>{"use strict";var pPn=dl&&dl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mPn=dl&&dl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hPn=dl&&dl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pPn(e,t,r);return mPn(e,t),e};Object.defineProperty(dl,"__esModule",{value:!0});dl.JobMetadataOut$=dl.JobMetadataOut$outboundSchema=dl.JobMetadataOut$inboundSchema=void 0;dl.jobMetadataOutToJSON=yPn;dl.jobMetadataOutFromJSON=bPn;var Ni=hPn(Ae()),vJt=He(),gPn=Oe();dl.JobMetadataOut$inboundSchema=Ni.object({expected_duration_seconds:Ni.nullable(Ni.number().int()).optional(),cost:Ni.nullable(Ni.number()).optional(),cost_currency:Ni.nullable(Ni.string()).optional(),train_tokens_per_step:Ni.nullable(Ni.number().int()).optional(),train_tokens:Ni.nullable(Ni.number().int()).optional(),data_tokens:Ni.nullable(Ni.number().int()).optional(),estimated_start_time:Ni.nullable(Ni.number().int()).optional()}).transform(t=>(0,vJt.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));dl.JobMetadataOut$outboundSchema=Ni.object({expectedDurationSeconds:Ni.nullable(Ni.number().int()).optional(),cost:Ni.nullable(Ni.number()).optional(),costCurrency:Ni.nullable(Ni.string()).optional(),trainTokensPerStep:Ni.nullable(Ni.number().int()).optional(),trainTokens:Ni.nullable(Ni.number().int()).optional(),dataTokens:Ni.nullable(Ni.number().int()).optional(),estimatedStartTime:Ni.nullable(Ni.number().int()).optional()}).transform(t=>(0,vJt.remap)(t,{expectedDurationSeconds:"expected_duration_seconds",costCurrency:"cost_currency",trainTokensPerStep:"train_tokens_per_step",trainTokens:"train_tokens",dataTokens:"data_tokens",estimatedStartTime:"estimated_start_time"}));var _Jt;(function(t){t.inboundSchema=dl.JobMetadataOut$inboundSchema,t.outboundSchema=dl.JobMetadataOut$outboundSchema})(_Jt||(dl.JobMetadataOut$=_Jt={}));function yPn(t){return JSON.stringify(dl.JobMetadataOut$outboundSchema.parse(t))}function bPn(t){return(0,gPn.safeParse)(t,e=>dl.JobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobMetadataOut' from JSON")}});var dhe=x(fl=>{"use strict";var _Pn=fl&&fl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vPn=fl&&fl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wPn=fl&&fl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Pn(e,t,r);return vPn(e,t),e};Object.defineProperty(fl,"__esModule",{value:!0});fl.TrainingParameters$=fl.TrainingParameters$outboundSchema=fl.TrainingParameters$inboundSchema=void 0;fl.trainingParametersToJSON=SPn;fl.trainingParametersFromJSON=CPn;var Xi=wPn(Ae()),xJt=He(),xPn=Oe();fl.TrainingParameters$inboundSchema=Xi.object({training_steps:Xi.nullable(Xi.number().int()).optional(),learning_rate:Xi.number().default(1e-4),weight_decay:Xi.nullable(Xi.number()).optional(),warmup_fraction:Xi.nullable(Xi.number()).optional(),epochs:Xi.nullable(Xi.number()).optional(),fim_ratio:Xi.nullable(Xi.number()).optional(),seq_len:Xi.nullable(Xi.number().int()).optional()}).transform(t=>(0,xJt.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));fl.TrainingParameters$outboundSchema=Xi.object({trainingSteps:Xi.nullable(Xi.number().int()).optional(),learningRate:Xi.number().default(1e-4),weightDecay:Xi.nullable(Xi.number()).optional(),warmupFraction:Xi.nullable(Xi.number()).optional(),epochs:Xi.nullable(Xi.number()).optional(),fimRatio:Xi.nullable(Xi.number()).optional(),seqLen:Xi.nullable(Xi.number().int()).optional()}).transform(t=>(0,xJt.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var wJt;(function(t){t.inboundSchema=fl.TrainingParameters$inboundSchema,t.outboundSchema=fl.TrainingParameters$outboundSchema})(wJt||(fl.TrainingParameters$=wJt={}));function SPn(t){return JSON.stringify(fl.TrainingParameters$outboundSchema.parse(t))}function CPn(t){return(0,xPn.safeParse)(t,e=>fl.TrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParameters' from JSON")}});var fhe=x(ei=>{"use strict";var OPn=ei&&ei.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EPn=ei&&ei.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PPn=ei&&ei.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OPn(e,t,r);return EPn(e,t),e};Object.defineProperty(ei,"__esModule",{value:!0});ei.WandbIntegrationOut$=ei.WandbIntegrationOut$outboundSchema=ei.WandbIntegrationOut$inboundSchema=ei.WandbIntegrationOutType$=ei.WandbIntegrationOutType$outboundSchema=ei.WandbIntegrationOutType$inboundSchema=ei.WandbIntegrationOutType=void 0;ei.wandbIntegrationOutToJSON=APn;ei.wandbIntegrationOutFromJSON=IPn;var em=PPn(Ae()),OJt=He(),TPn=Oe();ei.WandbIntegrationOutType={Wandb:"wandb"};ei.WandbIntegrationOutType$inboundSchema=em.nativeEnum(ei.WandbIntegrationOutType);ei.WandbIntegrationOutType$outboundSchema=ei.WandbIntegrationOutType$inboundSchema;var SJt;(function(t){t.inboundSchema=ei.WandbIntegrationOutType$inboundSchema,t.outboundSchema=ei.WandbIntegrationOutType$outboundSchema})(SJt||(ei.WandbIntegrationOutType$=SJt={}));ei.WandbIntegrationOut$inboundSchema=em.object({type:em.literal("wandb").default("wandb"),project:em.string(),name:em.nullable(em.string()).optional(),run_name:em.nullable(em.string()).optional()}).transform(t=>(0,OJt.remap)(t,{run_name:"runName"}));ei.WandbIntegrationOut$outboundSchema=em.object({type:em.literal("wandb").default("wandb"),project:em.string(),name:em.nullable(em.string()).optional(),runName:em.nullable(em.string()).optional()}).transform(t=>(0,OJt.remap)(t,{runName:"run_name"}));var CJt;(function(t){t.inboundSchema=ei.WandbIntegrationOut$inboundSchema,t.outboundSchema=ei.WandbIntegrationOut$outboundSchema})(CJt||(ei.WandbIntegrationOut$=CJt={}));function APn(t){return JSON.stringify(ei.WandbIntegrationOut$outboundSchema.parse(t))}function IPn(t){return(0,TPn.safeParse)(t,e=>ei.WandbIntegrationOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var LJt=x(vt=>{"use strict";var MPn=vt&&vt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RPn=vt&&vt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NPn=vt&&vt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MPn(e,t,r);return RPn(e,t),e};Object.defineProperty(vt,"__esModule",{value:!0});vt.DetailedJobOut$=vt.DetailedJobOut$outboundSchema=vt.DetailedJobOut$inboundSchema=vt.DetailedJobOutRepositories$=vt.DetailedJobOutRepositories$outboundSchema=vt.DetailedJobOutRepositories$inboundSchema=vt.DetailedJobOutIntegrations$=vt.DetailedJobOutIntegrations$outboundSchema=vt.DetailedJobOutIntegrations$inboundSchema=vt.DetailedJobOutObject$=vt.DetailedJobOutObject$outboundSchema=vt.DetailedJobOutObject$inboundSchema=vt.DetailedJobOutStatus$=vt.DetailedJobOutStatus$outboundSchema=vt.DetailedJobOutStatus$inboundSchema=vt.DetailedJobOutObject=vt.DetailedJobOutStatus=void 0;vt.detailedJobOutIntegrationsToJSON=jPn;vt.detailedJobOutIntegrationsFromJSON=DPn;vt.detailedJobOutRepositoriesToJSON=LPn;vt.detailedJobOutRepositoriesFromJSON=FPn;vt.detailedJobOutToJSON=kPn;vt.detailedJobOutFromJSON=$Pn;var yr=NPn(Ae()),MJt=He(),E3e=Oe(),RJt=v3e(),NJt=O3e(),phe=lhe(),jJt=che(),DJt=dhe(),mhe=fhe();vt.DetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};vt.DetailedJobOutObject={Job:"job"};vt.DetailedJobOutStatus$inboundSchema=yr.nativeEnum(vt.DetailedJobOutStatus);vt.DetailedJobOutStatus$outboundSchema=vt.DetailedJobOutStatus$inboundSchema;var EJt;(function(t){t.inboundSchema=vt.DetailedJobOutStatus$inboundSchema,t.outboundSchema=vt.DetailedJobOutStatus$outboundSchema})(EJt||(vt.DetailedJobOutStatus$=EJt={}));vt.DetailedJobOutObject$inboundSchema=yr.nativeEnum(vt.DetailedJobOutObject);vt.DetailedJobOutObject$outboundSchema=vt.DetailedJobOutObject$inboundSchema;var PJt;(function(t){t.inboundSchema=vt.DetailedJobOutObject$inboundSchema,t.outboundSchema=vt.DetailedJobOutObject$outboundSchema})(PJt||(vt.DetailedJobOutObject$=PJt={}));vt.DetailedJobOutIntegrations$inboundSchema=mhe.WandbIntegrationOut$inboundSchema;vt.DetailedJobOutIntegrations$outboundSchema=mhe.WandbIntegrationOut$outboundSchema;var TJt;(function(t){t.inboundSchema=vt.DetailedJobOutIntegrations$inboundSchema,t.outboundSchema=vt.DetailedJobOutIntegrations$outboundSchema})(TJt||(vt.DetailedJobOutIntegrations$=TJt={}));function jPn(t){return JSON.stringify(vt.DetailedJobOutIntegrations$outboundSchema.parse(t))}function DPn(t){return(0,E3e.safeParse)(t,e=>vt.DetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutIntegrations' from JSON")}vt.DetailedJobOutRepositories$inboundSchema=phe.GithubRepositoryOut$inboundSchema;vt.DetailedJobOutRepositories$outboundSchema=phe.GithubRepositoryOut$outboundSchema;var AJt;(function(t){t.inboundSchema=vt.DetailedJobOutRepositories$inboundSchema,t.outboundSchema=vt.DetailedJobOutRepositories$outboundSchema})(AJt||(vt.DetailedJobOutRepositories$=AJt={}));function LPn(t){return JSON.stringify(vt.DetailedJobOutRepositories$outboundSchema.parse(t))}function FPn(t){return(0,E3e.safeParse)(t,e=>vt.DetailedJobOutRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutRepositories' from JSON")}vt.DetailedJobOut$inboundSchema=yr.object({id:yr.string(),auto_start:yr.boolean(),hyperparameters:DJt.TrainingParameters$inboundSchema,model:yr.string(),status:vt.DetailedJobOutStatus$inboundSchema,job_type:yr.string(),created_at:yr.number().int(),modified_at:yr.number().int(),training_files:yr.array(yr.string()),validation_files:yr.nullable(yr.array(yr.string())).optional(),object:yr.literal("job").default("job"),fine_tuned_model:yr.nullable(yr.string()).optional(),suffix:yr.nullable(yr.string()).optional(),integrations:yr.nullable(yr.array(mhe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:yr.nullable(yr.number().int()).optional(),repositories:yr.array(phe.GithubRepositoryOut$inboundSchema).optional(),metadata:yr.nullable(jJt.JobMetadataOut$inboundSchema).optional(),events:yr.array(NJt.EventOut$inboundSchema).optional(),checkpoints:yr.array(RJt.CheckpointOut$inboundSchema).optional()}).transform(t=>(0,MJt.remap)(t,{auto_start:"autoStart",job_type:"jobType",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens"}));vt.DetailedJobOut$outboundSchema=yr.object({id:yr.string(),autoStart:yr.boolean(),hyperparameters:DJt.TrainingParameters$outboundSchema,model:yr.string(),status:vt.DetailedJobOutStatus$outboundSchema,jobType:yr.string(),createdAt:yr.number().int(),modifiedAt:yr.number().int(),trainingFiles:yr.array(yr.string()),validationFiles:yr.nullable(yr.array(yr.string())).optional(),object:yr.literal("job").default("job"),fineTunedModel:yr.nullable(yr.string()).optional(),suffix:yr.nullable(yr.string()).optional(),integrations:yr.nullable(yr.array(mhe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:yr.nullable(yr.number().int()).optional(),repositories:yr.array(phe.GithubRepositoryOut$outboundSchema).optional(),metadata:yr.nullable(jJt.JobMetadataOut$outboundSchema).optional(),events:yr.array(NJt.EventOut$outboundSchema).optional(),checkpoints:yr.array(RJt.CheckpointOut$outboundSchema).optional()}).transform(t=>(0,MJt.remap)(t,{autoStart:"auto_start",jobType:"job_type",createdAt:"created_at",modifiedAt:"modified_at",trainingFiles:"training_files",validationFiles:"validation_files",fineTunedModel:"fine_tuned_model",trainedTokens:"trained_tokens"}));var IJt;(function(t){t.inboundSchema=vt.DetailedJobOut$inboundSchema,t.outboundSchema=vt.DetailedJobOut$outboundSchema})(IJt||(vt.DetailedJobOut$=IJt={}));function kPn(t){return JSON.stringify(vt.DetailedJobOut$outboundSchema.parse(t))}function $Pn(t){return(0,E3e.safeParse)(t,e=>vt.DetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOut' from JSON")}});var zJt=x(ti=>{"use strict";var BPn=ti&&ti.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zPn=ti&&ti.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UPn=ti&&ti.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BPn(e,t,r);return zPn(e,t),e};Object.defineProperty(ti,"__esModule",{value:!0});ti.EmbeddingRequest$=ti.EmbeddingRequest$outboundSchema=ti.EmbeddingRequest$inboundSchema=ti.Inputs$=ti.Inputs$outboundSchema=ti.Inputs$inboundSchema=void 0;ti.inputsToJSON=qPn;ti.inputsFromJSON=HPn;ti.embeddingRequestToJSON=VPn;ti.embeddingRequestFromJSON=WPn;var Xa=UPn(Ae()),$Jt=He(),BJt=Oe();ti.Inputs$inboundSchema=Xa.union([Xa.string(),Xa.array(Xa.string())]);ti.Inputs$outboundSchema=Xa.union([Xa.string(),Xa.array(Xa.string())]);var FJt;(function(t){t.inboundSchema=ti.Inputs$inboundSchema,t.outboundSchema=ti.Inputs$outboundSchema})(FJt||(ti.Inputs$=FJt={}));function qPn(t){return JSON.stringify(ti.Inputs$outboundSchema.parse(t))}function HPn(t){return(0,BJt.safeParse)(t,e=>ti.Inputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Inputs' from JSON")}ti.EmbeddingRequest$inboundSchema=Xa.object({input:Xa.union([Xa.string(),Xa.array(Xa.string())]),model:Xa.string().default("mistral-embed"),encoding_format:Xa.nullable(Xa.string()).optional()}).transform(t=>(0,$Jt.remap)(t,{input:"inputs",encoding_format:"encodingFormat"}));ti.EmbeddingRequest$outboundSchema=Xa.object({inputs:Xa.union([Xa.string(),Xa.array(Xa.string())]),model:Xa.string().default("mistral-embed"),encodingFormat:Xa.nullable(Xa.string()).optional()}).transform(t=>(0,$Jt.remap)(t,{inputs:"input",encodingFormat:"encoding_format"}));var kJt;(function(t){t.inboundSchema=ti.EmbeddingRequest$inboundSchema,t.outboundSchema=ti.EmbeddingRequest$outboundSchema})(kJt||(ti.EmbeddingRequest$=kJt={}));function VPn(t){return JSON.stringify(ti.EmbeddingRequest$outboundSchema.parse(t))}function WPn(t){return(0,BJt.safeParse)(t,e=>ti.EmbeddingRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequest' from JSON")}});var P3e=x(pl=>{"use strict";var KPn=pl&&pl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GPn=pl&&pl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JPn=pl&&pl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KPn(e,t,r);return GPn(e,t),e};Object.defineProperty(pl,"__esModule",{value:!0});pl.EmbeddingResponseData$=pl.EmbeddingResponseData$outboundSchema=pl.EmbeddingResponseData$inboundSchema=void 0;pl.embeddingResponseDataToJSON=YPn;pl.embeddingResponseDataFromJSON=XPn;var NO=JPn(Ae()),ZPn=Oe();pl.EmbeddingResponseData$inboundSchema=NO.object({object:NO.string().optional(),embedding:NO.array(NO.number()).optional(),index:NO.number().int().optional()});pl.EmbeddingResponseData$outboundSchema=NO.object({object:NO.string().optional(),embedding:NO.array(NO.number()).optional(),index:NO.number().int().optional()});var UJt;(function(t){t.inboundSchema=pl.EmbeddingResponseData$inboundSchema,t.outboundSchema=pl.EmbeddingResponseData$outboundSchema})(UJt||(pl.EmbeddingResponseData$=UJt={}));function YPn(t){return JSON.stringify(pl.EmbeddingResponseData$outboundSchema.parse(t))}function XPn(t){return(0,ZPn.safeParse)(t,e=>pl.EmbeddingResponseData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var WJt=x(ml=>{"use strict";var QPn=ml&&ml.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eTn=ml&&ml.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tTn=ml&&ml.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QPn(e,t,r);return eTn(e,t),e};Object.defineProperty(ml,"__esModule",{value:!0});ml.EmbeddingResponse$=ml.EmbeddingResponse$outboundSchema=ml.EmbeddingResponse$inboundSchema=void 0;ml.embeddingResponseToJSON=nTn;ml.embeddingResponseFromJSON=oTn;var jO=tTn(Ae()),rTn=Oe(),HJt=P3e(),VJt=oH();ml.EmbeddingResponse$inboundSchema=jO.object({id:jO.string(),object:jO.string(),model:jO.string(),usage:VJt.UsageInfo$inboundSchema,data:jO.array(HJt.EmbeddingResponseData$inboundSchema)});ml.EmbeddingResponse$outboundSchema=jO.object({id:jO.string(),object:jO.string(),model:jO.string(),usage:VJt.UsageInfo$outboundSchema,data:jO.array(HJt.EmbeddingResponseData$outboundSchema)});var qJt;(function(t){t.inboundSchema=ml.EmbeddingResponse$inboundSchema,t.outboundSchema=ml.EmbeddingResponse$outboundSchema})(qJt||(ml.EmbeddingResponse$=qJt={}));function nTn(t){return JSON.stringify(ml.EmbeddingResponse$outboundSchema.parse(t))}function oTn(t){return(0,rTn.safeParse)(t,e=>ml.EmbeddingResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponse' from JSON")}});var KJ=x(hl=>{"use strict";var iTn=hl&&hl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aTn=hl&&hl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sTn=hl&&hl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iTn(e,t,r);return aTn(e,t),e};Object.defineProperty(hl,"__esModule",{value:!0});hl.FilePurpose$=hl.FilePurpose$outboundSchema=hl.FilePurpose$inboundSchema=hl.FilePurpose=void 0;var Bk=sTn(Ae()),uTn=d1();hl.FilePurpose={FineTune:"fine-tune",Batch:"batch"};hl.FilePurpose$inboundSchema=Bk.union([Bk.nativeEnum(hl.FilePurpose),Bk.string().transform(uTn.catchUnrecognizedEnum)]);hl.FilePurpose$outboundSchema=Bk.union([Bk.nativeEnum(hl.FilePurpose),Bk.string().and(Bk.custom())]);var KJt;(function(t){t.inboundSchema=hl.FilePurpose$inboundSchema,t.outboundSchema=hl.FilePurpose$outboundSchema})(KJt||(hl.FilePurpose$=KJt={}))});var GJ=x(gl=>{"use strict";var lTn=gl&&gl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cTn=gl&&gl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dTn=gl&&gl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lTn(e,t,r);return cTn(e,t),e};Object.defineProperty(gl,"__esModule",{value:!0});gl.SampleType$=gl.SampleType$outboundSchema=gl.SampleType$inboundSchema=gl.SampleType=void 0;var zk=dTn(Ae()),fTn=d1();gl.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};gl.SampleType$inboundSchema=zk.union([zk.nativeEnum(gl.SampleType),zk.string().transform(fTn.catchUnrecognizedEnum)]);gl.SampleType$outboundSchema=zk.union([zk.nativeEnum(gl.SampleType),zk.string().and(zk.custom())]);var GJt;(function(t){t.inboundSchema=gl.SampleType$inboundSchema,t.outboundSchema=gl.SampleType$outboundSchema})(GJt||(gl.SampleType$=GJt={}))});var JJ=x(yl=>{"use strict";var pTn=yl&&yl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mTn=yl&&yl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hTn=yl&&yl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pTn(e,t,r);return mTn(e,t),e};Object.defineProperty(yl,"__esModule",{value:!0});yl.Source$=yl.Source$outboundSchema=yl.Source$inboundSchema=yl.Source=void 0;var Uk=hTn(Ae()),gTn=d1();yl.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};yl.Source$inboundSchema=Uk.union([Uk.nativeEnum(yl.Source),Uk.string().transform(gTn.catchUnrecognizedEnum)]);yl.Source$outboundSchema=Uk.union([Uk.nativeEnum(yl.Source),Uk.string().and(Uk.custom())]);var JJt;(function(t){t.inboundSchema=yl.Source$inboundSchema,t.outboundSchema=yl.Source$outboundSchema})(JJt||(yl.Source$=JJt={}))});var T3e=x(bl=>{"use strict";var yTn=bl&&bl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bTn=bl&&bl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Tn=bl&&bl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yTn(e,t,r);return bTn(e,t),e};Object.defineProperty(bl,"__esModule",{value:!0});bl.FileSchema$=bl.FileSchema$outboundSchema=bl.FileSchema$inboundSchema=void 0;bl.fileSchemaToJSON=wTn;bl.fileSchemaFromJSON=xTn;var sp=_Tn(Ae()),YJt=He(),vTn=Oe(),XJt=KJ(),QJt=GJ(),e7t=JJ();bl.FileSchema$inboundSchema=sp.object({id:sp.string(),object:sp.string(),bytes:sp.number().int(),created_at:sp.number().int(),filename:sp.string(),purpose:XJt.FilePurpose$inboundSchema,sample_type:QJt.SampleType$inboundSchema,num_lines:sp.nullable(sp.number().int()).optional(),source:e7t.Source$inboundSchema}).transform(t=>(0,YJt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));bl.FileSchema$outboundSchema=sp.object({id:sp.string(),object:sp.string(),sizeBytes:sp.number().int(),createdAt:sp.number().int(),filename:sp.string(),purpose:XJt.FilePurpose$outboundSchema,sampleType:QJt.SampleType$outboundSchema,numLines:sp.nullable(sp.number().int()).optional(),source:e7t.Source$outboundSchema}).transform(t=>(0,YJt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var ZJt;(function(t){t.inboundSchema=bl.FileSchema$inboundSchema,t.outboundSchema=bl.FileSchema$outboundSchema})(ZJt||(bl.FileSchema$=ZJt={}));function wTn(t){return JSON.stringify(bl.FileSchema$outboundSchema.parse(t))}function xTn(t){return(0,vTn.safeParse)(t,e=>bl.FileSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSchema' from JSON")}});var r7t=x(_l=>{"use strict";var STn=_l&&_l.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CTn=_l&&_l.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OTn=_l&&_l.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&STn(e,t,r);return CTn(e,t),e};Object.defineProperty(_l,"__esModule",{value:!0});_l.FileSignedURL$=_l.FileSignedURL$outboundSchema=_l.FileSignedURL$inboundSchema=void 0;_l.fileSignedURLToJSON=PTn;_l.fileSignedURLFromJSON=TTn;var hhe=OTn(Ae()),ETn=Oe();_l.FileSignedURL$inboundSchema=hhe.object({url:hhe.string()});_l.FileSignedURL$outboundSchema=hhe.object({url:hhe.string()});var t7t;(function(t){t.inboundSchema=_l.FileSignedURL$inboundSchema,t.outboundSchema=_l.FileSignedURL$outboundSchema})(t7t||(_l.FileSignedURL$=t7t={}));function PTn(t){return JSON.stringify(_l.FileSignedURL$outboundSchema.parse(t))}function TTn(t){return(0,ETn.safeParse)(t,e=>_l.FileSignedURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSignedURL' from JSON")}});var s7t=x(ri=>{"use strict";var ATn=ri&&ri.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ITn=ri&&ri.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MTn=ri&&ri.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ATn(e,t,r);return ITn(e,t),e};Object.defineProperty(ri,"__esModule",{value:!0});ri.FIMCompletionRequest$=ri.FIMCompletionRequest$outboundSchema=ri.FIMCompletionRequest$inboundSchema=ri.FIMCompletionRequestStop$=ri.FIMCompletionRequestStop$outboundSchema=ri.FIMCompletionRequestStop$inboundSchema=void 0;ri.fimCompletionRequestStopToJSON=RTn;ri.fimCompletionRequestStopFromJSON=NTn;ri.fimCompletionRequestToJSON=jTn;ri.fimCompletionRequestFromJSON=DTn;var Nr=MTn(Ae()),i7t=He(),a7t=Oe();ri.FIMCompletionRequestStop$inboundSchema=Nr.union([Nr.string(),Nr.array(Nr.string())]);ri.FIMCompletionRequestStop$outboundSchema=Nr.union([Nr.string(),Nr.array(Nr.string())]);var n7t;(function(t){t.inboundSchema=ri.FIMCompletionRequestStop$inboundSchema,t.outboundSchema=ri.FIMCompletionRequestStop$outboundSchema})(n7t||(ri.FIMCompletionRequestStop$=n7t={}));function RTn(t){return JSON.stringify(ri.FIMCompletionRequestStop$outboundSchema.parse(t))}function NTn(t){return(0,a7t.safeParse)(t,e=>ri.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}ri.FIMCompletionRequest$inboundSchema=Nr.object({model:Nr.nullable(Nr.string()),temperature:Nr.nullable(Nr.number()).optional(),top_p:Nr.number().default(1),max_tokens:Nr.nullable(Nr.number().int()).optional(),stream:Nr.boolean().default(!1),stop:Nr.union([Nr.string(),Nr.array(Nr.string())]).optional(),random_seed:Nr.nullable(Nr.number().int()).optional(),prompt:Nr.string(),suffix:Nr.nullable(Nr.string()).optional(),min_tokens:Nr.nullable(Nr.number().int()).optional()}).transform(t=>(0,i7t.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));ri.FIMCompletionRequest$outboundSchema=Nr.object({model:Nr.nullable(Nr.string()),temperature:Nr.nullable(Nr.number()).optional(),topP:Nr.number().default(1),maxTokens:Nr.nullable(Nr.number().int()).optional(),stream:Nr.boolean().default(!1),stop:Nr.union([Nr.string(),Nr.array(Nr.string())]).optional(),randomSeed:Nr.nullable(Nr.number().int()).optional(),prompt:Nr.string(),suffix:Nr.nullable(Nr.string()).optional(),minTokens:Nr.nullable(Nr.number().int()).optional()}).transform(t=>(0,i7t.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var o7t;(function(t){t.inboundSchema=ri.FIMCompletionRequest$inboundSchema,t.outboundSchema=ri.FIMCompletionRequest$outboundSchema})(o7t||(ri.FIMCompletionRequest$=o7t={}));function jTn(t){return JSON.stringify(ri.FIMCompletionRequest$outboundSchema.parse(t))}function DTn(t){return(0,a7t.safeParse)(t,e=>ri.FIMCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var d7t=x(vl=>{"use strict";var LTn=vl&&vl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FTn=vl&&vl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kTn=vl&&vl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LTn(e,t,r);return FTn(e,t),e};Object.defineProperty(vl,"__esModule",{value:!0});vl.FIMCompletionResponse$=vl.FIMCompletionResponse$outboundSchema=vl.FIMCompletionResponse$inboundSchema=void 0;vl.fimCompletionResponseToJSON=BTn;vl.fimCompletionResponseFromJSON=zTn;var nb=kTn(Ae()),$Tn=Oe(),l7t=Kme(),c7t=oH();vl.FIMCompletionResponse$inboundSchema=nb.object({id:nb.string(),object:nb.string(),model:nb.string(),usage:c7t.UsageInfo$inboundSchema,created:nb.number().int().optional(),choices:nb.array(l7t.ChatCompletionChoice$inboundSchema).optional()});vl.FIMCompletionResponse$outboundSchema=nb.object({id:nb.string(),object:nb.string(),model:nb.string(),usage:c7t.UsageInfo$outboundSchema,created:nb.number().int().optional(),choices:nb.array(l7t.ChatCompletionChoice$outboundSchema).optional()});var u7t;(function(t){t.inboundSchema=vl.FIMCompletionResponse$inboundSchema,t.outboundSchema=vl.FIMCompletionResponse$outboundSchema})(u7t||(vl.FIMCompletionResponse$=u7t={}));function BTn(t){return JSON.stringify(vl.FIMCompletionResponse$outboundSchema.parse(t))}function zTn(t){return(0,$Tn.safeParse)(t,e=>vl.FIMCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var g7t=x(ni=>{"use strict";var UTn=ni&&ni.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qTn=ni&&ni.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HTn=ni&&ni.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UTn(e,t,r);return qTn(e,t),e};Object.defineProperty(ni,"__esModule",{value:!0});ni.FIMCompletionStreamRequest$=ni.FIMCompletionStreamRequest$outboundSchema=ni.FIMCompletionStreamRequest$inboundSchema=ni.FIMCompletionStreamRequestStop$=ni.FIMCompletionStreamRequestStop$outboundSchema=ni.FIMCompletionStreamRequestStop$inboundSchema=void 0;ni.fimCompletionStreamRequestStopToJSON=VTn;ni.fimCompletionStreamRequestStopFromJSON=WTn;ni.fimCompletionStreamRequestToJSON=KTn;ni.fimCompletionStreamRequestFromJSON=GTn;var jr=HTn(Ae()),m7t=He(),h7t=Oe();ni.FIMCompletionStreamRequestStop$inboundSchema=jr.union([jr.string(),jr.array(jr.string())]);ni.FIMCompletionStreamRequestStop$outboundSchema=jr.union([jr.string(),jr.array(jr.string())]);var f7t;(function(t){t.inboundSchema=ni.FIMCompletionStreamRequestStop$inboundSchema,t.outboundSchema=ni.FIMCompletionStreamRequestStop$outboundSchema})(f7t||(ni.FIMCompletionStreamRequestStop$=f7t={}));function VTn(t){return JSON.stringify(ni.FIMCompletionStreamRequestStop$outboundSchema.parse(t))}function WTn(t){return(0,h7t.safeParse)(t,e=>ni.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}ni.FIMCompletionStreamRequest$inboundSchema=jr.object({model:jr.nullable(jr.string()),temperature:jr.nullable(jr.number()).optional(),top_p:jr.number().default(1),max_tokens:jr.nullable(jr.number().int()).optional(),stream:jr.boolean().default(!0),stop:jr.union([jr.string(),jr.array(jr.string())]).optional(),random_seed:jr.nullable(jr.number().int()).optional(),prompt:jr.string(),suffix:jr.nullable(jr.string()).optional(),min_tokens:jr.nullable(jr.number().int()).optional()}).transform(t=>(0,m7t.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));ni.FIMCompletionStreamRequest$outboundSchema=jr.object({model:jr.nullable(jr.string()),temperature:jr.nullable(jr.number()).optional(),topP:jr.number().default(1),maxTokens:jr.nullable(jr.number().int()).optional(),stream:jr.boolean().default(!0),stop:jr.union([jr.string(),jr.array(jr.string())]).optional(),randomSeed:jr.nullable(jr.number().int()).optional(),prompt:jr.string(),suffix:jr.nullable(jr.string()).optional(),minTokens:jr.nullable(jr.number().int()).optional()}).transform(t=>(0,m7t.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var p7t;(function(t){t.inboundSchema=ni.FIMCompletionStreamRequest$inboundSchema,t.outboundSchema=ni.FIMCompletionStreamRequest$outboundSchema})(p7t||(ni.FIMCompletionStreamRequest$=p7t={}));function KTn(t){return JSON.stringify(ni.FIMCompletionStreamRequest$outboundSchema.parse(t))}function GTn(t){return(0,h7t.safeParse)(t,e=>ni.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var A3e=x(wl=>{"use strict";var JTn=wl&&wl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZTn=wl&&wl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YTn=wl&&wl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JTn(e,t,r);return ZTn(e,t),e};Object.defineProperty(wl,"__esModule",{value:!0});wl.FTModelCapabilitiesOut$=wl.FTModelCapabilitiesOut$outboundSchema=wl.FTModelCapabilitiesOut$inboundSchema=void 0;wl.ftModelCapabilitiesOutToJSON=QTn;wl.ftModelCapabilitiesOutFromJSON=eAn;var DO=YTn(Ae()),b7t=He(),XTn=Oe();wl.FTModelCapabilitiesOut$inboundSchema=DO.object({completion_chat:DO.boolean().default(!0),completion_fim:DO.boolean().default(!1),function_calling:DO.boolean().default(!1),fine_tuning:DO.boolean().default(!1)}).transform(t=>(0,b7t.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));wl.FTModelCapabilitiesOut$outboundSchema=DO.object({completionChat:DO.boolean().default(!0),completionFim:DO.boolean().default(!1),functionCalling:DO.boolean().default(!1),fineTuning:DO.boolean().default(!1)}).transform(t=>(0,b7t.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var y7t;(function(t){t.inboundSchema=wl.FTModelCapabilitiesOut$inboundSchema,t.outboundSchema=wl.FTModelCapabilitiesOut$outboundSchema})(y7t||(wl.FTModelCapabilitiesOut$=y7t={}));function QTn(t){return JSON.stringify(wl.FTModelCapabilitiesOut$outboundSchema.parse(t))}function eAn(t){return(0,XTn.safeParse)(t,e=>wl.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var I3e=x(oi=>{"use strict";var tAn=oi&&oi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rAn=oi&&oi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nAn=oi&&oi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tAn(e,t,r);return rAn(e,t),e};Object.defineProperty(oi,"__esModule",{value:!0});oi.FTModelCard$=oi.FTModelCard$outboundSchema=oi.FTModelCard$inboundSchema=oi.FTModelCardType$=oi.FTModelCardType$outboundSchema=oi.FTModelCardType$inboundSchema=oi.FTModelCardType=void 0;oi.ftModelCardToJSON=iAn;oi.ftModelCardFromJSON=aAn;var Sn=nAn(Ae()),w7t=He(),oAn=Oe(),x7t=Vme();oi.FTModelCardType={FineTuned:"fine-tuned"};oi.FTModelCardType$inboundSchema=Sn.nativeEnum(oi.FTModelCardType);oi.FTModelCardType$outboundSchema=oi.FTModelCardType$inboundSchema;var _7t;(function(t){t.inboundSchema=oi.FTModelCardType$inboundSchema,t.outboundSchema=oi.FTModelCardType$outboundSchema})(_7t||(oi.FTModelCardType$=_7t={}));oi.FTModelCard$inboundSchema=Sn.object({id:Sn.string(),object:Sn.string().default("model"),created:Sn.number().int().optional(),owned_by:Sn.string().default("mistralai"),capabilities:x7t.ModelCapabilities$inboundSchema,name:Sn.nullable(Sn.string()).optional(),description:Sn.nullable(Sn.string()).optional(),max_context_length:Sn.number().int().default(32768),aliases:Sn.array(Sn.string()).optional(),deprecation:Sn.nullable(Sn.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:Sn.nullable(Sn.number()).optional(),type:Sn.literal("fine-tuned").default("fine-tuned"),job:Sn.string(),root:Sn.string(),archived:Sn.boolean().default(!1)}).transform(t=>(0,w7t.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));oi.FTModelCard$outboundSchema=Sn.object({id:Sn.string(),object:Sn.string().default("model"),created:Sn.number().int().optional(),ownedBy:Sn.string().default("mistralai"),capabilities:x7t.ModelCapabilities$outboundSchema,name:Sn.nullable(Sn.string()).optional(),description:Sn.nullable(Sn.string()).optional(),maxContextLength:Sn.number().int().default(32768),aliases:Sn.array(Sn.string()).optional(),deprecation:Sn.nullable(Sn.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:Sn.nullable(Sn.number()).optional(),type:Sn.literal("fine-tuned").default("fine-tuned"),job:Sn.string(),root:Sn.string(),archived:Sn.boolean().default(!1)}).transform(t=>(0,w7t.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var v7t;(function(t){t.inboundSchema=oi.FTModelCard$inboundSchema,t.outboundSchema=oi.FTModelCard$outboundSchema})(v7t||(oi.FTModelCard$=v7t={}));function iAn(t){return JSON.stringify(oi.FTModelCard$outboundSchema.parse(t))}function aAn(t){return(0,oAn.safeParse)(t,e=>oi.FTModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCard' from JSON")}});var P7t=x(ii=>{"use strict";var sAn=ii&&ii.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uAn=ii&&ii.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lAn=ii&&ii.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sAn(e,t,r);return uAn(e,t),e};Object.defineProperty(ii,"__esModule",{value:!0});ii.FTModelOut$=ii.FTModelOut$outboundSchema=ii.FTModelOut$inboundSchema=ii.FTModelOutObject$=ii.FTModelOutObject$outboundSchema=ii.FTModelOutObject$inboundSchema=ii.FTModelOutObject=void 0;ii.ftModelOutToJSON=dAn;ii.ftModelOutFromJSON=fAn;var Oi=lAn(Ae()),O7t=He(),cAn=Oe(),E7t=A3e();ii.FTModelOutObject={Model:"model"};ii.FTModelOutObject$inboundSchema=Oi.nativeEnum(ii.FTModelOutObject);ii.FTModelOutObject$outboundSchema=ii.FTModelOutObject$inboundSchema;var S7t;(function(t){t.inboundSchema=ii.FTModelOutObject$inboundSchema,t.outboundSchema=ii.FTModelOutObject$outboundSchema})(S7t||(ii.FTModelOutObject$=S7t={}));ii.FTModelOut$inboundSchema=Oi.object({id:Oi.string(),object:Oi.literal("model").default("model"),created:Oi.number().int(),owned_by:Oi.string(),root:Oi.string(),archived:Oi.boolean(),name:Oi.nullable(Oi.string()).optional(),description:Oi.nullable(Oi.string()).optional(),capabilities:E7t.FTModelCapabilitiesOut$inboundSchema,max_context_length:Oi.number().int().default(32768),aliases:Oi.array(Oi.string()).optional(),job:Oi.string()}).transform(t=>(0,O7t.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength"}));ii.FTModelOut$outboundSchema=Oi.object({id:Oi.string(),object:Oi.literal("model").default("model"),created:Oi.number().int(),ownedBy:Oi.string(),root:Oi.string(),archived:Oi.boolean(),name:Oi.nullable(Oi.string()).optional(),description:Oi.nullable(Oi.string()).optional(),capabilities:E7t.FTModelCapabilitiesOut$outboundSchema,maxContextLength:Oi.number().int().default(32768),aliases:Oi.array(Oi.string()).optional(),job:Oi.string()}).transform(t=>(0,O7t.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length"}));var C7t;(function(t){t.inboundSchema=ii.FTModelOut$inboundSchema,t.outboundSchema=ii.FTModelOut$outboundSchema})(C7t||(ii.FTModelOut$=C7t={}));function dAn(t){return JSON.stringify(ii.FTModelOut$outboundSchema.parse(t))}function fAn(t){return(0,cAn.safeParse)(t,e=>ii.FTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelOut' from JSON")}});var M3e=x(ai=>{"use strict";var pAn=ai&&ai.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mAn=ai&&ai.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hAn=ai&&ai.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pAn(e,t,r);return mAn(e,t),e};Object.defineProperty(ai,"__esModule",{value:!0});ai.GithubRepositoryIn$=ai.GithubRepositoryIn$outboundSchema=ai.GithubRepositoryIn$inboundSchema=ai.GithubRepositoryInType$=ai.GithubRepositoryInType$outboundSchema=ai.GithubRepositoryInType$inboundSchema=ai.GithubRepositoryInType=void 0;ai.githubRepositoryInToJSON=yAn;ai.githubRepositoryInFromJSON=bAn;var Qd=hAn(Ae()),gAn=Oe();ai.GithubRepositoryInType={Github:"github"};ai.GithubRepositoryInType$inboundSchema=Qd.nativeEnum(ai.GithubRepositoryInType);ai.GithubRepositoryInType$outboundSchema=ai.GithubRepositoryInType$inboundSchema;var T7t;(function(t){t.inboundSchema=ai.GithubRepositoryInType$inboundSchema,t.outboundSchema=ai.GithubRepositoryInType$outboundSchema})(T7t||(ai.GithubRepositoryInType$=T7t={}));ai.GithubRepositoryIn$inboundSchema=Qd.object({type:Qd.literal("github").default("github"),name:Qd.string(),owner:Qd.string(),ref:Qd.nullable(Qd.string()).optional(),weight:Qd.number().default(1),token:Qd.string()});ai.GithubRepositoryIn$outboundSchema=Qd.object({type:Qd.literal("github").default("github"),name:Qd.string(),owner:Qd.string(),ref:Qd.nullable(Qd.string()).optional(),weight:Qd.number().default(1),token:Qd.string()});var A7t;(function(t){t.inboundSchema=ai.GithubRepositoryIn$inboundSchema,t.outboundSchema=ai.GithubRepositoryIn$outboundSchema})(A7t||(ai.GithubRepositoryIn$=A7t={}));function yAn(t){return JSON.stringify(ai.GithubRepositoryIn$outboundSchema.parse(t))}function bAn(t){return(0,gAn.safeParse)(t,e=>ai.GithubRepositoryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var R3e=x(xl=>{"use strict";var _An=xl&&xl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vAn=xl&&xl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wAn=xl&&xl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_An(e,t,r);return vAn(e,t),e};Object.defineProperty(xl,"__esModule",{value:!0});xl.TrainingFile$=xl.TrainingFile$outboundSchema=xl.TrainingFile$inboundSchema=void 0;xl.trainingFileToJSON=SAn;xl.trainingFileFromJSON=CAn;var aH=wAn(Ae()),M7t=He(),xAn=Oe();xl.TrainingFile$inboundSchema=aH.object({file_id:aH.string(),weight:aH.number().default(1)}).transform(t=>(0,M7t.remap)(t,{file_id:"fileId"}));xl.TrainingFile$outboundSchema=aH.object({fileId:aH.string(),weight:aH.number().default(1)}).transform(t=>(0,M7t.remap)(t,{fileId:"file_id"}));var I7t;(function(t){t.inboundSchema=xl.TrainingFile$inboundSchema,t.outboundSchema=xl.TrainingFile$outboundSchema})(I7t||(xl.TrainingFile$=I7t={}));function SAn(t){return JSON.stringify(xl.TrainingFile$outboundSchema.parse(t))}function CAn(t){return(0,xAn.safeParse)(t,e=>xl.TrainingFile$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingFile' from JSON")}});var N3e=x(Sl=>{"use strict";var OAn=Sl&&Sl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EAn=Sl&&Sl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PAn=Sl&&Sl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OAn(e,t,r);return EAn(e,t),e};Object.defineProperty(Sl,"__esModule",{value:!0});Sl.TrainingParametersIn$=Sl.TrainingParametersIn$outboundSchema=Sl.TrainingParametersIn$inboundSchema=void 0;Sl.trainingParametersInToJSON=AAn;Sl.trainingParametersInFromJSON=IAn;var Qi=PAn(Ae()),N7t=He(),TAn=Oe();Sl.TrainingParametersIn$inboundSchema=Qi.object({training_steps:Qi.nullable(Qi.number().int()).optional(),learning_rate:Qi.number().default(1e-4),weight_decay:Qi.nullable(Qi.number()).optional(),warmup_fraction:Qi.nullable(Qi.number()).optional(),epochs:Qi.nullable(Qi.number()).optional(),fim_ratio:Qi.nullable(Qi.number()).optional(),seq_len:Qi.nullable(Qi.number().int()).optional()}).transform(t=>(0,N7t.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));Sl.TrainingParametersIn$outboundSchema=Qi.object({trainingSteps:Qi.nullable(Qi.number().int()).optional(),learningRate:Qi.number().default(1e-4),weightDecay:Qi.nullable(Qi.number()).optional(),warmupFraction:Qi.nullable(Qi.number()).optional(),epochs:Qi.nullable(Qi.number()).optional(),fimRatio:Qi.nullable(Qi.number()).optional(),seqLen:Qi.nullable(Qi.number().int()).optional()}).transform(t=>(0,N7t.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var R7t;(function(t){t.inboundSchema=Sl.TrainingParametersIn$inboundSchema,t.outboundSchema=Sl.TrainingParametersIn$outboundSchema})(R7t||(Sl.TrainingParametersIn$=R7t={}));function AAn(t){return JSON.stringify(Sl.TrainingParametersIn$outboundSchema.parse(t))}function IAn(t){return(0,TAn.safeParse)(t,e=>Sl.TrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParametersIn' from JSON")}});var j3e=x(si=>{"use strict";var MAn=si&&si.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RAn=si&&si.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NAn=si&&si.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MAn(e,t,r);return RAn(e,t),e};Object.defineProperty(si,"__esModule",{value:!0});si.WandbIntegration$=si.WandbIntegration$outboundSchema=si.WandbIntegration$inboundSchema=si.WandbIntegrationType$=si.WandbIntegrationType$outboundSchema=si.WandbIntegrationType$inboundSchema=si.WandbIntegrationType=void 0;si.wandbIntegrationToJSON=DAn;si.wandbIntegrationFromJSON=LAn;var ef=NAn(Ae()),L7t=He(),jAn=Oe();si.WandbIntegrationType={Wandb:"wandb"};si.WandbIntegrationType$inboundSchema=ef.nativeEnum(si.WandbIntegrationType);si.WandbIntegrationType$outboundSchema=si.WandbIntegrationType$inboundSchema;var j7t;(function(t){t.inboundSchema=si.WandbIntegrationType$inboundSchema,t.outboundSchema=si.WandbIntegrationType$outboundSchema})(j7t||(si.WandbIntegrationType$=j7t={}));si.WandbIntegration$inboundSchema=ef.object({type:ef.literal("wandb").default("wandb"),project:ef.string(),name:ef.nullable(ef.string()).optional(),api_key:ef.string(),run_name:ef.nullable(ef.string()).optional()}).transform(t=>(0,L7t.remap)(t,{api_key:"apiKey",run_name:"runName"}));si.WandbIntegration$outboundSchema=ef.object({type:ef.literal("wandb").default("wandb"),project:ef.string(),name:ef.nullable(ef.string()).optional(),apiKey:ef.string(),runName:ef.nullable(ef.string()).optional()}).transform(t=>(0,L7t.remap)(t,{apiKey:"api_key",runName:"run_name"}));var D7t;(function(t){t.inboundSchema=si.WandbIntegration$inboundSchema,t.outboundSchema=si.WandbIntegration$outboundSchema})(D7t||(si.WandbIntegration$=D7t={}));function DAn(t){return JSON.stringify(si.WandbIntegration$outboundSchema.parse(t))}function LAn(t){return(0,jAn.safeParse)(t,e=>si.WandbIntegration$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegration' from JSON")}});var q7t=x(rn=>{"use strict";var FAn=rn&&rn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kAn=rn&&rn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$An=rn&&rn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FAn(e,t,r);return kAn(e,t),e};Object.defineProperty(rn,"__esModule",{value:!0});rn.JobIn$=rn.JobIn$outboundSchema=rn.JobIn$inboundSchema=rn.JobInRepositories$=rn.JobInRepositories$outboundSchema=rn.JobInRepositories$inboundSchema=rn.JobInIntegrations$=rn.JobInIntegrations$outboundSchema=rn.JobInIntegrations$inboundSchema=void 0;rn.jobInIntegrationsToJSON=BAn;rn.jobInIntegrationsFromJSON=zAn;rn.jobInRepositoriesToJSON=UAn;rn.jobInRepositoriesFromJSON=qAn;rn.jobInToJSON=HAn;rn.jobInFromJSON=VAn;var Qa=$An(Ae()),B7t=He(),D3e=Oe(),ghe=M3e(),z7t=R3e(),U7t=N3e(),yhe=j3e();rn.JobInIntegrations$inboundSchema=yhe.WandbIntegration$inboundSchema;rn.JobInIntegrations$outboundSchema=yhe.WandbIntegration$outboundSchema;var F7t;(function(t){t.inboundSchema=rn.JobInIntegrations$inboundSchema,t.outboundSchema=rn.JobInIntegrations$outboundSchema})(F7t||(rn.JobInIntegrations$=F7t={}));function BAn(t){return JSON.stringify(rn.JobInIntegrations$outboundSchema.parse(t))}function zAn(t){return(0,D3e.safeParse)(t,e=>rn.JobInIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInIntegrations' from JSON")}rn.JobInRepositories$inboundSchema=ghe.GithubRepositoryIn$inboundSchema;rn.JobInRepositories$outboundSchema=ghe.GithubRepositoryIn$outboundSchema;var k7t;(function(t){t.inboundSchema=rn.JobInRepositories$inboundSchema,t.outboundSchema=rn.JobInRepositories$outboundSchema})(k7t||(rn.JobInRepositories$=k7t={}));function UAn(t){return JSON.stringify(rn.JobInRepositories$outboundSchema.parse(t))}function qAn(t){return(0,D3e.safeParse)(t,e=>rn.JobInRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInRepositories' from JSON")}rn.JobIn$inboundSchema=Qa.object({model:Qa.string(),training_files:Qa.array(z7t.TrainingFile$inboundSchema).optional(),validation_files:Qa.nullable(Qa.array(Qa.string())).optional(),hyperparameters:U7t.TrainingParametersIn$inboundSchema,suffix:Qa.nullable(Qa.string()).optional(),integrations:Qa.nullable(Qa.array(yhe.WandbIntegration$inboundSchema)).optional(),repositories:Qa.array(ghe.GithubRepositoryIn$inboundSchema).optional(),auto_start:Qa.boolean().optional()}).transform(t=>(0,B7t.remap)(t,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart"}));rn.JobIn$outboundSchema=Qa.object({model:Qa.string(),trainingFiles:Qa.array(z7t.TrainingFile$outboundSchema).optional(),validationFiles:Qa.nullable(Qa.array(Qa.string())).optional(),hyperparameters:U7t.TrainingParametersIn$outboundSchema,suffix:Qa.nullable(Qa.string()).optional(),integrations:Qa.nullable(Qa.array(yhe.WandbIntegration$outboundSchema)).optional(),repositories:Qa.array(ghe.GithubRepositoryIn$outboundSchema).optional(),autoStart:Qa.boolean().optional()}).transform(t=>(0,B7t.remap)(t,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start"}));var $7t;(function(t){t.inboundSchema=rn.JobIn$inboundSchema,t.outboundSchema=rn.JobIn$outboundSchema})($7t||(rn.JobIn$=$7t={}));function HAn(t){return JSON.stringify(rn.JobIn$outboundSchema.parse(t))}function VAn(t){return(0,D3e.safeParse)(t,e=>rn.JobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobIn' from JSON")}});var F3e=x(wt=>{"use strict";var WAn=wt&&wt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KAn=wt&&wt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GAn=wt&&wt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WAn(e,t,r);return KAn(e,t),e};Object.defineProperty(wt,"__esModule",{value:!0});wt.JobOut$=wt.JobOut$outboundSchema=wt.JobOut$inboundSchema=wt.Repositories$=wt.Repositories$outboundSchema=wt.Repositories$inboundSchema=wt.Integrations$=wt.Integrations$outboundSchema=wt.Integrations$inboundSchema=wt.ObjectT$=wt.ObjectT$outboundSchema=wt.ObjectT$inboundSchema=wt.Status$=wt.Status$outboundSchema=wt.Status$inboundSchema=wt.ObjectT=wt.Status=void 0;wt.integrationsToJSON=JAn;wt.integrationsFromJSON=ZAn;wt.repositoriesToJSON=YAn;wt.repositoriesFromJSON=XAn;wt.jobOutToJSON=QAn;wt.jobOutFromJSON=eIn;var Dr=GAn(Ae()),J7t=He(),L3e=Oe(),bhe=lhe(),Z7t=che(),Y7t=dhe(),_he=fhe();wt.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};wt.ObjectT={Job:"job"};wt.Status$inboundSchema=Dr.nativeEnum(wt.Status);wt.Status$outboundSchema=wt.Status$inboundSchema;var H7t;(function(t){t.inboundSchema=wt.Status$inboundSchema,t.outboundSchema=wt.Status$outboundSchema})(H7t||(wt.Status$=H7t={}));wt.ObjectT$inboundSchema=Dr.nativeEnum(wt.ObjectT);wt.ObjectT$outboundSchema=wt.ObjectT$inboundSchema;var V7t;(function(t){t.inboundSchema=wt.ObjectT$inboundSchema,t.outboundSchema=wt.ObjectT$outboundSchema})(V7t||(wt.ObjectT$=V7t={}));wt.Integrations$inboundSchema=_he.WandbIntegrationOut$inboundSchema;wt.Integrations$outboundSchema=_he.WandbIntegrationOut$outboundSchema;var W7t;(function(t){t.inboundSchema=wt.Integrations$inboundSchema,t.outboundSchema=wt.Integrations$outboundSchema})(W7t||(wt.Integrations$=W7t={}));function JAn(t){return JSON.stringify(wt.Integrations$outboundSchema.parse(t))}function ZAn(t){return(0,L3e.safeParse)(t,e=>wt.Integrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Integrations' from JSON")}wt.Repositories$inboundSchema=bhe.GithubRepositoryOut$inboundSchema;wt.Repositories$outboundSchema=bhe.GithubRepositoryOut$outboundSchema;var K7t;(function(t){t.inboundSchema=wt.Repositories$inboundSchema,t.outboundSchema=wt.Repositories$outboundSchema})(K7t||(wt.Repositories$=K7t={}));function YAn(t){return JSON.stringify(wt.Repositories$outboundSchema.parse(t))}function XAn(t){return(0,L3e.safeParse)(t,e=>wt.Repositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Repositories' from JSON")}wt.JobOut$inboundSchema=Dr.object({id:Dr.string(),auto_start:Dr.boolean(),hyperparameters:Y7t.TrainingParameters$inboundSchema,model:Dr.string(),status:wt.Status$inboundSchema,job_type:Dr.string(),created_at:Dr.number().int(),modified_at:Dr.number().int(),training_files:Dr.array(Dr.string()),validation_files:Dr.nullable(Dr.array(Dr.string())).optional(),object:Dr.literal("job").default("job"),fine_tuned_model:Dr.nullable(Dr.string()).optional(),suffix:Dr.nullable(Dr.string()).optional(),integrations:Dr.nullable(Dr.array(_he.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Dr.nullable(Dr.number().int()).optional(),repositories:Dr.array(bhe.GithubRepositoryOut$inboundSchema).optional(),metadata:Dr.nullable(Z7t.JobMetadataOut$inboundSchema).optional()}).transform(t=>(0,J7t.remap)(t,{auto_start:"autoStart",job_type:"jobType",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens"}));wt.JobOut$outboundSchema=Dr.object({id:Dr.string(),autoStart:Dr.boolean(),hyperparameters:Y7t.TrainingParameters$outboundSchema,model:Dr.string(),status:wt.Status$outboundSchema,jobType:Dr.string(),createdAt:Dr.number().int(),modifiedAt:Dr.number().int(),trainingFiles:Dr.array(Dr.string()),validationFiles:Dr.nullable(Dr.array(Dr.string())).optional(),object:Dr.literal("job").default("job"),fineTunedModel:Dr.nullable(Dr.string()).optional(),suffix:Dr.nullable(Dr.string()).optional(),integrations:Dr.nullable(Dr.array(_he.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Dr.nullable(Dr.number().int()).optional(),repositories:Dr.array(bhe.GithubRepositoryOut$outboundSchema).optional(),metadata:Dr.nullable(Z7t.JobMetadataOut$outboundSchema).optional()}).transform(t=>(0,J7t.remap)(t,{autoStart:"auto_start",jobType:"job_type",createdAt:"created_at",modifiedAt:"modified_at",trainingFiles:"training_files",validationFiles:"validation_files",fineTunedModel:"fine_tuned_model",trainedTokens:"trained_tokens"}));var G7t;(function(t){t.inboundSchema=wt.JobOut$inboundSchema,t.outboundSchema=wt.JobOut$outboundSchema})(G7t||(wt.JobOut$=G7t={}));function QAn(t){return JSON.stringify(wt.JobOut$outboundSchema.parse(t))}function eIn(t){return(0,L3e.safeParse)(t,e=>wt.JobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobOut' from JSON")}});var tZt=x(ui=>{"use strict";var tIn=ui&&ui.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rIn=ui&&ui.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nIn=ui&&ui.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tIn(e,t,r);return rIn(e,t),e};Object.defineProperty(ui,"__esModule",{value:!0});ui.JobsOut$=ui.JobsOut$outboundSchema=ui.JobsOut$inboundSchema=ui.JobsOutObject$=ui.JobsOutObject$outboundSchema=ui.JobsOutObject$inboundSchema=ui.JobsOutObject=void 0;ui.jobsOutToJSON=iIn;ui.jobsOutFromJSON=aIn;var wT=nIn(Ae()),oIn=Oe(),eZt=F3e();ui.JobsOutObject={List:"list"};ui.JobsOutObject$inboundSchema=wT.nativeEnum(ui.JobsOutObject);ui.JobsOutObject$outboundSchema=ui.JobsOutObject$inboundSchema;var X7t;(function(t){t.inboundSchema=ui.JobsOutObject$inboundSchema,t.outboundSchema=ui.JobsOutObject$outboundSchema})(X7t||(ui.JobsOutObject$=X7t={}));ui.JobsOut$inboundSchema=wT.object({data:wT.array(eZt.JobOut$inboundSchema).optional(),object:wT.literal("list").default("list"),total:wT.number().int()});ui.JobsOut$outboundSchema=wT.object({data:wT.array(eZt.JobOut$outboundSchema).optional(),object:wT.literal("list").default("list"),total:wT.number().int()});var Q7t;(function(t){t.inboundSchema=ui.JobsOut$inboundSchema,t.outboundSchema=ui.JobsOut$outboundSchema})(Q7t||(ui.JobsOut$=Q7t={}));function iIn(t){return JSON.stringify(ui.JobsOut$outboundSchema.parse(t))}function aIn(t){return(0,oIn.safeParse)(t,e=>ui.JobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOut' from JSON")}});var iZt=x(li=>{"use strict";var sIn=li&&li.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uIn=li&&li.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lIn=li&&li.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sIn(e,t,r);return uIn(e,t),e};Object.defineProperty(li,"__esModule",{value:!0});li.LegacyJobMetadataOut$=li.LegacyJobMetadataOut$outboundSchema=li.LegacyJobMetadataOut$inboundSchema=li.LegacyJobMetadataOutObject$=li.LegacyJobMetadataOutObject$outboundSchema=li.LegacyJobMetadataOutObject$inboundSchema=li.LegacyJobMetadataOutObject=void 0;li.legacyJobMetadataOutToJSON=dIn;li.legacyJobMetadataOutFromJSON=fIn;var Xr=lIn(Ae()),oZt=He(),cIn=Oe();li.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};li.LegacyJobMetadataOutObject$inboundSchema=Xr.nativeEnum(li.LegacyJobMetadataOutObject);li.LegacyJobMetadataOutObject$outboundSchema=li.LegacyJobMetadataOutObject$inboundSchema;var rZt;(function(t){t.inboundSchema=li.LegacyJobMetadataOutObject$inboundSchema,t.outboundSchema=li.LegacyJobMetadataOutObject$outboundSchema})(rZt||(li.LegacyJobMetadataOutObject$=rZt={}));li.LegacyJobMetadataOut$inboundSchema=Xr.object({expected_duration_seconds:Xr.nullable(Xr.number().int()).optional(),cost:Xr.nullable(Xr.number()).optional(),cost_currency:Xr.nullable(Xr.string()).optional(),train_tokens_per_step:Xr.nullable(Xr.number().int()).optional(),train_tokens:Xr.nullable(Xr.number().int()).optional(),data_tokens:Xr.nullable(Xr.number().int()).optional(),estimated_start_time:Xr.nullable(Xr.number().int()).optional(),deprecated:Xr.boolean().default(!0),details:Xr.string(),epochs:Xr.nullable(Xr.number()).optional(),training_steps:Xr.nullable(Xr.number().int()).optional(),object:Xr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,oZt.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime",training_steps:"trainingSteps"}));li.LegacyJobMetadataOut$outboundSchema=Xr.object({expectedDurationSeconds:Xr.nullable(Xr.number().int()).optional(),cost:Xr.nullable(Xr.number()).optional(),costCurrency:Xr.nullable(Xr.string()).optional(),trainTokensPerStep:Xr.nullable(Xr.number().int()).optional(),trainTokens:Xr.nullable(Xr.number().int()).optional(),dataTokens:Xr.nullable(Xr.number().int()).optional(),estimatedStartTime:Xr.nullable(Xr.number().int()).optional(),deprecated:Xr.boolean().default(!0),details:Xr.string(),epochs:Xr.nullable(Xr.number()).optional(),trainingSteps:Xr.nullable(Xr.number().int()).optional(),object:Xr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,oZt.remap)(t,{expectedDurationSeconds:"expected_duration_seconds",costCurrency:"cost_currency",trainTokensPerStep:"train_tokens_per_step",trainTokens:"train_tokens",dataTokens:"data_tokens",estimatedStartTime:"estimated_start_time",trainingSteps:"training_steps"}));var nZt;(function(t){t.inboundSchema=li.LegacyJobMetadataOut$inboundSchema,t.outboundSchema=li.LegacyJobMetadataOut$outboundSchema})(nZt||(li.LegacyJobMetadataOut$=nZt={}));function dIn(t){return JSON.stringify(li.LegacyJobMetadataOut$outboundSchema.parse(t))}function fIn(t){return(0,cIn.safeParse)(t,e=>li.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var uZt=x(Cl=>{"use strict";var pIn=Cl&&Cl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mIn=Cl&&Cl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hIn=Cl&&Cl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pIn(e,t,r);return mIn(e,t),e};Object.defineProperty(Cl,"__esModule",{value:!0});Cl.ListFilesOut$=Cl.ListFilesOut$outboundSchema=Cl.ListFilesOut$inboundSchema=void 0;Cl.listFilesOutToJSON=yIn;Cl.listFilesOutFromJSON=bIn;var y1=hIn(Ae()),gIn=Oe(),sZt=T3e();Cl.ListFilesOut$inboundSchema=y1.object({data:y1.array(sZt.FileSchema$inboundSchema),object:y1.string(),total:y1.number().int()});Cl.ListFilesOut$outboundSchema=y1.object({data:y1.array(sZt.FileSchema$outboundSchema),object:y1.string(),total:y1.number().int()});var aZt;(function(t){t.inboundSchema=Cl.ListFilesOut$inboundSchema,t.outboundSchema=Cl.ListFilesOut$outboundSchema})(aZt||(Cl.ListFilesOut$=aZt={}));function yIn(t){return JSON.stringify(Cl.ListFilesOut$outboundSchema.parse(t))}function bIn(t){return(0,gIn.safeParse)(t,e=>Cl.ListFilesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListFilesOut' from JSON")}});var fZt=x(ci=>{"use strict";var _In=ci&&ci.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vIn=ci&&ci.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wIn=ci&&ci.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_In(e,t,r);return vIn(e,t),e};Object.defineProperty(ci,"__esModule",{value:!0});ci.ModelList$=ci.ModelList$outboundSchema=ci.ModelList$inboundSchema=ci.Data$=ci.Data$outboundSchema=ci.Data$inboundSchema=void 0;ci.dataToJSON=xIn;ci.dataFromJSON=SIn;ci.modelListToJSON=CIn;ci.modelListFromJSON=OIn;var ha=wIn(Ae()),dZt=Oe(),vhe=h3e(),whe=I3e();ci.Data$inboundSchema=ha.union([vhe.BaseModelCard$inboundSchema.and(ha.object({type:ha.literal("base")}).transform(t=>({type:t.type}))),whe.FTModelCard$inboundSchema.and(ha.object({type:ha.literal("fine-tuned")}).transform(t=>({type:t.type})))]);ci.Data$outboundSchema=ha.union([vhe.BaseModelCard$outboundSchema.and(ha.object({type:ha.literal("base")}).transform(t=>({type:t.type}))),whe.FTModelCard$outboundSchema.and(ha.object({type:ha.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var lZt;(function(t){t.inboundSchema=ci.Data$inboundSchema,t.outboundSchema=ci.Data$outboundSchema})(lZt||(ci.Data$=lZt={}));function xIn(t){return JSON.stringify(ci.Data$outboundSchema.parse(t))}function SIn(t){return(0,dZt.safeParse)(t,e=>ci.Data$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Data' from JSON")}ci.ModelList$inboundSchema=ha.object({object:ha.string().default("list"),data:ha.array(ha.union([vhe.BaseModelCard$inboundSchema.and(ha.object({type:ha.literal("base")}).transform(t=>({type:t.type}))),whe.FTModelCard$inboundSchema.and(ha.object({type:ha.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});ci.ModelList$outboundSchema=ha.object({object:ha.string().default("list"),data:ha.array(ha.union([vhe.BaseModelCard$outboundSchema.and(ha.object({type:ha.literal("base")}).transform(t=>({type:t.type}))),whe.FTModelCard$outboundSchema.and(ha.object({type:ha.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});var cZt;(function(t){t.inboundSchema=ci.ModelList$inboundSchema,t.outboundSchema=ci.ModelList$outboundSchema})(cZt||(ci.ModelList$=cZt={}));function CIn(t){return JSON.stringify(ci.ModelList$outboundSchema.parse(t))}function OIn(t){return(0,dZt.safeParse)(t,e=>ci.ModelList$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelList' from JSON")}});var bZt=x(Ol=>{"use strict";var EIn=Ol&&Ol.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PIn=Ol&&Ol.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TIn=Ol&&Ol.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EIn(e,t,r);return PIn(e,t),e};Object.defineProperty(Ol,"__esModule",{value:!0});Ol.RetrieveFileOut$=Ol.RetrieveFileOut$outboundSchema=Ol.RetrieveFileOut$inboundSchema=void 0;Ol.retrieveFileOutToJSON=IIn;Ol.retrieveFileOutFromJSON=MIn;var od=TIn(Ae()),mZt=He(),AIn=Oe(),hZt=KJ(),gZt=GJ(),yZt=JJ();Ol.RetrieveFileOut$inboundSchema=od.object({id:od.string(),object:od.string(),bytes:od.number().int(),created_at:od.number().int(),filename:od.string(),purpose:hZt.FilePurpose$inboundSchema,sample_type:gZt.SampleType$inboundSchema,num_lines:od.nullable(od.number().int()).optional(),source:yZt.Source$inboundSchema,deleted:od.boolean()}).transform(t=>(0,mZt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Ol.RetrieveFileOut$outboundSchema=od.object({id:od.string(),object:od.string(),sizeBytes:od.number().int(),createdAt:od.number().int(),filename:od.string(),purpose:hZt.FilePurpose$outboundSchema,sampleType:gZt.SampleType$outboundSchema,numLines:od.nullable(od.number().int()).optional(),source:yZt.Source$outboundSchema,deleted:od.boolean()}).transform(t=>(0,mZt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var pZt;(function(t){t.inboundSchema=Ol.RetrieveFileOut$inboundSchema,t.outboundSchema=Ol.RetrieveFileOut$outboundSchema})(pZt||(Ol.RetrieveFileOut$=pZt={}));function IIn(t){return JSON.stringify(Ol.RetrieveFileOut$outboundSchema.parse(t))}function MIn(t){return(0,AIn.safeParse)(t,e=>Ol.RetrieveFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveFileOut' from JSON")}});var wZt=x(El=>{"use strict";var RIn=El&&El.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NIn=El&&El.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jIn=El&&El.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RIn(e,t,r);return NIn(e,t),e};Object.defineProperty(El,"__esModule",{value:!0});El.Security$=El.Security$outboundSchema=El.Security$inboundSchema=void 0;El.securityToJSON=LIn;El.securityFromJSON=FIn;var xhe=jIn(Ae()),vZt=He(),DIn=Oe();El.Security$inboundSchema=xhe.object({ApiKey:xhe.string().optional()}).transform(t=>(0,vZt.remap)(t,{ApiKey:"apiKey"}));El.Security$outboundSchema=xhe.object({apiKey:xhe.string().optional()}).transform(t=>(0,vZt.remap)(t,{apiKey:"ApiKey"}));var _Zt;(function(t){t.inboundSchema=El.Security$inboundSchema,t.outboundSchema=El.Security$outboundSchema})(_Zt||(El.Security$=_Zt={}));function LIn(t){return JSON.stringify(El.Security$outboundSchema.parse(t))}function FIn(t){return(0,DIn.safeParse)(t,e=>El.Security$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Security' from JSON")}});var CZt=x(di=>{"use strict";var kIn=di&&di.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$In=di&&di.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BIn=di&&di.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kIn(e,t,r);return $In(e,t),e};Object.defineProperty(di,"__esModule",{value:!0});di.UnarchiveFTModelOut$=di.UnarchiveFTModelOut$outboundSchema=di.UnarchiveFTModelOut$inboundSchema=di.UnarchiveFTModelOutObject$=di.UnarchiveFTModelOutObject$outboundSchema=di.UnarchiveFTModelOutObject$inboundSchema=di.UnarchiveFTModelOutObject=void 0;di.unarchiveFTModelOutToJSON=UIn;di.unarchiveFTModelOutFromJSON=qIn;var xT=BIn(Ae()),zIn=Oe();di.UnarchiveFTModelOutObject={Model:"model"};di.UnarchiveFTModelOutObject$inboundSchema=xT.nativeEnum(di.UnarchiveFTModelOutObject);di.UnarchiveFTModelOutObject$outboundSchema=di.UnarchiveFTModelOutObject$inboundSchema;var xZt;(function(t){t.inboundSchema=di.UnarchiveFTModelOutObject$inboundSchema,t.outboundSchema=di.UnarchiveFTModelOutObject$outboundSchema})(xZt||(di.UnarchiveFTModelOutObject$=xZt={}));di.UnarchiveFTModelOut$inboundSchema=xT.object({id:xT.string(),object:xT.literal("model").default("model"),archived:xT.boolean().default(!1)});di.UnarchiveFTModelOut$outboundSchema=xT.object({id:xT.string(),object:xT.literal("model").default("model"),archived:xT.boolean().default(!1)});var SZt;(function(t){t.inboundSchema=di.UnarchiveFTModelOut$inboundSchema,t.outboundSchema=di.UnarchiveFTModelOut$outboundSchema})(SZt||(di.UnarchiveFTModelOut$=SZt={}));function UIn(t){return JSON.stringify(di.UnarchiveFTModelOut$outboundSchema.parse(t))}function qIn(t){return(0,zIn.safeParse)(t,e=>di.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var EZt=x(Pl=>{"use strict";var HIn=Pl&&Pl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VIn=Pl&&Pl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WIn=Pl&&Pl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HIn(e,t,r);return VIn(e,t),e};Object.defineProperty(Pl,"__esModule",{value:!0});Pl.UpdateFTModelIn$=Pl.UpdateFTModelIn$outboundSchema=Pl.UpdateFTModelIn$inboundSchema=void 0;Pl.updateFTModelInToJSON=GIn;Pl.updateFTModelInFromJSON=JIn;var LO=WIn(Ae()),KIn=Oe();Pl.UpdateFTModelIn$inboundSchema=LO.object({name:LO.nullable(LO.string()).optional(),description:LO.nullable(LO.string()).optional()});Pl.UpdateFTModelIn$outboundSchema=LO.object({name:LO.nullable(LO.string()).optional(),description:LO.nullable(LO.string()).optional()});var OZt;(function(t){t.inboundSchema=Pl.UpdateFTModelIn$inboundSchema,t.outboundSchema=Pl.UpdateFTModelIn$outboundSchema})(OZt||(Pl.UpdateFTModelIn$=OZt={}));function GIn(t){return JSON.stringify(Pl.UpdateFTModelIn$outboundSchema.parse(t))}function JIn(t){return(0,KIn.safeParse)(t,e=>Pl.UpdateFTModelIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var RZt=x(Tl=>{"use strict";var ZIn=Tl&&Tl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YIn=Tl&&Tl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XIn=Tl&&Tl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZIn(e,t,r);return YIn(e,t),e};Object.defineProperty(Tl,"__esModule",{value:!0});Tl.UploadFileOut$=Tl.UploadFileOut$outboundSchema=Tl.UploadFileOut$inboundSchema=void 0;Tl.uploadFileOutToJSON=eMn;Tl.uploadFileOutFromJSON=tMn;var up=XIn(Ae()),TZt=He(),QIn=Oe(),AZt=KJ(),IZt=GJ(),MZt=JJ();Tl.UploadFileOut$inboundSchema=up.object({id:up.string(),object:up.string(),bytes:up.number().int(),created_at:up.number().int(),filename:up.string(),purpose:AZt.FilePurpose$inboundSchema,sample_type:IZt.SampleType$inboundSchema,num_lines:up.nullable(up.number().int()).optional(),source:MZt.Source$inboundSchema}).transform(t=>(0,TZt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Tl.UploadFileOut$outboundSchema=up.object({id:up.string(),object:up.string(),sizeBytes:up.number().int(),createdAt:up.number().int(),filename:up.string(),purpose:AZt.FilePurpose$outboundSchema,sampleType:IZt.SampleType$outboundSchema,numLines:up.nullable(up.number().int()).optional(),source:MZt.Source$outboundSchema}).transform(t=>(0,TZt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var PZt;(function(t){t.inboundSchema=Tl.UploadFileOut$inboundSchema,t.outboundSchema=Tl.UploadFileOut$outboundSchema})(PZt||(Tl.UploadFileOut$=PZt={}));function eMn(t){return JSON.stringify(Tl.UploadFileOut$outboundSchema.parse(t))}function tMn(t){return(0,QIn.safeParse)(t,e=>Tl.UploadFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UploadFileOut' from JSON")}});var LZt=x(fi=>{"use strict";var rMn=fi&&fi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nMn=fi&&fi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oMn=fi&&fi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rMn(e,t,r);return nMn(e,t),e};Object.defineProperty(fi,"__esModule",{value:!0});fi.ValidationError$=fi.ValidationError$outboundSchema=fi.ValidationError$inboundSchema=fi.Loc$=fi.Loc$outboundSchema=fi.Loc$inboundSchema=void 0;fi.locToJSON=iMn;fi.locFromJSON=aMn;fi.validationErrorToJSON=sMn;fi.validationErrorFromJSON=uMn;var Al=oMn(Ae()),DZt=Oe();fi.Loc$inboundSchema=Al.union([Al.string(),Al.number().int()]);fi.Loc$outboundSchema=Al.union([Al.string(),Al.number().int()]);var NZt;(function(t){t.inboundSchema=fi.Loc$inboundSchema,t.outboundSchema=fi.Loc$outboundSchema})(NZt||(fi.Loc$=NZt={}));function iMn(t){return JSON.stringify(fi.Loc$outboundSchema.parse(t))}function aMn(t){return(0,DZt.safeParse)(t,e=>fi.Loc$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Loc' from JSON")}fi.ValidationError$inboundSchema=Al.object({loc:Al.array(Al.union([Al.string(),Al.number().int()])),msg:Al.string(),type:Al.string()});fi.ValidationError$outboundSchema=Al.object({loc:Al.array(Al.union([Al.string(),Al.number().int()])),msg:Al.string(),type:Al.string()});var jZt;(function(t){t.inboundSchema=fi.ValidationError$inboundSchema,t.outboundSchema=fi.ValidationError$outboundSchema})(jZt||(fi.ValidationError$=jZt={}));function sMn(t){return JSON.stringify(fi.ValidationError$outboundSchema.parse(t))}function uMn(t){return(0,DZt.safeParse)(t,e=>fi.ValidationError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ValidationError' from JSON")}});var io=x(We=>{"use strict";var lMn=We&&We.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qe=We&&We.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&lMn(e,t,r)};Object.defineProperty(We,"__esModule",{value:!0});Qe(_Kt(),We);Qe(TKt(),We);Qe(m3e(),We);Qe(RKt(),We);Qe(f1(),We);Qe(h3e(),We);Qe(g3e(),We);Qe(qKt(),We);Qe(b3e(),We);Qe(QKt(),We);Qe(y3e(),We);Qe(iGt(),We);Qe(Kme(),We);Qe(bGt(),We);Qe(CGt(),We);Qe(NGt(),We);Qe(v3e(),We);Qe(w3e(),We);Qe(VGt(),We);Qe(GGt(),We);Qe(C3e(),We);Qe(lJt(),We);Qe(S3e(),We);Qe(Z3(),We);Qe(dJt(),We);Qe(pJt(),We);Qe(x3e(),We);Qe(LJt(),We);Qe(zJt(),We);Qe(WJt(),We);Qe(P3e(),We);Qe(O3e(),We);Qe(KJ(),We);Qe(T3e(),We);Qe(r7t(),We);Qe(s7t(),We);Qe(d7t(),We);Qe(g7t(),We);Qe(A3e(),We);Qe(I3e(),We);Qe(P7t(),We);Qe(f3e(),We);Qe(u3e(),We);Qe(p3e(),We);Qe(M3e(),We);Qe(lhe(),We);Qe(i3e(),We);Qe(a3e(),We);Qe(q7t(),We);Qe(che(),We);Qe(F3e(),We);Qe(tZt(),We);Qe(c3e(),We);Qe(iZt(),We);Qe(uZt(),We);Qe(_3e(),We);Qe(Vme(),We);Qe(fZt(),We);Qe(X3(),We);Qe(s3e(),We);Qe(Q3(),We);Qe(d3e(),We);Qe(bZt(),We);Qe(GJ(),We);Qe(wZt(),We);Qe(JJ(),We);Qe(Lk(),We);Qe(Sme(),We);Qe(eH(),We);Qe(Cme(),We);Qe(tH(),We);Qe(rH(),We);Qe(Fk(),We);Qe(VJ(),We);Qe(R3e(),We);Qe(dhe(),We);Qe(N3e(),We);Qe(CZt(),We);Qe(EZt(),We);Qe(RZt(),We);Qe(oH(),We);Qe(kk(),We);Qe(LZt(),We);Qe(j3e(),We);Qe(fhe(),We)});var BZt=x(id=>{"use strict";var cMn=id&&id.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dMn=id&&id.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kZt=id&&id.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cMn(e,t,r);return dMn(e,t),e};Object.defineProperty(id,"__esModule",{value:!0});id.HTTPValidationError$=id.HTTPValidationError$outboundSchema=id.HTTPValidationError$inboundSchema=id.HTTPValidationError=void 0;var ZJ=kZt(Ae()),$Zt=kZt(io()),YJ=class extends Error{constructor(e){let r="message"in e&&typeof e.message=="string"?e.message:`API error occurred: ${JSON.stringify(e)}`;super(r),this.data$=e,e.detail!=null&&(this.detail=e.detail),this.name="HTTPValidationError"}};id.HTTPValidationError=YJ;id.HTTPValidationError$inboundSchema=ZJ.object({detail:ZJ.array($Zt.ValidationError$inboundSchema).optional()}).transform(t=>new YJ(t));id.HTTPValidationError$outboundSchema=ZJ.instanceof(YJ).transform(t=>t.data$).pipe(ZJ.object({detail:ZJ.array($Zt.ValidationError$outboundSchema).optional()}));var FZt;(function(t){t.inboundSchema=id.HTTPValidationError$inboundSchema,t.outboundSchema=id.HTTPValidationError$outboundSchema})(FZt||(id.HTTPValidationError$=FZt={}))});var xg=x(FO=>{"use strict";var fMn=FO&&FO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),She=FO&&FO.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&fMn(e,t,r)};Object.defineProperty(FO,"__esModule",{value:!0});She(I4e(),FO);She(BZt(),FO);She(X4e(),FO);She(n3e(),FO)});var qZt=x(ST=>{"use strict";var pMn=ST&&ST.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mMn=ST&&ST.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k3e=ST&&ST.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pMn(e,t,r);return mMn(e,t),e};Object.defineProperty(ST,"__esModule",{value:!0});ST.agentsComplete=vMn;var hMn=xi(),XJ=k3e(Si()),gMn=He(),yMn=Oe(),zZt=Ci(),bMn=Ho(),UZt=k3e(io()),_Mn=k3e(xg());async function vMn(t,e,r){let n=(0,yMn.safeParse)(e,_=>UZt.AgentsCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,hMn.encodeJSON)("body",o,{explode:!0}),a=(0,bMn.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,gMn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,zZt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,zZt.resolveGlobalSecurity)(l),d={operationID:"agents_completion_v1_agents_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await XJ.match(XJ.json(200,UZt.ChatCompletionResponse$inboundSchema),XJ.jsonErr(422,_Mn.HTTPValidationError$inboundSchema),XJ.fail("4XX"),XJ.fail("5XX"))(h,{extraFields:y});return g.ok,g}});var WZt=x(CT=>{"use strict";var wMn=CT&&CT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xMn=CT&&CT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Che=CT&&CT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wMn(e,t,r);return xMn(e,t),e};Object.defineProperty(CT,"__esModule",{value:!0});CT.agentsStream=IMn;var SMn=Che(Ae()),CMn=xi(),OMn=UJ(),QJ=Che(Si()),EMn=He(),PMn=Oe(),HZt=Ci(),TMn=Ho(),VZt=Che(io()),AMn=Che(xg());async function IMn(t,e,r){let n=(0,PMn.safeParse)(e,_=>VZt.AgentsCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,CMn.encodeJSON)("body",o,{explode:!0}),a=(0,TMn.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,EMn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,HZt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,HZt.resolveGlobalSecurity)(l),d={operationID:"stream_agents",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await QJ.match(QJ.sse(200,SMn.instanceof(ReadableStream).transform(_=>new OMn.EventStream({stream:_,decoder(w){return VZt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),QJ.jsonErr(422,AMn.HTTPValidationError$inboundSchema),QJ.fail("4XX"),QJ.fail("5XX"))(h,{extraFields:y});return g.ok,g}});var GZt=x(Ohe=>{"use strict";Object.defineProperty(Ohe,"__esModule",{value:!0});Ohe.Agents=void 0;var MMn=qZt(),RMn=WZt(),NMn=vg(),KZt=qy(),$3e=class extends NMn.ClientSDK{async complete(e,r){return(0,KZt.unwrapAsync)((0,MMn.agentsComplete)(this,e,r))}async stream(e,r){return(0,KZt.unwrapAsync)((0,RMn.agentsStream)(this,e,r))}};Ohe.Agents=$3e});var YZt=x(Il=>{"use strict";var jMn=Il&&Il.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DMn=Il&&Il.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LMn=Il&&Il.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jMn(e,t,r);return DMn(e,t),e};Object.defineProperty(Il,"__esModule",{value:!0});Il.DeleteModelV1ModelsModelIdDeleteRequest$=Il.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=Il.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;Il.deleteModelV1ModelsModelIdDeleteRequestToJSON=kMn;Il.deleteModelV1ModelsModelIdDeleteRequestFromJSON=$Mn;var Ehe=LMn(Ae()),ZZt=He(),FMn=Oe();Il.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=Ehe.object({model_id:Ehe.string()}).transform(t=>(0,ZZt.remap)(t,{model_id:"modelId"}));Il.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=Ehe.object({modelId:Ehe.string()}).transform(t=>(0,ZZt.remap)(t,{modelId:"model_id"}));var JZt;(function(t){t.inboundSchema=Il.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,t.outboundSchema=Il.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(JZt||(Il.DeleteModelV1ModelsModelIdDeleteRequest$=JZt={}));function kMn(t){return JSON.stringify(Il.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(t))}function $Mn(t){return(0,FMn.safeParse)(t,e=>Il.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var eYt=x(Ml=>{"use strict";var BMn=Ml&&Ml.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zMn=Ml&&Ml.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UMn=Ml&&Ml.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BMn(e,t,r);return zMn(e,t),e};Object.defineProperty(Ml,"__esModule",{value:!0});Ml.FilesApiRoutesDeleteFileRequest$=Ml.FilesApiRoutesDeleteFileRequest$outboundSchema=Ml.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;Ml.filesApiRoutesDeleteFileRequestToJSON=HMn;Ml.filesApiRoutesDeleteFileRequestFromJSON=VMn;var Phe=UMn(Ae()),QZt=He(),qMn=Oe();Ml.FilesApiRoutesDeleteFileRequest$inboundSchema=Phe.object({file_id:Phe.string()}).transform(t=>(0,QZt.remap)(t,{file_id:"fileId"}));Ml.FilesApiRoutesDeleteFileRequest$outboundSchema=Phe.object({fileId:Phe.string()}).transform(t=>(0,QZt.remap)(t,{fileId:"file_id"}));var XZt;(function(t){t.inboundSchema=Ml.FilesApiRoutesDeleteFileRequest$inboundSchema,t.outboundSchema=Ml.FilesApiRoutesDeleteFileRequest$outboundSchema})(XZt||(Ml.FilesApiRoutesDeleteFileRequest$=XZt={}));function HMn(t){return JSON.stringify(Ml.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(t))}function VMn(t){return(0,qMn.safeParse)(t,e=>Ml.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var nYt=x(Rl=>{"use strict";var WMn=Rl&&Rl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KMn=Rl&&Rl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GMn=Rl&&Rl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WMn(e,t,r);return KMn(e,t),e};Object.defineProperty(Rl,"__esModule",{value:!0});Rl.FilesApiRoutesDownloadFileRequest$=Rl.FilesApiRoutesDownloadFileRequest$outboundSchema=Rl.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;Rl.filesApiRoutesDownloadFileRequestToJSON=ZMn;Rl.filesApiRoutesDownloadFileRequestFromJSON=YMn;var The=GMn(Ae()),rYt=He(),JMn=Oe();Rl.FilesApiRoutesDownloadFileRequest$inboundSchema=The.object({file_id:The.string()}).transform(t=>(0,rYt.remap)(t,{file_id:"fileId"}));Rl.FilesApiRoutesDownloadFileRequest$outboundSchema=The.object({fileId:The.string()}).transform(t=>(0,rYt.remap)(t,{fileId:"file_id"}));var tYt;(function(t){t.inboundSchema=Rl.FilesApiRoutesDownloadFileRequest$inboundSchema,t.outboundSchema=Rl.FilesApiRoutesDownloadFileRequest$outboundSchema})(tYt||(Rl.FilesApiRoutesDownloadFileRequest$=tYt={}));function ZMn(t){return JSON.stringify(Rl.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(t))}function YMn(t){return(0,JMn.safeParse)(t,e=>Rl.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var aYt=x(Nl=>{"use strict";var XMn=Nl&&Nl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QMn=Nl&&Nl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eRn=Nl&&Nl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XMn(e,t,r);return QMn(e,t),e};Object.defineProperty(Nl,"__esModule",{value:!0});Nl.FilesApiRoutesGetSignedUrlRequest$=Nl.FilesApiRoutesGetSignedUrlRequest$outboundSchema=Nl.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;Nl.filesApiRoutesGetSignedUrlRequestToJSON=rRn;Nl.filesApiRoutesGetSignedUrlRequestFromJSON=nRn;var sH=eRn(Ae()),iYt=He(),tRn=Oe();Nl.FilesApiRoutesGetSignedUrlRequest$inboundSchema=sH.object({file_id:sH.string(),expiry:sH.number().int().default(24)}).transform(t=>(0,iYt.remap)(t,{file_id:"fileId"}));Nl.FilesApiRoutesGetSignedUrlRequest$outboundSchema=sH.object({fileId:sH.string(),expiry:sH.number().int().default(24)}).transform(t=>(0,iYt.remap)(t,{fileId:"file_id"}));var oYt;(function(t){t.inboundSchema=Nl.FilesApiRoutesGetSignedUrlRequest$inboundSchema,t.outboundSchema=Nl.FilesApiRoutesGetSignedUrlRequest$outboundSchema})(oYt||(Nl.FilesApiRoutesGetSignedUrlRequest$=oYt={}));function rRn(t){return JSON.stringify(Nl.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(t))}function nRn(t){return(0,tRn.safeParse)(t,e=>Nl.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var cYt=x(Dl=>{"use strict";var oRn=Dl&&Dl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iRn=Dl&&Dl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uYt=Dl&&Dl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oRn(e,t,r);return iRn(e,t),e};Object.defineProperty(Dl,"__esModule",{value:!0});Dl.FilesApiRoutesListFilesRequest$=Dl.FilesApiRoutesListFilesRequest$outboundSchema=Dl.FilesApiRoutesListFilesRequest$inboundSchema=void 0;Dl.filesApiRoutesListFilesRequestToJSON=sRn;Dl.filesApiRoutesListFilesRequestFromJSON=uRn;var jl=uYt(Ae()),lYt=He(),aRn=Oe(),uH=uYt(io());Dl.FilesApiRoutesListFilesRequest$inboundSchema=jl.object({page:jl.number().int().default(0),page_size:jl.number().int().default(100),sample_type:jl.nullable(jl.array(uH.SampleType$inboundSchema)).optional(),source:jl.nullable(jl.array(uH.Source$inboundSchema)).optional(),search:jl.nullable(jl.string()).optional(),purpose:jl.nullable(uH.FilePurpose$inboundSchema).optional()}).transform(t=>(0,lYt.remap)(t,{page_size:"pageSize",sample_type:"sampleType"}));Dl.FilesApiRoutesListFilesRequest$outboundSchema=jl.object({page:jl.number().int().default(0),pageSize:jl.number().int().default(100),sampleType:jl.nullable(jl.array(uH.SampleType$outboundSchema)).optional(),source:jl.nullable(jl.array(uH.Source$outboundSchema)).optional(),search:jl.nullable(jl.string()).optional(),purpose:jl.nullable(uH.FilePurpose$outboundSchema).optional()}).transform(t=>(0,lYt.remap)(t,{pageSize:"page_size",sampleType:"sample_type"}));var sYt;(function(t){t.inboundSchema=Dl.FilesApiRoutesListFilesRequest$inboundSchema,t.outboundSchema=Dl.FilesApiRoutesListFilesRequest$outboundSchema})(sYt||(Dl.FilesApiRoutesListFilesRequest$=sYt={}));function sRn(t){return JSON.stringify(Dl.FilesApiRoutesListFilesRequest$outboundSchema.parse(t))}function uRn(t){return(0,aRn.safeParse)(t,e=>Dl.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var pYt=x(Ll=>{"use strict";var lRn=Ll&&Ll.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cRn=Ll&&Ll.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dRn=Ll&&Ll.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lRn(e,t,r);return cRn(e,t),e};Object.defineProperty(Ll,"__esModule",{value:!0});Ll.FilesApiRoutesRetrieveFileRequest$=Ll.FilesApiRoutesRetrieveFileRequest$outboundSchema=Ll.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;Ll.filesApiRoutesRetrieveFileRequestToJSON=pRn;Ll.filesApiRoutesRetrieveFileRequestFromJSON=mRn;var Ahe=dRn(Ae()),fYt=He(),fRn=Oe();Ll.FilesApiRoutesRetrieveFileRequest$inboundSchema=Ahe.object({file_id:Ahe.string()}).transform(t=>(0,fYt.remap)(t,{file_id:"fileId"}));Ll.FilesApiRoutesRetrieveFileRequest$outboundSchema=Ahe.object({fileId:Ahe.string()}).transform(t=>(0,fYt.remap)(t,{fileId:"file_id"}));var dYt;(function(t){t.inboundSchema=Ll.FilesApiRoutesRetrieveFileRequest$inboundSchema,t.outboundSchema=Ll.FilesApiRoutesRetrieveFileRequest$outboundSchema})(dYt||(Ll.FilesApiRoutesRetrieveFileRequest$=dYt={}));function pRn(t){return JSON.stringify(Ll.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(t))}function mRn(t){return(0,fRn.safeParse)(t,e=>Ll.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var B3e=x(z_=>{"use strict";var hRn=z_&&z_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gRn=z_&&z_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yRn=z_&&z_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hRn(e,t,r);return gRn(e,t),e};Object.defineProperty(z_,"__esModule",{value:!0});z_.blobLikeSchema=void 0;z_.isBlobLike=mYt;var bRn=yRn(Ae());z_.blobLikeSchema=bRn.custom(mYt,{message:"expected a Blob, File or Blob-like object",fatal:!0});function mYt(t){if(t instanceof Blob)return!0;if(typeof t!="object"||t==null||!(Symbol.toStringTag in t))return!1;let e=t[Symbol.toStringTag];return typeof e!="string"||e!=="Blob"&&e!=="File"?!1:"stream"in t&&typeof t.stream=="function"}});var vYt=x(No=>{"use strict";var _Rn=No&&No.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vRn=No&&No.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yYt=No&&No.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Rn(e,t,r);return vRn(e,t),e};Object.defineProperty(No,"__esModule",{value:!0});No.FilesApiRoutesUploadFileMultiPartBodyParams$=No.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=No.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=No.FileT$=No.FileT$outboundSchema=No.FileT$inboundSchema=void 0;No.fileToJSON=xRn;No.fileFromJSON=SRn;No.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=CRn;No.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=ORn;var ad=yYt(Ae()),bYt=Oe(),wRn=B3e(),_Yt=yYt(io());No.FileT$inboundSchema=ad.object({fileName:ad.string(),content:ad.union([ad.instanceof(ReadableStream),ad.instanceof(Blob),ad.instanceof(ArrayBuffer),ad.instanceof(Uint8Array)])});No.FileT$outboundSchema=ad.object({fileName:ad.string(),content:ad.union([ad.instanceof(ReadableStream),ad.instanceof(Blob),ad.instanceof(ArrayBuffer),ad.instanceof(Uint8Array)])});var hYt;(function(t){t.inboundSchema=No.FileT$inboundSchema,t.outboundSchema=No.FileT$outboundSchema})(hYt||(No.FileT$=hYt={}));function xRn(t){return JSON.stringify(No.FileT$outboundSchema.parse(t))}function SRn(t){return(0,bYt.safeParse)(t,e=>No.FileT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileT' from JSON")}No.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=ad.object({file:ad.lazy(()=>No.FileT$inboundSchema),purpose:_Yt.FilePurpose$inboundSchema.optional()});No.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=ad.object({file:ad.lazy(()=>No.FileT$outboundSchema).or(wRn.blobLikeSchema),purpose:_Yt.FilePurpose$outboundSchema.optional()});var gYt;(function(t){t.inboundSchema=No.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,t.outboundSchema=No.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(gYt||(No.FilesApiRoutesUploadFileMultiPartBodyParams$=gYt={}));function CRn(t){return JSON.stringify(No.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(t))}function ORn(t){return(0,bYt.safeParse)(t,e=>No.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var SYt=x(Fl=>{"use strict";var ERn=Fl&&Fl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PRn=Fl&&Fl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TRn=Fl&&Fl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ERn(e,t,r);return PRn(e,t),e};Object.defineProperty(Fl,"__esModule",{value:!0});Fl.JobsApiRoutesBatchCancelBatchJobRequest$=Fl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=Fl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;Fl.jobsApiRoutesBatchCancelBatchJobRequestToJSON=IRn;Fl.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=MRn;var Ihe=TRn(Ae()),xYt=He(),ARn=Oe();Fl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=Ihe.object({job_id:Ihe.string()}).transform(t=>(0,xYt.remap)(t,{job_id:"jobId"}));Fl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=Ihe.object({jobId:Ihe.string()}).transform(t=>(0,xYt.remap)(t,{jobId:"job_id"}));var wYt;(function(t){t.inboundSchema=Fl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,t.outboundSchema=Fl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(wYt||(Fl.JobsApiRoutesBatchCancelBatchJobRequest$=wYt={}));function IRn(t){return JSON.stringify(Fl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(t))}function MRn(t){return(0,ARn.safeParse)(t,e=>Fl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var EYt=x(kl=>{"use strict";var RRn=kl&&kl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NRn=kl&&kl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jRn=kl&&kl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RRn(e,t,r);return NRn(e,t),e};Object.defineProperty(kl,"__esModule",{value:!0});kl.JobsApiRoutesBatchGetBatchJobRequest$=kl.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=kl.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;kl.jobsApiRoutesBatchGetBatchJobRequestToJSON=LRn;kl.jobsApiRoutesBatchGetBatchJobRequestFromJSON=FRn;var Mhe=jRn(Ae()),OYt=He(),DRn=Oe();kl.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=Mhe.object({job_id:Mhe.string()}).transform(t=>(0,OYt.remap)(t,{job_id:"jobId"}));kl.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=Mhe.object({jobId:Mhe.string()}).transform(t=>(0,OYt.remap)(t,{jobId:"job_id"}));var CYt;(function(t){t.inboundSchema=kl.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,t.outboundSchema=kl.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(CYt||(kl.JobsApiRoutesBatchGetBatchJobRequest$=CYt={}));function LRn(t){return JSON.stringify(kl.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(t))}function FRn(t){return(0,DRn.safeParse)(t,e=>kl.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var MYt=x($l=>{"use strict";var kRn=$l&&$l.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Rn=$l&&$l.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TYt=$l&&$l.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kRn(e,t,r);return $Rn(e,t),e};Object.defineProperty($l,"__esModule",{value:!0});$l.JobsApiRoutesBatchGetBatchJobsRequest$=$l.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=$l.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;$l.jobsApiRoutesBatchGetBatchJobsRequestToJSON=zRn;$l.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=URn;var es=TYt(Ae()),AYt=He(),BRn=Oe(),IYt=TYt(io());$l.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=es.object({page:es.number().int().default(0),page_size:es.number().int().default(100),model:es.nullable(es.string()).optional(),metadata:es.nullable(es.record(es.any())).optional(),created_after:es.nullable(es.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:es.boolean().default(!1),status:es.nullable(IYt.BatchJobStatus$inboundSchema).optional()}).transform(t=>(0,AYt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe"}));$l.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=es.object({page:es.number().int().default(0),pageSize:es.number().int().default(100),model:es.nullable(es.string()).optional(),metadata:es.nullable(es.record(es.any())).optional(),createdAfter:es.nullable(es.date().transform(t=>t.toISOString())).optional(),createdByMe:es.boolean().default(!1),status:es.nullable(IYt.BatchJobStatus$outboundSchema).optional()}).transform(t=>(0,AYt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me"}));var PYt;(function(t){t.inboundSchema=$l.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,t.outboundSchema=$l.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(PYt||($l.JobsApiRoutesBatchGetBatchJobsRequest$=PYt={}));function zRn(t){return JSON.stringify($l.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(t))}function URn(t){return(0,BRn.safeParse)(t,e=>$l.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var jYt=x(Bl=>{"use strict";var qRn=Bl&&Bl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HRn=Bl&&Bl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VRn=Bl&&Bl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qRn(e,t,r);return HRn(e,t),e};Object.defineProperty(Bl,"__esModule",{value:!0});Bl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=Bl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=Bl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;Bl.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=KRn;Bl.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=GRn;var Rhe=VRn(Ae()),NYt=He(),WRn=Oe();Bl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=Rhe.object({model_id:Rhe.string()}).transform(t=>(0,NYt.remap)(t,{model_id:"modelId"}));Bl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=Rhe.object({modelId:Rhe.string()}).transform(t=>(0,NYt.remap)(t,{modelId:"model_id"}));var RYt;(function(t){t.inboundSchema=Bl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=Bl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(RYt||(Bl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=RYt={}));function KRn(t){return JSON.stringify(Bl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(t))}function GRn(t){return(0,WRn.safeParse)(t,e=>Bl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var FYt=x(zl=>{"use strict";var JRn=zl&&zl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZRn=zl&&zl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YRn=zl&&zl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JRn(e,t,r);return ZRn(e,t),e};Object.defineProperty(zl,"__esModule",{value:!0});zl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=zl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=zl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;zl.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=QRn;zl.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=e1n;var Nhe=YRn(Ae()),LYt=He(),XRn=Oe();zl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=Nhe.object({job_id:Nhe.string()}).transform(t=>(0,LYt.remap)(t,{job_id:"jobId"}));zl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=Nhe.object({jobId:Nhe.string()}).transform(t=>(0,LYt.remap)(t,{jobId:"job_id"}));var DYt;(function(t){t.inboundSchema=zl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,t.outboundSchema=zl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(DYt||(zl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=DYt={}));function QRn(t){return JSON.stringify(zl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(t))}function e1n(t){return(0,XRn.safeParse)(t,e=>zl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}});var zYt=x(Ul=>{"use strict";var t1n=Ul&&Ul.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),r1n=Ul&&Ul.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Yt=Ul&&Ul.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&t1n(e,t,r);return r1n(e,t),e};Object.defineProperty(Ul,"__esModule",{value:!0});Ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=Ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=void 0;Ul.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=o1n;Ul.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=i1n;var BYt=$Yt(Ae()),n1n=Oe(),jhe=$Yt(io());Ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=BYt.union([jhe.LegacyJobMetadataOut$inboundSchema,jhe.JobOut$inboundSchema]);Ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=BYt.union([jhe.LegacyJobMetadataOut$outboundSchema,jhe.JobOut$outboundSchema]);var kYt;(function(t){t.inboundSchema=Ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,t.outboundSchema=Ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(kYt||(Ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=kYt={}));function o1n(t){return JSON.stringify(Ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(t))}function i1n(t){return(0,n1n.safeParse)(t,e=>Ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var HYt=x(ql=>{"use strict";var a1n=ql&&ql.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s1n=ql&&ql.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u1n=ql&&ql.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&a1n(e,t,r);return s1n(e,t),e};Object.defineProperty(ql,"__esModule",{value:!0});ql.JobsApiRoutesFineTuningGetFineTuningJobRequest$=ql.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=ql.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;ql.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=c1n;ql.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=d1n;var Dhe=u1n(Ae()),qYt=He(),l1n=Oe();ql.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=Dhe.object({job_id:Dhe.string()}).transform(t=>(0,qYt.remap)(t,{job_id:"jobId"}));ql.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=Dhe.object({jobId:Dhe.string()}).transform(t=>(0,qYt.remap)(t,{jobId:"job_id"}));var UYt;(function(t){t.inboundSchema=ql.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,t.outboundSchema=ql.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(UYt||(ql.JobsApiRoutesFineTuningGetFineTuningJobRequest$=UYt={}));function c1n(t){return JSON.stringify(ql.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(t))}function d1n(t){return(0,l1n.safeParse)(t,e=>ql.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}});var GYt=x(jo=>{"use strict";var f1n=jo&&jo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p1n=jo&&jo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m1n=jo&&jo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&f1n(e,t,r);return p1n(e,t),e};Object.defineProperty(jo,"__esModule",{value:!0});jo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=jo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=jo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=jo.Status$=jo.Status$outboundSchema=jo.Status$inboundSchema=jo.Status=void 0;jo.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=g1n;jo.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=y1n;var Ei=m1n(Ae()),KYt=He(),h1n=Oe();jo.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};jo.Status$inboundSchema=Ei.nativeEnum(jo.Status);jo.Status$outboundSchema=jo.Status$inboundSchema;var VYt;(function(t){t.inboundSchema=jo.Status$inboundSchema,t.outboundSchema=jo.Status$outboundSchema})(VYt||(jo.Status$=VYt={}));jo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Ei.object({page:Ei.number().int().default(0),page_size:Ei.number().int().default(100),model:Ei.nullable(Ei.string()).optional(),created_after:Ei.nullable(Ei.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Ei.boolean().default(!1),status:Ei.nullable(jo.Status$inboundSchema).optional(),wandb_project:Ei.nullable(Ei.string()).optional(),wandb_name:Ei.nullable(Ei.string()).optional(),suffix:Ei.nullable(Ei.string()).optional()}).transform(t=>(0,KYt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));jo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Ei.object({page:Ei.number().int().default(0),pageSize:Ei.number().int().default(100),model:Ei.nullable(Ei.string()).optional(),createdAfter:Ei.nullable(Ei.date().transform(t=>t.toISOString())).optional(),createdByMe:Ei.boolean().default(!1),status:Ei.nullable(jo.Status$outboundSchema).optional(),wandbProject:Ei.nullable(Ei.string()).optional(),wandbName:Ei.nullable(Ei.string()).optional(),suffix:Ei.nullable(Ei.string()).optional()}).transform(t=>(0,KYt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var WYt;(function(t){t.inboundSchema=jo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,t.outboundSchema=jo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})(WYt||(jo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=WYt={}));function g1n(t){return JSON.stringify(jo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(t))}function y1n(t){return(0,h1n.safeParse)(t,e=>jo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var YYt=x(Hl=>{"use strict";var b1n=Hl&&Hl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_1n=Hl&&Hl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v1n=Hl&&Hl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&b1n(e,t,r);return _1n(e,t),e};Object.defineProperty(Hl,"__esModule",{value:!0});Hl.JobsApiRoutesFineTuningStartFineTuningJobRequest$=Hl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=Hl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;Hl.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=x1n;Hl.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=S1n;var Lhe=v1n(Ae()),ZYt=He(),w1n=Oe();Hl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=Lhe.object({job_id:Lhe.string()}).transform(t=>(0,ZYt.remap)(t,{job_id:"jobId"}));Hl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=Lhe.object({jobId:Lhe.string()}).transform(t=>(0,ZYt.remap)(t,{jobId:"job_id"}));var JYt;(function(t){t.inboundSchema=Hl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,t.outboundSchema=Hl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})(JYt||(Hl.JobsApiRoutesFineTuningStartFineTuningJobRequest$=JYt={}));function x1n(t){return JSON.stringify(Hl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(t))}function S1n(t){return(0,w1n.safeParse)(t,e=>Hl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}});var eXt=x(Vl=>{"use strict";var C1n=Vl&&Vl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O1n=Vl&&Vl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E1n=Vl&&Vl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&C1n(e,t,r);return O1n(e,t),e};Object.defineProperty(Vl,"__esModule",{value:!0});Vl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=Vl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=Vl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;Vl.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=T1n;Vl.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=A1n;var Fhe=E1n(Ae()),QYt=He(),P1n=Oe();Vl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=Fhe.object({model_id:Fhe.string()}).transform(t=>(0,QYt.remap)(t,{model_id:"modelId"}));Vl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=Fhe.object({modelId:Fhe.string()}).transform(t=>(0,QYt.remap)(t,{modelId:"model_id"}));var XYt;(function(t){t.inboundSchema=Vl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=Vl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(XYt||(Vl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=XYt={}));function T1n(t){return JSON.stringify(Vl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(t))}function A1n(t){return(0,P1n.safeParse)(t,e=>Vl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var iXt=x(Wl=>{"use strict";var I1n=Wl&&Wl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M1n=Wl&&Wl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rXt=Wl&&Wl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&I1n(e,t,r);return M1n(e,t),e};Object.defineProperty(Wl,"__esModule",{value:!0});Wl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=Wl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Wl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;Wl.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=N1n;Wl.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=j1n;var khe=rXt(Ae()),nXt=He(),R1n=Oe(),oXt=rXt(io());Wl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=khe.object({model_id:khe.string(),UpdateFTModelIn:oXt.UpdateFTModelIn$inboundSchema}).transform(t=>(0,nXt.remap)(t,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));Wl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=khe.object({modelId:khe.string(),updateFTModelIn:oXt.UpdateFTModelIn$outboundSchema}).transform(t=>(0,nXt.remap)(t,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var tXt;(function(t){t.inboundSchema=Wl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,t.outboundSchema=Wl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})(tXt||(Wl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=tXt={}));function N1n(t){return JSON.stringify(Wl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(t))}function j1n(t){return(0,R1n.safeParse)(t,e=>Wl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}});var dXt=x(pi=>{"use strict";var D1n=pi&&pi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L1n=pi&&pi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uXt=pi&&pi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&D1n(e,t,r);return L1n(e,t),e};Object.defineProperty(pi,"__esModule",{value:!0});pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=pi.RetrieveModelV1ModelsModelIdGetRequest$=pi.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=pi.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=void 0;pi.retrieveModelV1ModelsModelIdGetRequestToJSON=F1n;pi.retrieveModelV1ModelsModelIdGetRequestFromJSON=k1n;pi.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=$1n;pi.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=B1n;var gh=uXt(Ae()),lXt=He(),cXt=Oe(),$he=uXt(io());pi.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=gh.object({model_id:gh.string()}).transform(t=>(0,lXt.remap)(t,{model_id:"modelId"}));pi.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=gh.object({modelId:gh.string()}).transform(t=>(0,lXt.remap)(t,{modelId:"model_id"}));var aXt;(function(t){t.inboundSchema=pi.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,t.outboundSchema=pi.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(aXt||(pi.RetrieveModelV1ModelsModelIdGetRequest$=aXt={}));function F1n(t){return JSON.stringify(pi.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(t))}function k1n(t){return(0,cXt.safeParse)(t,e=>pi.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=gh.union([$he.BaseModelCard$inboundSchema.and(gh.object({type:gh.literal("base")}).transform(t=>({type:t.type}))),$he.FTModelCard$inboundSchema.and(gh.object({type:gh.literal("fine-tuned")}).transform(t=>({type:t.type})))]);pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=gh.union([$he.BaseModelCard$outboundSchema.and(gh.object({type:gh.literal("base")}).transform(t=>({type:t.type}))),$he.FTModelCard$outboundSchema.and(gh.object({type:gh.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var sXt;(function(t){t.inboundSchema=pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,t.outboundSchema=pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(sXt||(pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=sXt={}));function $1n(t){return JSON.stringify(pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(t))}function B1n(t){return(0,cXt.safeParse)(t,e=>pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var Kl=x(ja=>{"use strict";var z1n=ja&&ja.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pc=ja&&ja.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&z1n(e,t,r)};Object.defineProperty(ja,"__esModule",{value:!0});Pc(YZt(),ja);Pc(eYt(),ja);Pc(nYt(),ja);Pc(aYt(),ja);Pc(cYt(),ja);Pc(pYt(),ja);Pc(vYt(),ja);Pc(SYt(),ja);Pc(EYt(),ja);Pc(MYt(),ja);Pc(jYt(),ja);Pc(FYt(),ja);Pc(zYt(),ja);Pc(HYt(),ja);Pc(GYt(),ja);Pc(YYt(),ja);Pc(eXt(),ja);Pc(iXt(),ja);Pc(dXt(),ja)});var pXt=x(OT=>{"use strict";var U1n=OT&&OT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),q1n=OT&&OT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z3e=OT&&OT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&U1n(e,t,r);return q1n(e,t),e};Object.defineProperty(OT,"__esModule",{value:!0});OT.batchJobsCancel=Z1n;var H1n=xi(),Bhe=z3e(Si()),V1n=He(),W1n=Oe(),fXt=Ci(),K1n=Ho(),G1n=z3e(io()),J1n=z3e(Kl());async function Z1n(t,e,r){let n=(0,W1n.safeParse)(e,_=>J1n.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,H1n.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,K1n.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,V1n.compactMap)({Accept:"application/json"})),l=await(0,fXt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,fXt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_cancel_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,[g]=await Bhe.match(Bhe.json(200,G1n.BatchJobOut$inboundSchema),Bhe.fail("4XX"),Bhe.fail("5XX"))(y);return g.ok,g}});var yXt=x(ET=>{"use strict";var Y1n=ET&&ET.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X1n=ET&&ET.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gXt=ET&&ET.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Y1n(e,t,r);return X1n(e,t),e};Object.defineProperty(ET,"__esModule",{value:!0});ET.batchJobsCreate=nNn;var Q1n=xi(),zhe=gXt(Si()),eNn=He(),tNn=Oe(),mXt=Ci(),rNn=Ho(),hXt=gXt(io());async function nNn(t,e,r){let n=(0,tNn.safeParse)(e,g=>hXt.BatchJobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Q1n.encodeJSON)("body",o,{explode:!0}),a=(0,rNn.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,eNn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,mXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,mXt.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_batch_create_batch_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[y]=await zhe.match(zhe.json(200,hXt.BatchJobOut$inboundSchema),zhe.fail("4XX"),zhe.fail("5XX"))(h);return y.ok,y}});var _Xt=x(PT=>{"use strict";var oNn=PT&&PT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iNn=PT&&PT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U3e=PT&&PT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oNn(e,t,r);return iNn(e,t),e};Object.defineProperty(PT,"__esModule",{value:!0});PT.batchJobsGet=fNn;var aNn=xi(),Uhe=U3e(Si()),sNn=He(),uNn=Oe(),bXt=Ci(),lNn=Ho(),cNn=U3e(io()),dNn=U3e(Kl());async function fNn(t,e,r){let n=(0,uNn.safeParse)(e,_=>dNn.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,aNn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,lNn.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,sNn.compactMap)({Accept:"application/json"})),l=await(0,bXt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,bXt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,[g]=await Uhe.match(Uhe.json(200,cNn.BatchJobOut$inboundSchema),Uhe.fail("4XX"),Uhe.fail("5XX"))(y);return g.ok,g}});var wXt=x(TT=>{"use strict";var pNn=TT&&TT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mNn=TT&&TT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q3e=TT&&TT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pNn(e,t,r);return mNn(e,t),e};Object.defineProperty(TT,"__esModule",{value:!0});TT.batchJobsList=wNn;var hNn=xi(),qhe=q3e(Si()),gNn=He(),yNn=Oe(),vXt=Ci(),bNn=Ho(),_Nn=q3e(io()),vNn=q3e(Kl());async function wNn(t,e,r){let n=(0,yNn.safeParse)(e,_=>vNn.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,bNn.pathToFunc)("/v1/batch/jobs")(),s=(0,hNn.encodeFormQuery)({created_after:o?.created_after,created_by_me:o?.created_by_me,metadata:o?.metadata,model:o?.model,page:o?.page,page_size:o?.page_size,status:o?.status}),u=new Headers((0,gNn.compactMap)({Accept:"application/json"})),l=await(0,vXt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,vXt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,[g]=await qhe.match(qhe.json(200,_Nn.BatchJobsOut$inboundSchema),qhe.fail("4XX"),qhe.fail("5XX"))(y);return g.ok,g}});var xXt=x(Vhe=>{"use strict";Object.defineProperty(Vhe,"__esModule",{value:!0});Vhe.MistralJobs=void 0;var xNn=pXt(),SNn=yXt(),CNn=_Xt(),ONn=wXt(),ENn=vg(),Hhe=qy(),H3e=class extends ENn.ClientSDK{async list(e,r){return(0,Hhe.unwrapAsync)((0,ONn.batchJobsList)(this,e,r))}async create(e,r){return(0,Hhe.unwrapAsync)((0,SNn.batchJobsCreate)(this,e,r))}async get(e,r){return(0,Hhe.unwrapAsync)((0,CNn.batchJobsGet)(this,e,r))}async cancel(e,r){return(0,Hhe.unwrapAsync)((0,xNn.batchJobsCancel)(this,e,r))}};Vhe.MistralJobs=H3e});var SXt=x(Whe=>{"use strict";Object.defineProperty(Whe,"__esModule",{value:!0});Whe.Batch=void 0;var PNn=vg(),TNn=xXt(),V3e=class extends PNn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new TNn.MistralJobs(this._options))}};Whe.Batch=V3e});var EXt=x(AT=>{"use strict";var ANn=AT&&AT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),INn=AT&&AT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W3e=AT&&AT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ANn(e,t,r);return INn(e,t),e};Object.defineProperty(AT,"__esModule",{value:!0});AT.chatComplete=LNn;var MNn=xi(),e7=W3e(Si()),RNn=He(),NNn=Oe(),CXt=Ci(),jNn=Ho(),OXt=W3e(io()),DNn=W3e(xg());async function LNn(t,e,r){let n=(0,NNn.safeParse)(e,_=>OXt.ChatCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,MNn.encodeJSON)("body",o,{explode:!0}),a=(0,jNn.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,RNn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,CXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,CXt.resolveGlobalSecurity)(l),d={operationID:"chat_completion_v1_chat_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await e7.match(e7.json(200,OXt.ChatCompletionResponse$inboundSchema),e7.jsonErr(422,DNn.HTTPValidationError$inboundSchema),e7.fail("4XX"),e7.fail("5XX"))(h,{extraFields:y});return g.ok,g}});var AXt=x(IT=>{"use strict";var FNn=IT&&IT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kNn=IT&&IT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Khe=IT&&IT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FNn(e,t,r);return kNn(e,t),e};Object.defineProperty(IT,"__esModule",{value:!0});IT.chatStream=WNn;var $Nn=Khe(Ae()),BNn=xi(),zNn=UJ(),t7=Khe(Si()),UNn=He(),qNn=Oe(),PXt=Ci(),HNn=Ho(),TXt=Khe(io()),VNn=Khe(xg());async function WNn(t,e,r){let n=(0,qNn.safeParse)(e,_=>TXt.ChatCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,BNn.encodeJSON)("body",o,{explode:!0}),a=(0,HNn.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,UNn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,PXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,PXt.resolveGlobalSecurity)(l),d={operationID:"stream_chat",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await t7.match(t7.sse(200,$Nn.instanceof(ReadableStream).transform(_=>new zNn.EventStream({stream:_,decoder(w){return TXt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),t7.jsonErr(422,VNn.HTTPValidationError$inboundSchema),t7.fail("4XX"),t7.fail("5XX"))(h,{extraFields:y});return g.ok,g}});var Ghe=x(kO=>{"use strict";Object.defineProperty(kO,"__esModule",{value:!0});kO.getDefaultOptions=kO.defaultOptions=kO.ignoreOverride=void 0;kO.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");kO.defaultOptions={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"};var KNn=t=>typeof t=="string"?{...kO.defaultOptions,name:t}:{...kO.defaultOptions,...t};kO.getDefaultOptions=KNn});var K3e=x(Jhe=>{"use strict";Object.defineProperty(Jhe,"__esModule",{value:!0});Jhe.getRefs=void 0;var GNn=Ghe(),JNn=t=>{let e=(0,GNn.getDefaultOptions)(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};Jhe.getRefs=JNn});var b1=x(lH=>{"use strict";Object.defineProperty(lH,"__esModule",{value:!0});lH.setResponseValueAndErrors=lH.addErrorMessage=void 0;function IXt(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}lH.addErrorMessage=IXt;function ZNn(t,e,r,n,o){t[e]=r,IXt(t,e,n,o)}lH.setResponseValueAndErrors=ZNn});var G3e=x(Zhe=>{"use strict";Object.defineProperty(Zhe,"__esModule",{value:!0});Zhe.parseAnyDef=void 0;function YNn(){return{}}Zhe.parseAnyDef=YNn});var J3e=x(Xhe=>{"use strict";Object.defineProperty(Xhe,"__esModule",{value:!0});Xhe.parseArrayDef=void 0;var XNn=Ae(),Yhe=b1(),QNn=Gl();function ejn(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==XNn.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,QNn.parseDef)(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(0,Yhe.setResponseValueAndErrors)(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&(0,Yhe.setResponseValueAndErrors)(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&((0,Yhe.setResponseValueAndErrors)(r,"minItems",t.exactLength.value,t.exactLength.message,e),(0,Yhe.setResponseValueAndErrors)(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}Xhe.parseArrayDef=ejn});var Z3e=x(Qhe=>{"use strict";Object.defineProperty(Qhe,"__esModule",{value:!0});Qhe.parseBigintDef=void 0;var qk=b1();function tjn(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?(0,qk.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,qk.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,qk.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,qk.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,qk.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,qk.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,qk.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}Qhe.parseBigintDef=tjn});var Y3e=x(ege=>{"use strict";Object.defineProperty(ege,"__esModule",{value:!0});ege.parseBooleanDef=void 0;function rjn(){return{type:"boolean"}}ege.parseBooleanDef=rjn});var rge=x(tge=>{"use strict";Object.defineProperty(tge,"__esModule",{value:!0});tge.parseBrandedDef=void 0;var njn=Gl();function ojn(t,e){return(0,njn.parseDef)(t.type._def,e)}tge.parseBrandedDef=ojn});var X3e=x(nge=>{"use strict";Object.defineProperty(nge,"__esModule",{value:!0});nge.parseCatchDef=void 0;var ijn=Gl(),ajn=(t,e)=>(0,ijn.parseDef)(t.innerType._def,e);nge.parseCatchDef=ajn});var Q3e=x(oge=>{"use strict";Object.defineProperty(oge,"__esModule",{value:!0});oge.parseDateDef=void 0;var MXt=b1();function RXt(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>RXt(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return sjn(t,e)}}oge.parseDateDef=RXt;var sjn=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":(0,MXt.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e);break;case"max":(0,MXt.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e);break}return r}});var eHe=x(ige=>{"use strict";Object.defineProperty(ige,"__esModule",{value:!0});ige.parseDefaultDef=void 0;var ujn=Gl();function ljn(t,e){return{...(0,ujn.parseDef)(t.innerType._def,e),default:t.defaultValue()}}ige.parseDefaultDef=ljn});var tHe=x(age=>{"use strict";Object.defineProperty(age,"__esModule",{value:!0});age.parseEffectsDef=void 0;var cjn=Gl();function djn(t,e){return e.effectStrategy==="input"?(0,cjn.parseDef)(t.schema._def,e):{}}age.parseEffectsDef=djn});var rHe=x(sge=>{"use strict";Object.defineProperty(sge,"__esModule",{value:!0});sge.parseEnumDef=void 0;function fjn(t){return{type:"string",enum:Array.from(t.values)}}sge.parseEnumDef=fjn});var nHe=x(uge=>{"use strict";Object.defineProperty(uge,"__esModule",{value:!0});uge.parseIntersectionDef=void 0;var NXt=Gl(),pjn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function mjn(t,e){let r=[(0,NXt.parseDef)(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0,NXt.parseDef)(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(pjn(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:s,...u}=i;a=u}else n=void 0;o.push(a)}}),o.length?{allOf:o,...n}:void 0}uge.parseIntersectionDef=mjn});var oHe=x(lge=>{"use strict";Object.defineProperty(lge,"__esModule",{value:!0});lge.parseLiteralDef=void 0;function hjn(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}lge.parseLiteralDef=hjn});var cge=x(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.parseStringDef=tf.zodPatterns=void 0;var Hk=b1(),iHe;tf.zodPatterns={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:()=>(iHe===void 0&&(iHe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),iHe),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-_]*$/};function gjn(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":(0,Hk.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":(0,Hk.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":U_(r,"email",n.message,e);break;case"format:idn-email":U_(r,"idn-email",n.message,e);break;case"pattern:zod":tm(r,tf.zodPatterns.email,n.message,e);break}break;case"url":U_(r,"uri",n.message,e);break;case"uuid":U_(r,"uuid",n.message,e);break;case"regex":tm(r,n.regex,n.message,e);break;case"cuid":tm(r,tf.zodPatterns.cuid,n.message,e);break;case"cuid2":tm(r,tf.zodPatterns.cuid2,n.message,e);break;case"startsWith":tm(r,RegExp(`^${aHe(n.value,e)}`),n.message,e);break;case"endsWith":tm(r,RegExp(`${aHe(n.value,e)}$`),n.message,e);break;case"datetime":U_(r,"date-time",n.message,e);break;case"date":U_(r,"date",n.message,e);break;case"time":U_(r,"time",n.message,e);break;case"duration":U_(r,"duration",n.message,e);break;case"length":(0,Hk.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),(0,Hk.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{tm(r,RegExp(aHe(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&U_(r,"ipv4",n.message,e),n.version!=="v4"&&U_(r,"ipv6",n.message,e);break}case"base64url":tm(r,tf.zodPatterns.base64url,n.message,e);break;case"jwt":tm(r,tf.zodPatterns.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&tm(r,tf.zodPatterns.ipv4Cidr,n.message,e),n.version!=="v4"&&tm(r,tf.zodPatterns.ipv6Cidr,n.message,e);break}case"emoji":tm(r,tf.zodPatterns.emoji(),n.message,e);break;case"ulid":{tm(r,tf.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{U_(r,"binary",n.message,e);break}case"contentEncoding:base64":{(0,Hk.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{tm(r,tf.zodPatterns.base64,n.message,e);break}}break}case"nanoid":tm(r,tf.zodPatterns.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}tf.parseStringDef=gjn;function aHe(t,e){return e.patternStrategy==="escape"?bjn(t):t}var yjn=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function bjn(t){let e="";for(let r=0;r<t.length;r++)yjn.has(t[r])||(e+="\\"),e+=t[r];return e}function U_(t,e,r,n){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):(0,Hk.setResponseValueAndErrors)(t,"format",e,r,n)}function tm(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:jXt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,Hk.setResponseValueAndErrors)(t,"pattern",jXt(e,n),r,n)}function jXt(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",i=!1,a=!1,s=!1;for(let u=0;u<n.length;u++){if(i){o+=n[u],i=!1;continue}if(r.i){if(a){if(n[u].match(/[a-z]/)){s?(o+=n[u],o+=`${n[u-2]}-${n[u]}`.toUpperCase(),s=!1):n[u+1]==="-"&&n[u+2]?.match(/[a-z]/)?(o+=n[u],s=!0):o+=`${n[u]}${n[u].toUpperCase()}`;continue}}else if(n[u].match(/[a-z]/)){o+=`[${n[u]}${n[u].toUpperCase()}]`;continue}}if(r.m){if(n[u]==="^"){o+=`(^|(?<=[\r
]))`;continue}else if(n[u]==="$"){o+=`($|(?=[\r
]))`;continue}}if(r.s&&n[u]==="."){o+=a?`${n[u]}\r
`:`[${n[u]}\r
]`;continue}o+=n[u],n[u]==="\\"?i=!0:a&&n[u]==="]"?a=!1:!a&&n[u]==="["&&(a=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return o}});var fge=x(dge=>{"use strict";Object.defineProperty(dge,"__esModule",{value:!0});dge.parseRecordDef=void 0;var r7=Ae(),DXt=Gl(),_jn=cge(),vjn=rge();function wjn(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===r7.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,DXt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,DXt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===r7.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=(0,_jn.parseStringDef)(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===r7.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===r7.ZodFirstPartyTypeKind.ZodBranded&&t.keyType._def.type._def.typeName===r7.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,vjn.parseBrandedDef)(t.keyType._def,e);return{...r,propertyNames:o}}}return r}dge.parseRecordDef=wjn});var sHe=x(pge=>{"use strict";Object.defineProperty(pge,"__esModule",{value:!0});pge.parseMapDef=void 0;var LXt=Gl(),xjn=fge();function Sjn(t,e){if(e.mapStrategy==="record")return(0,xjn.parseRecordDef)(t,e);let r=(0,LXt.parseDef)(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0,LXt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}pge.parseMapDef=Sjn});var uHe=x(mge=>{"use strict";Object.defineProperty(mge,"__esModule",{value:!0});mge.parseNativeEnumDef=void 0;function Cjn(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}mge.parseNativeEnumDef=Cjn});var lHe=x(hge=>{"use strict";Object.defineProperty(hge,"__esModule",{value:!0});hge.parseNeverDef=void 0;function Ojn(){return{not:{}}}hge.parseNeverDef=Ojn});var cHe=x(gge=>{"use strict";Object.defineProperty(gge,"__esModule",{value:!0});gge.parseNullDef=void 0;function Ejn(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}gge.parseNullDef=Ejn});var yge=x(_1=>{"use strict";Object.defineProperty(_1,"__esModule",{value:!0});_1.parseUnionDef=_1.primitiveMappings=void 0;var Pjn=Gl();_1.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Tjn(t,e){if(e.target==="openApi3")return FXt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in _1.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=_1.primitiveMappings[i._def.typeName];return a&&!o.includes(a)?[...o,a]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,i)=>{let a=typeof i._def.value;switch(a){case"string":case"number":case"boolean":return[...o,a];case"bigint":return[...o,"integer"];case"object":if(i._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((i,a,s)=>s.indexOf(i)===a);return{type:o.length>1?o:o[0],enum:r.reduce((i,a)=>i.includes(a._def.value)?i:[...i,a._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return FXt(t,e)}_1.parseUnionDef=Tjn;var FXt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>(0,Pjn.parseDef)(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0}});var dHe=x(bge=>{"use strict";Object.defineProperty(bge,"__esModule",{value:!0});bge.parseNullableDef=void 0;var kXt=Gl(),$Xt=yge();function Ajn(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:$Xt.primitiveMappings[t.innerType._def.typeName],nullable:!0}:{type:[$Xt.primitiveMappings[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0,kXt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,kXt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}bge.parseNullableDef=Ajn});var fHe=x(_ge=>{"use strict";Object.defineProperty(_ge,"__esModule",{value:!0});_ge.parseNumberDef=void 0;var v1=b1();function Ijn(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",(0,v1.addErrorMessage)(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0,v1.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,v1.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,v1.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,v1.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,v1.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,v1.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,v1.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}_ge.parseNumberDef=Ijn});var mHe=x(vge=>{"use strict";Object.defineProperty(vge,"__esModule",{value:!0});vge.parseObjectDef=void 0;var Mjn=Ae(),pHe=Gl();function Rjn(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":(0,pHe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(0,pHe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function Njn(t,e){let r=e.target==="openAi",n={type:"object",...Object.entries(t.shape()).reduce((o,[i,a])=>{if(a===void 0||a._def===void 0)return o;let s=a.isOptional();s&&r&&(a instanceof Mjn.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,pHe.parseDef)(a._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});return u===void 0?o:{properties:{...o.properties,[i]:u},required:s?o.required:[...o.required,i]}},{properties:{},required:[]}),additionalProperties:Rjn(t,e)};return n.required.length||delete n.required,n}vge.parseObjectDef=Njn});var hHe=x(wge=>{"use strict";Object.defineProperty(wge,"__esModule",{value:!0});wge.parseOptionalDef=void 0;var BXt=Gl(),jjn=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return(0,BXt.parseDef)(t.innerType._def,e);let r=(0,BXt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};wge.parseOptionalDef=jjn});var gHe=x(Sge=>{"use strict";Object.defineProperty(Sge,"__esModule",{value:!0});Sge.parsePipelineDef=void 0;var xge=Gl(),Djn=(t,e)=>{if(e.pipeStrategy==="input")return(0,xge.parseDef)(t.in._def,e);if(e.pipeStrategy==="output")return(0,xge.parseDef)(t.out._def,e);let r=(0,xge.parseDef)(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0,xge.parseDef)(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};Sge.parsePipelineDef=Djn});var yHe=x(Cge=>{"use strict";Object.defineProperty(Cge,"__esModule",{value:!0});Cge.parsePromiseDef=void 0;var Ljn=Gl();function Fjn(t,e){return(0,Ljn.parseDef)(t.type._def,e)}Cge.parsePromiseDef=Fjn});var bHe=x(Oge=>{"use strict";Object.defineProperty(Oge,"__esModule",{value:!0});Oge.parseSetDef=void 0;var zXt=b1(),kjn=Gl();function $jn(t,e){let n={type:"array",uniqueItems:!0,items:(0,kjn.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(0,zXt.setResponseValueAndErrors)(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&(0,zXt.setResponseValueAndErrors)(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}Oge.parseSetDef=$jn});var vHe=x(Ege=>{"use strict";Object.defineProperty(Ege,"__esModule",{value:!0});Ege.parseTupleDef=void 0;var _He=Gl();function Bjn(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>(0,_He.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,_He.parseDef)(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>(0,_He.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}Ege.parseTupleDef=Bjn});var wHe=x(Pge=>{"use strict";Object.defineProperty(Pge,"__esModule",{value:!0});Pge.parseUndefinedDef=void 0;function zjn(){return{not:{}}}Pge.parseUndefinedDef=zjn});var xHe=x(Tge=>{"use strict";Object.defineProperty(Tge,"__esModule",{value:!0});Tge.parseUnknownDef=void 0;function Ujn(){return{}}Tge.parseUnknownDef=Ujn});var SHe=x(Age=>{"use strict";Object.defineProperty(Age,"__esModule",{value:!0});Age.parseReadonlyDef=void 0;var qjn=Gl(),Hjn=(t,e)=>(0,qjn.parseDef)(t.innerType._def,e);Age.parseReadonlyDef=Hjn});var Gl=x(Ige=>{"use strict";Object.defineProperty(Ige,"__esModule",{value:!0});Ige.parseDef=void 0;var ao=Ae(),Vjn=G3e(),Wjn=J3e(),Kjn=Z3e(),Gjn=Y3e(),Jjn=rge(),Zjn=X3e(),Yjn=Q3e(),Xjn=eHe(),Qjn=tHe(),eDn=rHe(),tDn=nHe(),rDn=oHe(),nDn=sHe(),oDn=uHe(),iDn=lHe(),aDn=cHe(),sDn=dHe(),uDn=fHe(),lDn=mHe(),cDn=hHe(),dDn=gHe(),fDn=yHe(),pDn=fge(),mDn=bHe(),hDn=cge(),gDn=vHe(),yDn=wHe(),bDn=yge(),_Dn=xHe(),vDn=SHe(),wDn=Ghe();function UXt(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==wDn.ignoreOverride)return a}if(n&&!r){let a=xDn(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=CDn(t,t.typeName,e);return i&&ODn(t,e,i),o.jsonSchema=i,i}Ige.parseDef=UXt;var xDn=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:SDn(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},SDn=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},CDn=(t,e,r)=>{switch(e){case ao.ZodFirstPartyTypeKind.ZodString:return(0,hDn.parseStringDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodNumber:return(0,uDn.parseNumberDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodObject:return(0,lDn.parseObjectDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodBigInt:return(0,Kjn.parseBigintDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodBoolean:return(0,Gjn.parseBooleanDef)();case ao.ZodFirstPartyTypeKind.ZodDate:return(0,Yjn.parseDateDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodUndefined:return(0,yDn.parseUndefinedDef)();case ao.ZodFirstPartyTypeKind.ZodNull:return(0,aDn.parseNullDef)(r);case ao.ZodFirstPartyTypeKind.ZodArray:return(0,Wjn.parseArrayDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodUnion:case ao.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,bDn.parseUnionDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodIntersection:return(0,tDn.parseIntersectionDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodTuple:return(0,gDn.parseTupleDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodRecord:return(0,pDn.parseRecordDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodLiteral:return(0,rDn.parseLiteralDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodEnum:return(0,eDn.parseEnumDef)(t);case ao.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,oDn.parseNativeEnumDef)(t);case ao.ZodFirstPartyTypeKind.ZodNullable:return(0,sDn.parseNullableDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodOptional:return(0,cDn.parseOptionalDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodMap:return(0,nDn.parseMapDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodSet:return(0,mDn.parseSetDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodLazy:return UXt(t.getter()._def,r);case ao.ZodFirstPartyTypeKind.ZodPromise:return(0,fDn.parsePromiseDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodNaN:case ao.ZodFirstPartyTypeKind.ZodNever:return(0,iDn.parseNeverDef)();case ao.ZodFirstPartyTypeKind.ZodEffects:return(0,Qjn.parseEffectsDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodAny:return(0,Vjn.parseAnyDef)();case ao.ZodFirstPartyTypeKind.ZodUnknown:return(0,_Dn.parseUnknownDef)();case ao.ZodFirstPartyTypeKind.ZodDefault:return(0,Xjn.parseDefaultDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodBranded:return(0,Jjn.parseBrandedDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodReadonly:return(0,vDn.parseReadonlyDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodCatch:return(0,Zjn.parseCatchDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodPipeline:return(0,dDn.parsePipelineDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodFunction:case ao.ZodFirstPartyTypeKind.ZodVoid:case ao.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(e)}},ODn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var CHe=x(Mge=>{"use strict";Object.defineProperty(Mge,"__esModule",{value:!0});Mge.zodToJsonSchema=void 0;var qXt=Gl(),EDn=K3e(),PDn=(t,e)=>{let r=(0,EDn.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:(0,qXt.parseDef)(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??{}}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(0,qXt.parseDef)(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??{},a=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;a!==void 0&&(i.title=a);let s=o===void 0?n?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:i}};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in s||"oneOf"in s||"allOf"in s||"type"in s&&Array.isArray(s.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),s};Mge.zodToJsonSchema=PDn});var HXt=x(gn=>{"use strict";var TDn=gn&&gn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_o=gn&&gn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&TDn(e,t,r)};Object.defineProperty(gn,"__esModule",{value:!0});_o(Ghe(),gn);_o(K3e(),gn);_o(b1(),gn);_o(Gl(),gn);_o(G3e(),gn);_o(J3e(),gn);_o(Z3e(),gn);_o(Y3e(),gn);_o(rge(),gn);_o(X3e(),gn);_o(Q3e(),gn);_o(eHe(),gn);_o(tHe(),gn);_o(rHe(),gn);_o(nHe(),gn);_o(oHe(),gn);_o(sHe(),gn);_o(uHe(),gn);_o(lHe(),gn);_o(cHe(),gn);_o(dHe(),gn);_o(fHe(),gn);_o(mHe(),gn);_o(hHe(),gn);_o(gHe(),gn);_o(yHe(),gn);_o(SHe(),gn);_o(fge(),gn);_o(bHe(),gn);_o(cge(),gn);_o(vHe(),gn);_o(wHe(),gn);_o(yge(),gn);_o(xHe(),gn);_o(CHe(),gn);var ADn=CHe();gn.default=ADn.zodToJsonSchema});var WXt=x(n7=>{"use strict";Object.defineProperty(n7,"__esModule",{value:!0});n7.transformToChatCompletionRequest=MDn;n7.convertToParsedChatCompletionResponse=RDn;n7.responseFormatFromZodObject=VXt;var IDn=HXt();function MDn(t){let{responseFormat:e,...r}=t,n=VXt(e);return{...r,responseFormat:n}}function RDn(t,e){if(t.choices===void 0||t.choices.length===0)return{...t,choices:t.choices===void 0?void 0:[]};let r=[];for(let n of t.choices)n.message===null||typeof n.message>"u"?r.push({...n,message:void 0}):n.message.content!==null&&typeof n.message.content<"u"&&!Array.isArray(n.message.content)&&r.push({...n,message:{...n.message,parsed:e.safeParse(JSON.parse(n.message.content)).data}});return{...t,choices:r}}function VXt(t){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,IDn.zodToJsonSchema)(t),strict:!0}}}});var JXt=x(Nge=>{"use strict";Object.defineProperty(Nge,"__esModule",{value:!0});Nge.Chat=void 0;var KXt=EXt(),GXt=AXt(),NDn=vg(),Rge=qy(),OHe=WXt(),EHe=class extends NDn.ClientSDK{async parse(e,r){let n=(0,OHe.transformToChatCompletionRequest)(e),o=await(0,Rge.unwrapAsync)((0,KXt.chatComplete)(this,n,r));return(0,OHe.convertToParsedChatCompletionResponse)(o,e.responseFormat)}async parseStream(e,r){let n=(0,OHe.transformToChatCompletionRequest)(e);return(0,Rge.unwrapAsync)((0,GXt.chatStream)(this,n,r))}async complete(e,r){return(0,Rge.unwrapAsync)((0,KXt.chatComplete)(this,e,r))}async stream(e,r){return(0,Rge.unwrapAsync)((0,GXt.chatStream)(this,e,r))}};Nge.Chat=EHe});var XXt=x(MT=>{"use strict";var jDn=MT&&MT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DDn=MT&&MT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PHe=MT&&MT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jDn(e,t,r);return DDn(e,t),e};Object.defineProperty(MT,"__esModule",{value:!0});MT.classifiersModerate=zDn;var LDn=xi(),o7=PHe(Si()),FDn=He(),kDn=Oe(),ZXt=Ci(),$Dn=Ho(),YXt=PHe(io()),BDn=PHe(xg());async function zDn(t,e,r){let n=(0,kDn.safeParse)(e,_=>YXt.ClassificationRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,LDn.encodeJSON)("body",o,{explode:!0}),a=(0,$Dn.pathToFunc)("/v1/moderations")(),s=new Headers((0,FDn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,ZXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,ZXt.resolveGlobalSecurity)(l),d={operationID:"moderations_v1_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await o7.match(o7.json(200,YXt.ClassificationResponse$inboundSchema),o7.jsonErr(422,BDn.HTTPValidationError$inboundSchema),o7.fail("4XX"),o7.fail("5XX"))(h,{extraFields:y});return g.ok,g}});var tQt=x(RT=>{"use strict";var UDn=RT&&RT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qDn=RT&&RT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),THe=RT&&RT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UDn(e,t,r);return qDn(e,t),e};Object.defineProperty(RT,"__esModule",{value:!0});RT.classifiersModerateChat=JDn;var HDn=xi(),i7=THe(Si()),VDn=He(),WDn=Oe(),QXt=Ci(),KDn=Ho(),eQt=THe(io()),GDn=THe(xg());async function JDn(t,e,r){let n=(0,WDn.safeParse)(e,_=>eQt.ChatClassificationRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,HDn.encodeJSON)("body",o,{explode:!0}),a=(0,KDn.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,VDn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,QXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,QXt.resolveGlobalSecurity)(l),d={operationID:"moderations_chat_v1_chat_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await i7.match(i7.json(200,eQt.ClassificationResponse$inboundSchema),i7.jsonErr(422,GDn.HTTPValidationError$inboundSchema),i7.fail("4XX"),i7.fail("5XX"))(h,{extraFields:y});return g.ok,g}});var nQt=x(jge=>{"use strict";Object.defineProperty(jge,"__esModule",{value:!0});jge.Classifiers=void 0;var ZDn=XXt(),YDn=tQt(),XDn=vg(),rQt=qy(),AHe=class extends XDn.ClientSDK{async moderate(e,r){return(0,rQt.unwrapAsync)((0,ZDn.classifiersModerate)(this,e,r))}async moderateChat(e,r){return(0,rQt.unwrapAsync)((0,YDn.classifiersModerateChat)(this,e,r))}};jge.Classifiers=AHe});var aQt=x(NT=>{"use strict";var QDn=NT&&NT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eLn=NT&&NT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IHe=NT&&NT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QDn(e,t,r);return eLn(e,t),e};Object.defineProperty(NT,"__esModule",{value:!0});NT.embeddingsCreate=aLn;var tLn=xi(),a7=IHe(Si()),rLn=He(),nLn=Oe(),oQt=Ci(),oLn=Ho(),iQt=IHe(io()),iLn=IHe(xg());async function aLn(t,e,r){let n=(0,nLn.safeParse)(e,_=>iQt.EmbeddingRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,tLn.encodeJSON)("body",o,{explode:!0}),a=(0,oLn.pathToFunc)("/v1/embeddings")(),s=new Headers((0,rLn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,oQt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,oQt.resolveGlobalSecurity)(l),d={operationID:"embeddings_v1_embeddings_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await a7.match(a7.json(200,iQt.EmbeddingResponse$inboundSchema),a7.jsonErr(422,iLn.HTTPValidationError$inboundSchema),a7.fail("4XX"),a7.fail("5XX"))(h,{extraFields:y});return g.ok,g}});var sQt=x(Dge=>{"use strict";Object.defineProperty(Dge,"__esModule",{value:!0});Dge.Embeddings=void 0;var sLn=aQt(),uLn=vg(),lLn=qy(),MHe=class extends uLn.ClientSDK{async create(e,r){return(0,lLn.unwrapAsync)((0,sLn.embeddingsCreate)(this,e,r))}};Dge.Embeddings=MHe});var lQt=x(jT=>{"use strict";var cLn=jT&&jT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dLn=jT&&jT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RHe=jT&&jT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cLn(e,t,r);return dLn(e,t),e};Object.defineProperty(jT,"__esModule",{value:!0});jT.filesDelete=bLn;var fLn=xi(),Lge=RHe(Si()),pLn=He(),mLn=Oe(),uQt=Ci(),hLn=Ho(),gLn=RHe(io()),yLn=RHe(Kl());async function bLn(t,e,r){let n=(0,mLn.safeParse)(e,_=>yLn.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,fLn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,hLn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,pLn.compactMap)({Accept:"application/json"})),l=await(0,uQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,uQt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_delete_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,[g]=await Lge.match(Lge.json(200,gLn.DeleteFileOut$inboundSchema),Lge.fail("4XX"),Lge.fail("5XX"))(y);return g.ok,g}});var dQt=x(DT=>{"use strict";var _Ln=DT&&DT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vLn=DT&&DT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NHe=DT&&DT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Ln(e,t,r);return vLn(e,t),e};Object.defineProperty(DT,"__esModule",{value:!0});DT.filesDownload=PLn;var wLn=NHe(Ae()),xLn=xi(),Fge=NHe(Si()),SLn=He(),CLn=Oe(),cQt=Ci(),OLn=Ho(),ELn=NHe(Kl());async function PLn(t,e,r){let n=(0,CLn.safeParse)(e,_=>ELn.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,xLn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,OLn.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,SLn.compactMap)({Accept:"application/octet-stream"})),l=await(0,cQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,cQt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_download_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,[g]=await Fge.match(Fge.stream(200,wLn.instanceof(ReadableStream)),Fge.fail("4XX"),Fge.fail("5XX"))(y);return g.ok,g}});var mQt=x(LT=>{"use strict";var TLn=LT&&LT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ALn=LT&&LT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jHe=LT&&LT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TLn(e,t,r);return ALn(e,t),e};Object.defineProperty(LT,"__esModule",{value:!0});LT.filesGetSignedUrl=DLn;var fQt=xi(),kge=jHe(Si()),ILn=He(),MLn=Oe(),pQt=Ci(),RLn=Ho(),NLn=jHe(io()),jLn=jHe(Kl());async function DLn(t,e,r){let n=(0,MLn.safeParse)(e,w=>jLn.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,fQt.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,RLn.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,fQt.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,ILn.compactMap)({Accept:"application/json"})),c=await(0,pQt.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,pQt.resolveGlobalSecurity)(d),p={operationID:"files_api_routes_get_signed_url",oAuth2Scopes:[],resolvedSecurity:f,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},m=t._createRequest(p,{security:f,method:"GET",baseURL:r?.serverURL,path:s,headers:l,query:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!m.ok)return m;let h=m.value,y=await t._do(h,{context:p,errorCodes:["4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!y.ok)return y;let g=y.value,[_]=await kge.match(kge.json(200,NLn.FileSignedURL$inboundSchema),kge.fail("4XX"),kge.fail("5XX"))(g);return _.ok,_}});var gQt=x(FT=>{"use strict";var LLn=FT&&FT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FLn=FT&&FT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DHe=FT&&FT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LLn(e,t,r);return FLn(e,t),e};Object.defineProperty(FT,"__esModule",{value:!0});FT.filesList=HLn;var kLn=xi(),$ge=DHe(Si()),$Ln=He(),BLn=Oe(),hQt=Ci(),zLn=Ho(),ULn=DHe(io()),qLn=DHe(Kl());async function HLn(t,e,r){let n=(0,BLn.safeParse)(e,_=>qLn.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,zLn.pathToFunc)("/v1/files")(),s=(0,kLn.encodeFormQuery)({page:o?.page,page_size:o?.page_size,purpose:o?.purpose,sample_type:o?.sample_type,search:o?.search,source:o?.source}),u=new Headers((0,$Ln.compactMap)({Accept:"application/json"})),l=await(0,hQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,hQt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_list_files",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,[g]=await $ge.match($ge.json(200,ULn.ListFilesOut$inboundSchema),$ge.fail("4XX"),$ge.fail("5XX"))(y);return g.ok,g}});var bQt=x(kT=>{"use strict";var VLn=kT&&kT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WLn=kT&&kT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LHe=kT&&kT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VLn(e,t,r);return WLn(e,t),e};Object.defineProperty(kT,"__esModule",{value:!0});kT.filesRetrieve=QLn;var KLn=xi(),Bge=LHe(Si()),GLn=He(),JLn=Oe(),yQt=Ci(),ZLn=Ho(),YLn=LHe(io()),XLn=LHe(Kl());async function QLn(t,e,r){let n=(0,JLn.safeParse)(e,_=>XLn.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,KLn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,ZLn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,GLn.compactMap)({Accept:"application/json"})),l=await(0,yQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,yQt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_retrieve_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,[g]=await Bge.match(Bge.json(200,YLn.RetrieveFileOut$inboundSchema),Bge.fail("4XX"),Bge.fail("5XX"))(y);return g.ok,g}});var _Qt=x(FHe=>{"use strict";Object.defineProperty(FHe,"__esModule",{value:!0});FHe.isReadableStream=eFn;function eFn(t){if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.getReader=="function"&&typeof e.cancel=="function"&&typeof e.tee=="function"}});var wQt=x($T=>{"use strict";var tFn=$T&&$T.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rFn=$T&&$T.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kHe=$T&&$T.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tFn(e,t,r);return rFn(e,t),e};Object.defineProperty($T,"__esModule",{value:!0});$T.filesUpload=dFn;var zge=xi(),nFn=v4e(),Uge=kHe(Si()),oFn=He(),iFn=Oe(),vQt=Ci(),aFn=Ho(),sFn=kHe(io()),uFn=kHe(Kl()),lFn=B3e(),cFn=_Qt();async function dFn(t,e,r){let n=(0,iFn.safeParse)(e,g=>uFn.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=new FormData;if((0,lFn.isBlobLike)(o.file))(0,zge.appendForm)(i,"file",o.file);else if((0,cFn.isReadableStream)(o.file.content)){let g=await(0,nFn.readableStreamToArrayBuffer)(o.file.content),_=new Blob([g],{type:"application/octet-stream"});(0,zge.appendForm)(i,"file",_)}else(0,zge.appendForm)(i,"file",new Blob([o.file.content],{type:"application/octet-stream"}),o.file.fileName);o.purpose!==void 0&&(0,zge.appendForm)(i,"purpose",o.purpose);let a=(0,aFn.pathToFunc)("/v1/files")(),s=new Headers((0,oFn.compactMap)({Accept:"application/json"})),u=await(0,vQt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,vQt.resolveGlobalSecurity)(l),d={operationID:"files_api_routes_upload_file",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[y]=await Uge.match(Uge.json(200,sFn.UploadFileOut$inboundSchema),Uge.fail("4XX"),Uge.fail("5XX"))(h);return y.ok,y}});var xQt=x(qge=>{"use strict";Object.defineProperty(qge,"__esModule",{value:!0});qge.Files=void 0;var fFn=lQt(),pFn=dQt(),mFn=mQt(),hFn=gQt(),gFn=bQt(),yFn=wQt(),bFn=vg(),cH=qy(),$He=class extends bFn.ClientSDK{async upload(e,r){return(0,cH.unwrapAsync)((0,yFn.filesUpload)(this,e,r))}async list(e,r){return(0,cH.unwrapAsync)((0,hFn.filesList)(this,e,r))}async retrieve(e,r){return(0,cH.unwrapAsync)((0,gFn.filesRetrieve)(this,e,r))}async delete(e,r){return(0,cH.unwrapAsync)((0,fFn.filesDelete)(this,e,r))}async download(e,r){return(0,cH.unwrapAsync)((0,pFn.filesDownload)(this,e,r))}async getSignedUrl(e,r){return(0,cH.unwrapAsync)((0,mFn.filesGetSignedUrl)(this,e,r))}};qge.Files=$He});var OQt=x(BT=>{"use strict";var _Fn=BT&&BT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vFn=BT&&BT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BHe=BT&&BT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Fn(e,t,r);return vFn(e,t),e};Object.defineProperty(BT,"__esModule",{value:!0});BT.fimComplete=EFn;var wFn=xi(),s7=BHe(Si()),xFn=He(),SFn=Oe(),SQt=Ci(),CFn=Ho(),CQt=BHe(io()),OFn=BHe(xg());async function EFn(t,e,r){let n=(0,SFn.safeParse)(e,_=>CQt.FIMCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,wFn.encodeJSON)("body",o,{explode:!0}),a=(0,CFn.pathToFunc)("/v1/fim/completions")(),s=new Headers((0,xFn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,SQt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,SQt.resolveGlobalSecurity)(l),d={operationID:"fim_completion_v1_fim_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await s7.match(s7.json(200,CQt.FIMCompletionResponse$inboundSchema),s7.jsonErr(422,OFn.HTTPValidationError$inboundSchema),s7.fail("4XX"),s7.fail("5XX"))(h,{extraFields:y});return g.ok,g}});var TQt=x(zT=>{"use strict";var PFn=zT&&zT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TFn=zT&&zT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hge=zT&&zT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PFn(e,t,r);return TFn(e,t),e};Object.defineProperty(zT,"__esModule",{value:!0});zT.fimStream=LFn;var AFn=Hge(Ae()),IFn=xi(),MFn=UJ(),u7=Hge(Si()),RFn=He(),NFn=Oe(),EQt=Ci(),jFn=Ho(),PQt=Hge(io()),DFn=Hge(xg());async function LFn(t,e,r){let n=(0,NFn.safeParse)(e,_=>PQt.FIMCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,IFn.encodeJSON)("body",o,{explode:!0}),a=(0,jFn.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,RFn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,EQt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,EQt.resolveGlobalSecurity)(l),d={operationID:"stream_fim",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await u7.match(u7.sse(200,AFn.instanceof(ReadableStream).transform(_=>new MFn.EventStream({stream:_,decoder(w){return PQt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),u7.jsonErr(422,DFn.HTTPValidationError$inboundSchema),u7.fail("4XX"),u7.fail("5XX"))(h,{extraFields:y});return g.ok,g}});var IQt=x(Vge=>{"use strict";Object.defineProperty(Vge,"__esModule",{value:!0});Vge.Fim=void 0;var FFn=OQt(),kFn=TQt(),$Fn=vg(),AQt=qy(),zHe=class extends $Fn.ClientSDK{async complete(e,r){return(0,AQt.unwrapAsync)((0,FFn.fimComplete)(this,e,r))}async stream(e,r){return(0,AQt.unwrapAsync)((0,kFn.fimStream)(this,e,r))}};Vge.Fim=zHe});var RQt=x(UT=>{"use strict";var BFn=UT&&UT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zFn=UT&&UT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UHe=UT&&UT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BFn(e,t,r);return zFn(e,t),e};Object.defineProperty(UT,"__esModule",{value:!0});UT.fineTuningJobsCancel=GFn;var UFn=xi(),Wge=UHe(Si()),qFn=He(),HFn=Oe(),MQt=Ci(),VFn=Ho(),WFn=UHe(io()),KFn=UHe(Kl());async function GFn(t,e,r){let n=(0,HFn.safeParse)(e,_=>KFn.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,UFn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,VFn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,qFn.compactMap)({Accept:"application/json"})),l=await(0,MQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,MQt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_cancel_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,[g]=await Wge.match(Wge.json(200,WFn.DetailedJobOut$inboundSchema),Wge.fail("4XX"),Wge.fail("5XX"))(y);return g.ok,g}});var jQt=x(qT=>{"use strict";var JFn=qT&&qT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZFn=qT&&qT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qHe=qT&&qT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JFn(e,t,r);return ZFn(e,t),e};Object.defineProperty(qT,"__esModule",{value:!0});qT.fineTuningJobsCreate=nkn;var YFn=xi(),Kge=qHe(Si()),XFn=He(),QFn=Oe(),NQt=Ci(),ekn=Ho(),tkn=qHe(io()),rkn=qHe(Kl());async function nkn(t,e,r){let n=(0,QFn.safeParse)(e,g=>tkn.JobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,YFn.encodeJSON)("body",o,{explode:!0}),a=(0,ekn.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,XFn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,NQt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,NQt.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_fine_tuning_create_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[y]=await Kge.match(Kge.json(200,rkn.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),Kge.fail("4XX"),Kge.fail("5XX"))(h);return y.ok,y}});var LQt=x(HT=>{"use strict";var okn=HT&&HT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ikn=HT&&HT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HHe=HT&&HT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&okn(e,t,r);return ikn(e,t),e};Object.defineProperty(HT,"__esModule",{value:!0});HT.fineTuningJobsGet=fkn;var akn=xi(),Gge=HHe(Si()),skn=He(),ukn=Oe(),DQt=Ci(),lkn=Ho(),ckn=HHe(io()),dkn=HHe(Kl());async function fkn(t,e,r){let n=(0,ukn.safeParse)(e,_=>dkn.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,akn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,lkn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,skn.compactMap)({Accept:"application/json"})),l=await(0,DQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,DQt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,[g]=await Gge.match(Gge.json(200,ckn.DetailedJobOut$inboundSchema),Gge.fail("4XX"),Gge.fail("5XX"))(y);return g.ok,g}});var kQt=x(VT=>{"use strict";var pkn=VT&&VT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mkn=VT&&VT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VHe=VT&&VT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pkn(e,t,r);return mkn(e,t),e};Object.defineProperty(VT,"__esModule",{value:!0});VT.fineTuningJobsList=wkn;var hkn=xi(),Jge=VHe(Si()),gkn=He(),ykn=Oe(),FQt=Ci(),bkn=Ho(),_kn=VHe(io()),vkn=VHe(Kl());async function wkn(t,e,r){let n=(0,ykn.safeParse)(e,_=>vkn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,bkn.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,hkn.encodeFormQuery)({created_after:o?.created_after,created_by_me:o?.created_by_me,model:o?.model,page:o?.page,page_size:o?.page_size,status:o?.status,suffix:o?.suffix,wandb_name:o?.wandb_name,wandb_project:o?.wandb_project}),u=new Headers((0,gkn.compactMap)({Accept:"application/json"})),l=await(0,FQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,FQt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,[g]=await Jge.match(Jge.json(200,_kn.JobsOut$inboundSchema),Jge.fail("4XX"),Jge.fail("5XX"))(y);return g.ok,g}});var BQt=x(WT=>{"use strict";var xkn=WT&&WT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Skn=WT&&WT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WHe=WT&&WT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xkn(e,t,r);return Skn(e,t),e};Object.defineProperty(WT,"__esModule",{value:!0});WT.fineTuningJobsStart=Ikn;var Ckn=xi(),Zge=WHe(Si()),Okn=He(),Ekn=Oe(),$Qt=Ci(),Pkn=Ho(),Tkn=WHe(io()),Akn=WHe(Kl());async function Ikn(t,e,r){let n=(0,Ekn.safeParse)(e,_=>Akn.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,Ckn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Pkn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,Okn.compactMap)({Accept:"application/json"})),l=await(0,$Qt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,$Qt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_start_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,[g]=await Zge.match(Zge.json(200,Tkn.DetailedJobOut$inboundSchema),Zge.fail("4XX"),Zge.fail("5XX"))(y);return g.ok,g}});var zQt=x(Yge=>{"use strict";Object.defineProperty(Yge,"__esModule",{value:!0});Yge.Jobs=void 0;var Mkn=RQt(),Rkn=jQt(),Nkn=LQt(),jkn=kQt(),Dkn=BQt(),Lkn=vg(),l7=qy(),KHe=class extends Lkn.ClientSDK{async list(e,r){return(0,l7.unwrapAsync)((0,jkn.fineTuningJobsList)(this,e,r))}async create(e,r){return(0,l7.unwrapAsync)((0,Rkn.fineTuningJobsCreate)(this,e,r))}async get(e,r){return(0,l7.unwrapAsync)((0,Nkn.fineTuningJobsGet)(this,e,r))}async cancel(e,r){return(0,l7.unwrapAsync)((0,Mkn.fineTuningJobsCancel)(this,e,r))}async start(e,r){return(0,l7.unwrapAsync)((0,Dkn.fineTuningJobsStart)(this,e,r))}};Yge.Jobs=KHe});var UQt=x(Xge=>{"use strict";Object.defineProperty(Xge,"__esModule",{value:!0});Xge.FineTuning=void 0;var Fkn=vg(),kkn=zQt(),GHe=class extends Fkn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new kkn.Jobs(this._options))}};Xge.FineTuning=GHe});var HQt=x(KT=>{"use strict";var $kn=KT&&KT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Bkn=KT&&KT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JHe=KT&&KT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$kn(e,t,r);return Bkn(e,t),e};Object.defineProperty(KT,"__esModule",{value:!0});KT.modelsArchive=Kkn;var zkn=xi(),Qge=JHe(Si()),Ukn=He(),qkn=Oe(),qQt=Ci(),Hkn=Ho(),Vkn=JHe(io()),Wkn=JHe(Kl());async function Kkn(t,e,r){let n=(0,qkn.safeParse)(e,_=>Wkn.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,zkn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Hkn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,Ukn.compactMap)({Accept:"application/json"})),l=await(0,qQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,qQt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_archive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,[g]=await Qge.match(Qge.json(200,Vkn.ArchiveFTModelOut$inboundSchema),Qge.fail("4XX"),Qge.fail("5XX"))(y);return g.ok,g}});var WQt=x(GT=>{"use strict";var Gkn=GT&&GT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jkn=GT&&GT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eye=GT&&GT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Gkn(e,t,r);return Jkn(e,t),e};Object.defineProperty(GT,"__esModule",{value:!0});GT.modelsDelete=n$n;var Zkn=xi(),c7=eye(Si()),Ykn=He(),Xkn=Oe(),VQt=Ci(),Qkn=Ho(),e$n=eye(io()),t$n=eye(xg()),r$n=eye(Kl());async function n$n(t,e,r){let n=(0,Xkn.safeParse)(e,w=>r$n.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Zkn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Qkn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,Ykn.compactMap)({Accept:"application/json"})),l=await(0,VQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,VQt.resolveGlobalSecurity)(c),f={operationID:"delete_model_v1_models__model_id__delete",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,g={HttpMeta:{Response:y,Request:m}},[_]=await c7.match(c7.json(200,e$n.DeleteModelOut$inboundSchema),c7.jsonErr(422,t$n.HTTPValidationError$inboundSchema),c7.fail("4XX"),c7.fail("5XX"))(y,{extraFields:g});return _.ok,_}});var GQt=x(JT=>{"use strict";var o$n=JT&&JT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i$n=JT&&JT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZHe=JT&&JT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&o$n(e,t,r);return i$n(e,t),e};Object.defineProperty(JT,"__esModule",{value:!0});JT.modelsList=c$n;var d7=ZHe(Si()),a$n=He(),KQt=Ci(),s$n=Ho(),u$n=ZHe(io()),l$n=ZHe(xg());async function c$n(t,e){let r=(0,s$n.pathToFunc)("/v1/models")(),n=new Headers((0,a$n.compactMap)({Accept:"application/json"})),o=await(0,KQt.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,KQt.resolveGlobalSecurity)(i),s={operationID:"list_models_v1_models_get",oAuth2Scopes:[],resolvedSecurity:a,securitySource:t._options.apiKey,retryConfig:e?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:e?.retryCodes||["429","500","502","503","504"]},u=t._createRequest(s,{security:a,method:"GET",baseURL:e?.serverURL,path:r,headers:n,timeoutMs:e?.timeoutMs||t._options.timeoutMs||-1},e);if(!u.ok)return u;let l=u.value,c=await t._do(l,{context:s,errorCodes:["422","4XX","5XX"],retryConfig:s.retryConfig,retryCodes:s.retryCodes});if(!c.ok)return c;let d=c.value,f={HttpMeta:{Response:d,Request:l}},[p]=await d7.match(d7.json(200,u$n.ModelList$inboundSchema),d7.jsonErr(422,l$n.HTTPValidationError$inboundSchema),d7.fail("4XX"),d7.fail("5XX"))(d,{extraFields:f});return p.ok,p}});var YQt=x(ZT=>{"use strict";var d$n=ZT&&ZT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f$n=ZT&&ZT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YHe=ZT&&ZT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&d$n(e,t,r);return f$n(e,t),e};Object.defineProperty(ZT,"__esModule",{value:!0});ZT.modelsRetrieve=b$n;var p$n=xi(),f7=YHe(Si()),m$n=He(),h$n=Oe(),JQt=Ci(),g$n=Ho(),y$n=YHe(xg()),ZQt=YHe(Kl());async function b$n(t,e,r){let n=(0,h$n.safeParse)(e,w=>ZQt.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,p$n.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,g$n.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,m$n.compactMap)({Accept:"application/json"})),l=await(0,JQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,JQt.resolveGlobalSecurity)(c),f={operationID:"retrieve_model_v1_models__model_id__get",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,g={HttpMeta:{Response:y,Request:m}},[_]=await f7.match(f7.json(200,ZQt.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),f7.jsonErr(422,y$n.HTTPValidationError$inboundSchema),f7.fail("4XX"),f7.fail("5XX"))(y,{extraFields:g});return _.ok,_}});var QQt=x(YT=>{"use strict";var _$n=YT&&YT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),v$n=YT&&YT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XHe=YT&&YT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_$n(e,t,r);return v$n(e,t),e};Object.defineProperty(YT,"__esModule",{value:!0});YT.modelsUnarchive=P$n;var w$n=xi(),tye=XHe(Si()),x$n=He(),S$n=Oe(),XQt=Ci(),C$n=Ho(),O$n=XHe(io()),E$n=XHe(Kl());async function P$n(t,e,r){let n=(0,S$n.safeParse)(e,_=>E$n.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,w$n.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,C$n.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,x$n.compactMap)({Accept:"application/json"})),l=await(0,XQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,XQt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_unarchive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,[g]=await tye.match(tye.json(200,O$n.UnarchiveFTModelOut$inboundSchema),tye.fail("4XX"),tye.fail("5XX"))(y);return g.ok,g}});var rer=x(XT=>{"use strict";var T$n=XT&&XT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),A$n=XT&&XT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QHe=XT&&XT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&T$n(e,t,r);return A$n(e,t),e};Object.defineProperty(XT,"__esModule",{value:!0});XT.modelsUpdate=D$n;var eer=xi(),rye=QHe(Si()),I$n=He(),M$n=Oe(),ter=Ci(),R$n=Ho(),N$n=QHe(io()),j$n=QHe(Kl());async function D$n(t,e,r){let n=(0,M$n.safeParse)(e,_=>j$n.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,eer.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,eer.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,R$n.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,I$n.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,ter.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ter.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_update_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"PATCH",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let y=h.value,[g]=await rye.match(rye.json(200,N$n.FTModelOut$inboundSchema),rye.fail("4XX"),rye.fail("5XX"))(y);return g.ok,g}});var ner=x(nye=>{"use strict";Object.defineProperty(nye,"__esModule",{value:!0});nye.Models=void 0;var L$n=HQt(),F$n=WQt(),k$n=GQt(),$$n=YQt(),B$n=QQt(),z$n=rer(),U$n=vg(),dH=qy(),eVe=class extends U$n.ClientSDK{async list(e){return(0,dH.unwrapAsync)((0,k$n.modelsList)(this,e))}async retrieve(e,r){return(0,dH.unwrapAsync)((0,$$n.modelsRetrieve)(this,e,r))}async delete(e,r){return(0,dH.unwrapAsync)((0,F$n.modelsDelete)(this,e,r))}async update(e,r){return(0,dH.unwrapAsync)((0,z$n.modelsUpdate)(this,e,r))}async archive(e,r){return(0,dH.unwrapAsync)((0,L$n.modelsArchive)(this,e,r))}async unarchive(e,r){return(0,dH.unwrapAsync)((0,B$n.modelsUnarchive)(this,e,r))}};nye.Models=eVe});var oer=x(oye=>{"use strict";Object.defineProperty(oye,"__esModule",{value:!0});oye.Mistral=void 0;var q$n=vg(),H$n=GZt(),V$n=SXt(),W$n=JXt(),K$n=nQt(),G$n=sQt(),J$n=xQt(),Z$n=IQt(),Y$n=UQt(),X$n=ner(),tVe=class extends q$n.ClientSDK{get models(){return this._models??(this._models=new X$n.Models(this._options))}get files(){return this._files??(this._files=new J$n.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new Y$n.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new V$n.Batch(this._options))}get chat(){return this._chat??(this._chat=new W$n.Chat(this._options))}get fim(){return this._fim??(this._fim=new Z$n.Fim(this._options))}get agents(){return this._agents??(this._agents=new H$n.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new G$n.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new K$n.Classifiers(this._options))}};oye.Mistral=tVe});var ser=x(yh=>{"use strict";var ier=yh&&yh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q$n=yh&&yh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aer=yh&&yh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ier(e,t,r)},eBn=yh&&yh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ier(e,t,r);return Q$n(e,t),e};Object.defineProperty(yh,"__esModule",{value:!0});yh.files=void 0;aer(tme(),yh);yh.files=eBn(v4e());aer(oer(),yh)});var rVe=b(()=>{RB()});function rBn(t){return tBn.test(t)}function nBn(t){let e=t,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";if(e===0)return r[0];let n=[],o=r.length;for(;e;)n.push(r[e%o]),e=Math.floor(e/o);return n.reverse().join("")}function oBn(t){let e=0;for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);e=(e<<5)-e+n,e&=e}return Math.abs(e)}function nVe(t){if(rBn(t))return t;{let e=oBn(t),r=nBn(e);return r.length>=9?r.slice(0,9):r.padStart(9,"0")}}function oVe(t){return t?typeof t=="string"?t:t.map(e=>{if(e.type==="image_url"){if(typeof e.imageUrl!="string"&&e.imageUrl?.detail){let{detail:r}=e.imageUrl;if(r!=="high"&&r!=="auto"&&r!=="low")return{type:e.type,image_url:{url:e.imageUrl.url}}}return{type:e.type,image_url:e.imageUrl}}return e}):""}var tBn,uer=b(()=>{tBn=/^[a-zA-Z0-9]{9}$/});function ler(t){let e=o=>{switch(o){case"human":return"user";case"ai":return"assistant";case"system":return"system";case"tool":return"tool";case"function":return"assistant";default:throw new Error(`Unknown message type: ${o}`)}},r=(o,i)=>{let a=(s,u)=>{if(s.type==="image_url"&&(u==="user"||u==="assistant"))return{type:s.type,imageUrl:s?.image_url};if(s.type==="text")return{type:s.type,text:s?.text};throw new Error(`ChatMistralAI only supports messages of "image_url" for roles "user" and "assistant", and "text" for all others.
Received: ${JSON.stringify(o,null,2)}`)};if(typeof o=="string")return o;if(Array.isArray(o)){let s=e(i),u=[];return o.forEach(l=>{if(l.type==="text"||l.type==="image_url")u.push(a(l,s));else throw new Error('Mistral only supports types "text" or "image_url" for complex message types.')}),u}throw new Error(`Message content must be a string or an array.
Received: ${JSON.stringify(o,null,2)}`)},n=o=>{if(Ki(o)&&o.tool_calls?.length)return o.tool_calls.map(i=>({...i,id:nVe(i.id??"")})).map(uO)};return t.map(o=>{let i=n(o),a=r(o.content,o.getType());return"tool_call_id"in o&&typeof o.tool_call_id=="string"?{role:e(o.getType()),content:a,name:o.name,toolCallId:nVe(o.tool_call_id)}:Ki(o)?i===void 0?{role:e(o.getType()),content:a}:{role:e(o.getType()),toolCalls:i}:{role:e(o.getType()),content:a}})}function iBn(t,e){let{message:r}=t;if(r===void 0)throw new Error("No message found in response");let n=[];"toolCalls"in r&&Array.isArray(r.toolCalls)&&(n=r.toolCalls);let o=oVe(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=oh(s,{returnId:!0});i.push({...u,id:u.id??eme().replace(/-/g,"")})}catch(u){a.push(ih(s,u.message))}return new Ln({content:o,tool_calls:i,invalid_tool_calls:a,additional_kwargs:{},usage_metadata:e?{input_tokens:e.promptTokens,output_tokens:e.completionTokens,total_tokens:e.totalTokens}:void 0})}default:return new eu({content:o})}}function aBn(t,e){if(!t.content&&!t.toolCalls)return e?new vr({content:"",usage_metadata:e?{input_tokens:e.promptTokens,output_tokens:e.completionTokens,total_tokens:e.totalTokens}:void 0}):null;let r=t.toolCalls?.length?t.toolCalls?.map((s,u)=>({...s,index:u,id:s.id??eme().replace(/-/g,""),type:"function"})):void 0,n="assistant";t.role&&(n=t.role);let o=oVe(t.content),i,a=[];if(r!==void 0)for(let s of r){let u=s.function?.arguments,l=u===void 0||typeof u=="string"?u:JSON.stringify(u);a.push({name:s.function?.name,args:l,id:s.id,index:s.index,type:"tool_call_chunk"})}else i={};return n==="user"?new Pp({content:o}):n==="assistant"?new vr({content:o,tool_call_chunks:a,additional_kwargs:i,usage_metadata:e?{input_tokens:e.promptTokens,output_tokens:e.completionTokens,total_tokens:e.totalTokens}:void 0}):n==="tool"?new Wg({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new Ih({content:o,additional_kwargs:i}):new Ep({content:o,role:n})}function cer(t){return t.map(e=>{if("function"in e)return e;let r=e.description??`Tool: ${e.name}`;return{type:"function",function:{name:e.name,description:r,parameters:ss(e.schema)}}})}function der(t){return typeof t?.parse=="function"}var fer,per,iye,mer=b(()=>{rWt();fer=j(ser(),1),per=j(LJ(),1);Bs();GC();Qf();rVe();no();$b();Q2();Im();Gg();uer();iye=class extends Au{static lc_name(){return"ChatMistralAI"}constructor(e){super(e??{}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","mistralai"]}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"mistral-small-latest"}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endpoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serverURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:.7}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"safeMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"safePrompt",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"randomSeed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"seed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"beforeRequestHooks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requestErrorHooks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"responseHooks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"httpClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numCompletions",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let r=e?.apiKey??lt("MISTRAL_API_KEY");if(!r)throw new Error("API key MISTRAL_API_KEY is missing for MistralAI, but it is required.");this.apiKey=r,this.streaming=e?.streaming??this.streaming,this.serverURL=e?.serverURL??this.serverURL,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.maxTokens=e?.maxTokens??this.maxTokens,this.safePrompt=e?.safePrompt??this.safePrompt,this.randomSeed=e?.seed??e?.randomSeed??this.seed,this.seed=this.randomSeed,this.maxRetries=e?.maxRetries,this.httpClient=e?.httpClient,this.model=e?.model??e?.modelName??this.model,this.streamUsage=e?.streamUsage??this.streamUsage,this.beforeRequestHooks=e?.beforeRequestHooks??this.beforeRequestHooks,this.requestErrorHooks=e?.requestErrorHooks??this.requestErrorHooks,this.responseHooks=e?.responseHooks??this.responseHooks,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.numCompletions=e?.numCompletions??this.numCompletions,this.addAllHooksToHttpClient()}get lc_secrets(){return{apiKey:"MISTRAL_API_KEY"}}get lc_aliases(){return{apiKey:"mistral_api_key"}}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"mistral",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.maxTokens??void 0}}_llmType(){return"mistral_ai"}invocationParams(e){let{response_format:r,tools:n,tool_choice:o}=e??{},i=n?.length?cer(n):void 0;return{model:this.model,tools:i,temperature:this.temperature,maxTokens:this.maxTokens,topP:this.topP,randomSeed:this.seed,safePrompt:this.safePrompt,toolChoice:o,responseFormat:r,presencePenalty:this.presencePenalty,frequencyPenalty:this.frequencyPenalty,n:this.numCompletions}}bindTools(e,r){return this.bind({tools:cer(e),...r})}async completionWithRetry(e,r){let n=new Mh({maxRetries:this.maxRetries}),o=new fer.Mistral({apiKey:this.apiKey,serverURL:this.serverURL,...this.httpClient?{httpClient:this.httpClient}:{}});return n.call(async()=>{try{let i;return r?i=await o.chat.stream(e):i=await o.chat.complete(e),i}catch(i){throw(i.message?.includes("status: 400")||i.message?.toLowerCase().includes("status 400")||i.message?.includes("validation failed"))&&(i.status=400),i}})}async _generate(e,r,n){let o={},i=this.invocationParams(r),a=ler(e),s={...i,messages:a},u=r.signal??!!r.timeout;if(this.streaming||u){let m=this._streamResponseChunks(e,r,n),h={};for await(let g of m){let _=g.generationInfo?.completion??0;h[_]===void 0?h[_]=g:h[_]=h[_].concat(g)}return{generations:Object.entries(h).sort(([g],[_])=>parseInt(g,10)-parseInt(_,10)).map(([g,_])=>_),llmOutput:{estimatedTokenUsage:o}}}let l=await this.completionWithRetry(s,!1),{completionTokens:c,promptTokens:d,totalTokens:f}=l?.usage??{};c&&(o.completionTokens=(o.completionTokens??0)+c),d&&(o.promptTokens=(o.promptTokens??0)+d),f&&(o.totalTokens=(o.totalTokens??0)+f);let p=[];for(let m of l?.choices??[]){if("delta"in m)throw new Error("Delta not supported in non-streaming mode.");if(!("message"in m))throw new Error("No message found in the choice.");let h=m.message?.content??"";Array.isArray(h)&&(h=h[0].type==="text"?h[0].text:"");let y={text:h,message:iBn(m,l?.usage)};m.finishReason&&(y.generationInfo={finishReason:m.finishReason}),p.push(y)}return{generations:p,llmOutput:{tokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=ler(e),a={...this.invocationParams(r),messages:o},s=await this.completionWithRetry(a,!0);for await(let{data:u}of s){if(r.signal?.aborted)throw new Error("AbortError");let l=u?.choices[0];if(!l||!("delta"in l))continue;let{delta:c}=l;if(!c)continue;let d={prompt:0,completion:l.index??0},f=this.streamUsage||r.streamUsage,p=aBn(c,f?u.usage:null);if(p===null)continue;let m=c.content??"";Array.isArray(m)&&(m=m[0].type==="text"?m[0].text:"");let h=new co({message:p,text:m,generationInfo:d});yield h,n?.handleLLMNewToken(h.text??"",d,void 0,void 0,void 0,{chunk:h})}}addAllHooksToHttpClient(){try{if(this.removeAllHooksFromHttpClient(),[this.beforeRequestHooks,this.requestErrorHooks,this.responseHooks].some(r=>r&&r.length>0)&&!this.httpClient&&(this.httpClient=new per.HTTPClient),this.beforeRequestHooks)for(let r of this.beforeRequestHooks)this.httpClient?.addHook("beforeRequest",r);if(this.requestErrorHooks)for(let r of this.requestErrorHooks)this.httpClient?.addHook("requestError",r);if(this.responseHooks)for(let r of this.responseHooks)this.httpClient?.addHook("response",r)}catch{throw new Error("Error in adding all hooks")}}removeAllHooksFromHttpClient(){try{if(this.beforeRequestHooks)for(let e of this.beforeRequestHooks)this.httpClient?.removeHook("beforeRequest",e);if(this.requestErrorHooks)for(let e of this.requestErrorHooks)this.httpClient?.removeHook("requestError",e);if(this.responseHooks)for(let e of this.responseHooks)this.httpClient?.removeHook("response",e)}catch{throw new Error("Error in removing hooks")}}removeHookFromHttpClient(e){try{this.httpClient?.removeHook("beforeRequest",e),this.httpClient?.removeHook("requestError",e),this.httpClient?.removeHook("response",e)}catch{throw new Error("Error in removing hook")}}_combineLLMOutput(){return[]}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw,s,u;if(i==="jsonMode")s=this.bind({response_format:{type:"json_object"}}),der(n)?u=Sd.fromZodSchema(n):u=new Cd;else{let f=o??"extract";if(der(n)){let p=ss(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:"any"}),u=new Hd({returnSingle:!0,keyName:f,zodSchema:n})}else{let p;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(p=n,f=n.name):p={name:f,description:n.description??"",parameters:n},s=this.bind({tools:[{type:"function",function:p}],tool_choice:"any"}),u=new Hd({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Fo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Fo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Fi.from([{raw:s},d])}}});var her=b(()=>{no();NP();Ry()});var ger=b(()=>{RL();Qf();no();Ry();rVe()});var yer=b(()=>{mer();her();ger()});var ber=b(()=>{yer()});function Vk(t){let{azureOpenAIApiDeploymentName:e,azureOpenAIApiInstanceName:r,azureOpenAIApiKey:n,azureOpenAIBasePath:o,baseURL:i,azureADTokenProvider:a,azureOpenAIEndpoint:s}=t;if((n||a)&&o&&e)return`${o}/${e}`;if((n||a)&&s&&e)return`${s}/openai/deployments/${e}`;if(n||a){if(!r)throw new Error("azureOpenAIApiInstanceName is required when using azureOpenAIApiKey");if(!e)throw new Error("azureOpenAIApiDeploymentName is a required parameter when using azureOpenAIApiKey");return`https://${r}.openai.azure.com/openai/deployments/${e}`}return i}var w1=b(()=>{});function p7(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var _er=b(()=>{});function Wk(t){let e;return t.constructor.name===pg.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Ra.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=p7(t,"INVALID_TOOL_RESULTS"):t.status===401?e=p7(t,"MODEL_AUTHENTICATION"):t.status===429?e=p7(t,"MODEL_RATE_LIMIT"):t.status===404?e=p7(t,"MODEL_NOT_FOUND"):e=t,e}function iVe(t){if(t)return t==="any"||t==="required"?"required":t==="auto"?"auto":t==="none"?"none":typeof t=="string"?{type:"function",function:{name:t}}:t}var fH=b(()=>{ok();Gg();sg();_er()});function sBn(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function ver(t){let e=["namespace functions {",""];for(let r of t)r.description&&e.push(`// ${r.description}`),Object.keys(r.parameters.properties??{}).length>0?(e.push(`type ${r.name} = (_: {`),e.push(wer(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function wer(t,e){let r=[];for(let[n,o]of Object.entries(t.properties??{}))o.description&&e<2&&r.push(`// ${o.description}`),t.required?.includes(n)?r.push(`${n}: ${aye(o,e)},`):r.push(`${n}?: ${aye(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function aye(t,e){if(sBn(t))return t.anyOf.map(r=>aye(r,e)).join(" | ");switch(t.type){case"string":return t.enum?t.enum.map(r=>`"${r}"`).join(" | "):"string";case"number":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"integer":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"boolean":return"boolean";case"null":return"null";case"object":return["{",wer(t,e+2),"}"].join(`
`);case"array":return t.items?`${aye(t.items,e)}[]`:"any[]";default:return""}}var xer=b(()=>{});function Ser(t,e){let r;if(Kc(t)){let n=Lpe({name:t.name,parameters:t.schema,description:t.description});n.function.parameters?r={type:n.type,function:{name:n.function.name,description:n.function.description,parameters:n.function.parameters,...e?.strict!==void 0?{strict:e.strict}:{}}}:r={type:"function",function:WM(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}var Cer=b(()=>{sg();wJ()});function uBn(t){return t.role!=="system"&&t.role!=="developer"&&t.role!=="assistant"&&t.role!=="user"&&t.role!=="function"&&t.role!=="tool"&&console.warn(`Unknown message role: ${t.role}`),t.role}function uVe(t){let e=t._getType();switch(e){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";case"generic":{if(!Qs.isInstance(t))throw new Error("Invalid generic chat message");return uBn(t)}default:throw new Error(`Unknown message type: ${e}`)}}function sVe(t,e){return t.flatMap(r=>{let n=uVe(r);n==="system"&&lVe(e)&&(n="developer");let o={role:n,content:r.content};if(r.name!=null&&(o.name=r.name),r.additional_kwargs.function_call!=null&&(o.function_call=r.additional_kwargs.function_call,o.content=""),Ki(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(uO),o.content=""):(r.additional_kwargs.tool_calls!=null&&(o.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(o.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let i={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[o,i]}return o})}function Oer(t,e){return t.flatMap(r=>{let n=uVe(r);if(n==="system"&&lVe(e)&&(n="developer"),n==="function")throw new Error("Function messages are not supported in Responses API");if(n==="tool"){let o=r;return o.additional_kwargs?.type==="computer_call_output"?{type:"computer_call_output",output:(()=>{if(typeof o.content=="string")return{type:"computer_screenshot",image_url:o.content};if(Array.isArray(o.content)){let a=o.content.find(u=>u.type==="computer_screenshot");if(a)return a;let s=o.content.find(u=>u.type==="image_url");if(s)return{type:"computer_screenshot",image_url:typeof s.image_url=="string"?s.image_url:s.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:o.tool_call_id}:{type:"function_call_output",call_id:o.tool_call_id,id:o.id,output:typeof o.content!="string"?JSON.stringify(o.content):o.content}}if(n==="assistant"){let o=[];r.additional_kwargs.reasoning!=null&&(u=>typeof u=="object"&&u!=null&&"type"in u&&u.type==="reasoning")(r.additional_kwargs.reasoning)&&o.push(r.additional_kwargs.reasoning);let{content:i}=r;r.additional_kwargs.refusal!=null&&(typeof i=="string"&&(i=[{type:"output_text",text:i,annotations:[]}]),i=[...i,{type:"refusal",refusal:r.additional_kwargs.refusal}]),o.push({type:"message",role:"assistant",content:typeof i=="string"?i:i.flatMap(s=>s.type==="text"?{type:"output_text",text:s.text,annotations:s.annotations??[]}:s.type==="output_text"||s.type==="refusal"?s:[])});let a=r.additional_kwargs[pH];if(Ki(r)&&r.tool_calls?.length?o.push(...r.tool_calls.map(s=>({type:"function_call",name:s.name,arguments:JSON.stringify(s.args),call_id:s.id,id:a?.[s.id]}))):r.additional_kwargs.tool_calls!=null&&o.push(...r.additional_kwargs.tool_calls.map(s=>({type:"function_call",name:s.function.name,call_id:s.id,id:a?.[s.id],arguments:s.function.arguments}))),r.additional_kwargs.tool_outputs!=null){let u=r.additional_kwargs.tool_outputs?.filter(l=>l.type==="computer_call");u.length>0&&o.push(...u)}return o}return n==="user"?{type:"message",role:"user",content:typeof r.content=="string"?r.content:r.content.flatMap(o=>{if(o.type==="text")return{type:"input_text",text:o.text};if(o.type==="image_url"){let i=typeof o.image_url=="string"?o.image_url:o.image_url.url,a=typeof o.image_url=="string"?"auto":o.image_url.detail;return{type:"input_image",image_url:i,detail:a}}return o.type==="input_text"||o.type==="input_image"||o.type==="input_file"?o:[]})}:[]})}function Per(t){if(t.error){let a=new Error(t.error.message);throw a.name=t.error.code,a}let e=[],r=[],n=[],o={model:t.model,created_at:t.created_at,id:t.id,incomplete_details:t.incomplete_details,metadata:t.metadata,object:t.object,status:t.status,user:t.user,model_name:t.model},i={};for(let a of t.output)if(a.type==="message")e.push(...a.content.flatMap(s=>s.type==="output_text"?("parsed"in s&&s.parsed!=null&&(i.parsed=s.parsed),{type:"text",text:s.text,annotations:s.annotations}):s.type==="refusal"?(i.refusal=s.refusal,[]):s));else if(a.type==="function_call"){let s={function:{name:a.name,arguments:a.arguments},id:a.call_id};try{r.push(oh(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(ih(s,l))}i[pH]??(i[pH]={}),i[pH][a.call_id]=a.id}else a.type==="reasoning"?i.reasoning=a:(i.tool_outputs??(i.tool_outputs=[]),i.tool_outputs.push(a));return new Ln({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function lBn(t){let e=[],r={},n,o=[],i={},a={},s;if(t.type==="response.output_text.delta")e.push({type:"text",text:t.delta,index:t.content_index});else if(t.type==="response.output_text.annotation.added")e.push({type:"text",text:"",annotations:[t.annotation],index:t.content_index});else if(t.type==="response.output_item.added"&&t.item.type==="message")s=t.item.id;else if(t.type==="response.output_item.added"&&t.item.type==="function_call")o.push({type:"tool_call_chunk",name:t.item.name,args:t.item.arguments,id:t.item.id,index:t.output_index}),a[pH]={[t.item.call_id]:t.item.id};else if(t.type==="response.output_item.done"&&(t.item.type==="web_search_call"||t.item.type==="file_search_call"||t.item.type==="computer_call"))a.tool_outputs=[t.item];else if(t.type==="response.created")i.id=t.response.id,i.model_name=t.response.model,i.model=t.response.model;else if(t.type==="response.completed"){let u=Per(t.response);n=t.response.usage,t.response.text?.format?.type==="json_schema"&&(a.parsed??(a.parsed=JSON.parse(u.text)));for(let[l,c]of Object.entries(t.response))l!=="id"&&(i[l]=c)}else if(t.type==="response.function_call_arguments.delta")o.push({type:"tool_call_chunk",args:t.delta,index:t.output_index});else if(t.type==="response.web_search_call.completed"||t.type==="response.file_search_call.completed")r={tool_outputs:{id:t.item_id,type:t.type.replace("response.","").replace(".completed",""),status:"completed"}};else if(t.type==="response.refusal.done")a.refusal=t.refusal;else return null;return new co({text:e.map(u=>u.text).join(""),message:new vr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function aVe(t){return"type"in t&&t.type!=="function"}function cBn(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function Eer(t,e){return $d(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:Ser(t,e)}function lVe(t){return t?.startsWith("o1")||t?.startsWith("o3")}function sye(t){return typeof t?.parse=="function"}function dBn(t){return t!==void 0&&typeof t.schema=="object"}var pH,m7,uye=b(()=>{ok();Bs();Qf();no();GC();ag();Im();$b();Q2();Gg();wJ();w1();fH();xer();Cer();pH="__openai_function_call_ids__";m7=class extends Au{static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning_effort"]}get lc_secrets(){return{openAIApiKey:"OPENAI_API_KEY",apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{modelName:"model",openAIApiKey:"openai_api_key",apiKey:"openai_api_key"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","reasoningEffort","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","modelName","model","modelKwargs","stop","stopSequences","timeout","openAIApiKey","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming"]}constructor(e){super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"logitBias",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gpt-3.5-turbo"}),Object.defineProperty(this,"modelKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topLogprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"openAIApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__includeRawResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportsStrictToolCalling",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"audio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modalities",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reasoningEffort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useResponsesApi",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.openAIApiKey=e?.apiKey??e?.openAIApiKey??e?.configuration?.apiKey??lt("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??lt("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelName=this.model,this.modelKwargs=e?.modelKwargs??{},this.timeout=e?.timeout,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.logprobs=e?.logprobs,this.topLogprobs=e?.topLogprobs,this.n=e?.n??this.n,this.logitBias=e?.logitBias,this.stop=e?.stopSequences??e?.stop,this.stopSequences=this.stop,this.user=e?.user,this.__includeRawResponse=e?.__includeRawResponse,this.audio=e?.audio,this.modalities=e?.modalities,this.reasoningEffort=e?.reasoningEffort,this.maxTokens=e?.maxCompletionTokens??e?.maxTokens,this.useResponsesApi=e?.useResponsesApi??this.useResponsesApi,this.model==="o1"&&(this.disableStreaming=!0),this.streaming=e?.streaming??!1,this.streamUsage=e?.streamUsage??this.streamUsage,this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration},e?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=e.supportsStrictToolCalling)}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.bind({tools:e.map(o=>aVe(o)?o:Eer(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&sye(e.json_schema.schema)?Dpe(e.json_schema.schema,e.json_schema.name,{description:e.json_schema.description}):e}invocationParams(e,r){let n;if(e?.strict!==void 0?n=e.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this._useResponseApi(e)){let s={model:this.model,temperature:this.temperature,top_p:this.topP,user:this.user,stream:this.streaming,previous_response_id:e?.previous_response_id,truncation:e?.truncation,include:e?.include,tools:e?.tools?.length?e.tools.map(l=>aVe(l)?l:$d(l)?{type:"function",name:l.function.name,parameters:l.function.parameters,description:l.function.description,strict:n}:null).filter(l=>l!==null):void 0,tool_choice:cBn(e?.tool_choice)?e?.tool_choice:(()=>{let l=iVe(e?.tool_choice);if(typeof l=="object"&&"type"in l)return{type:"function",name:l.function.name}})(),text:(()=>{if(e?.text)return e.text;let l=this.createResponseFormat(e?.response_format);return l?.type==="json_schema"?l.json_schema.schema!=null?{format:{type:"json_schema",schema:l.json_schema.schema,description:l.json_schema.description,name:l.json_schema.name,strict:l.json_schema.strict}}:void 0:{format:l}})(),parallel_tool_calls:e?.parallel_tool_calls,max_output_tokens:this.maxTokens===-1?void 0:this.maxTokens,...this.modelKwargs},u=e?.reasoning_effort??this.reasoningEffort;return u!==void 0&&(s.reasoning={effort:u}),s}let o={};e?.stream_options!==void 0?o={stream_options:e.stream_options}:this.streamUsage&&(this.streaming||r?.streaming)&&(o={stream_options:{include_usage:!0}});let i={model:this.model,temperature:this.temperature,top_p:this.topP,frequency_penalty:this.frequencyPenalty,presence_penalty:this.presencePenalty,logprobs:this.logprobs,top_logprobs:this.topLogprobs,n:this.n,logit_bias:this.logitBias,stop:e?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:e?.functions,function_call:e?.function_call,tools:e?.tools?.length?e.tools.map(s=>Eer(s,{strict:n})):void 0,tool_choice:iVe(e?.tool_choice),response_format:this.createResponseFormat(e?.response_format),seed:e?.seed,...o,parallel_tool_calls:e?.parallel_tool_calls,...this.audio||e?.audio?{audio:this.audio||e?.audio}:{},...this.modalities||e?.modalities?{modalities:this.modalities||e?.modalities}:{},...this.modelKwargs};e?.prediction!==void 0&&(i.prediction=e.prediction);let a=e?.reasoning_effort??this.reasoningEffort;return a!==void 0&&(i.reasoning_effort=a),lVe(i.model)?i.max_completion_tokens=this.maxTokens===-1?void 0:this.maxTokens:i.max_tokens=this.maxTokens===-1?void 0:this.maxTokens,i}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=e.tool_calls;switch(e.role){case"assistant":{let o=[],i=[];for(let u of n??[])try{o.push(oh(u,{returnId:!0}))}catch(l){i.push(ih(u,l.message))}let a={function_call:e.function_call,tool_calls:n};this.__includeRawResponse!==void 0&&(a.__raw_response=r);let s={model_name:r.model,...r.system_fingerprint?{usage:{...r.usage},system_fingerprint:r.system_fingerprint}:{}};return e.audio&&(a.audio=e.audio),new Ln({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Qs(e.content||"",e.role??"unknown")}}_convertOpenAIDeltaToBaseMessageChunk(e,r,n){let o=e.role??n,i=e.content??"",a;e.function_call?a={function_call:e.function_call}:e.tool_calls?a={tool_calls:e.tool_calls}:a={},this.__includeRawResponse&&(a.__raw_response=r),e.audio&&(a.audio={...e.audio,index:r.choices[0].index});let s={usage:{...r.usage}};if(o==="user")return new Pp({content:i,response_metadata:s});if(o==="assistant"){let u=[];if(Array.isArray(e.tool_calls))for(let l of e.tool_calls)u.push({name:l.function?.name,args:l.function?.arguments,id:l.id,index:l.index,type:"tool_call_chunk"});return new vr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Pf({content:i,response_metadata:s}):o==="developer"?new Pf({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Ih({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Wg({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new Ep({content:i,role:o,response_metadata:s})}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}async*_streamResponseChunks(e,r,n){if(this._useResponseApi(r)){let l=await this.responseApiWithRetry({...this.invocationParams(r,{streaming:!0}),input:Oer(e,this.model),stream:!0},r);for await(let c of l){let d=lBn(c);d!=null&&(yield d)}return}let o=sVe(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new co({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new co({message:new vr({content:"",response_metadata:{usage:{...u}},usage_metadata:{input_tokens:u.prompt_tokens,output_tokens:u.completion_tokens,total_tokens:u.total_tokens,...Object.keys(l).length>0&&{input_token_details:l},...Object.keys(c).length>0&&{output_token_details:c}}}),text:""})}if(r.signal?.aborted)throw new Error("AbortError")}identifyingParams(){return this._identifyingParams()}async _responseApiGenerate(e,r,n){let o=this.invocationParams(r);if(o.stream){let s=this._streamResponseChunks(e,r,n),u;for await(let l of s)l.message.response_metadata={...l.generationInfo,...l.message.response_metadata},u=u?.concat(l)??l;return{generations:u?[u]:[],llmOutput:{estimatedTokenUsage:u?.message?.usage_metadata}}}let i=Oer(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:Per(a)}],llmOutput:{id:a.id,estimatedTokenUsage:a.usage?{promptTokens:a.usage.input_tokens,completionTokens:a.usage.output_tokens,totalTokens:a.usage.total_tokens}:void 0}}}_useResponseApi(e){let r=e?.tools?.some(aVe),n=e?.previous_response_id!=null||e?.text!=null||e?.truncation!=null||e?.include!=null;return this.useResponsesApi||r||n}async _generate(e,r,n){if(this._useResponseApi(r))return this._responseApiGenerate(e,r,n);let o={},i=this.invocationParams(r),a=sVe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let y={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};y.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},Ki(y.message)&&(y.message.usage_metadata=o),y.message=new Ln(Object.fromEntries(Object.entries(y.message).filter(([g])=>!g.startsWith("lc_")))),p.push(y)}return{generations:p,llmOutput:{tokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}}async getEstimatedTokenCountFromPrompt(e,r,n){let o=(await this.getNumTokensFromMessages(e)).totalCount;if(r&&n!=="auto"){let i=ver(r);o+=await this.getNumTokens(i),o+=9}return r&&e.find(i=>i._getType()==="system")&&(o-=4),n==="none"?o+=1:typeof n=="object"&&(o+=await this.getNumTokens(n.name)+4),o}async getNumTokensFromGenerations(e){return(await Promise.all(e.map(async n=>n.message.additional_kwargs?.function_call?(await this.getNumTokensFromMessages([n.message])).countPerMessage[0]:await this.getNumTokens(n.message.content)))).reduce((n,o)=>n+o,0)}async getNumTokensFromMessages(e){let r=0,n=0,o=0;this.model==="gpt-3.5-turbo-0301"?(n=4,o=-1):(n=3,o=1);let i=await Promise.all(e.map(async a=>{let s=await this.getNumTokens(a.content),u=await this.getNumTokens(uVe(a)),l=a.name!==void 0?o+await this.getNumTokens(a.name):0,c=s+n+u+l,d=a;if(d._getType()==="function"&&(c-=2),d.additional_kwargs?.function_call&&(c+=3),d?.additional_kwargs.function_call?.name&&(c+=await this.getNumTokens(d.additional_kwargs.function_call?.name)),d.additional_kwargs.function_call?.arguments)try{c+=await this.getNumTokens(JSON.stringify(JSON.parse(d.additional_kwargs.function_call?.arguments)))}catch(f){console.error("Error parsing function arguments",f,JSON.stringify(d.additional_kwargs.function_call)),c+=await this.getNumTokens(d.additional_kwargs.function_call?.arguments)}return r+=c,c}));return r+=3,{totalCount:r,countPerMessage:i}}async completionWithRetry(e,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.chat.completions.create(e,n)}catch(o){throw Wk(o)}})}async responseApiWithRetry(e,r){return this.caller.call(async()=>{let n=this._getClientOptions(r);try{return e.text?.format?.type==="json_schema"&&!e.stream?await this.client.responses.parse(e,n):await this.client.responses.create(e,n)}catch(o){throw Wk(o)}})}async betaParsedCompletionWithRetry(e,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.beta.chat.completions.parse(e,n)}catch(o){throw Wk(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=Vk(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Cr(i)}return{...this.clientConfig,...e}}_llmType(){return"openai"}_combineLLMOutput(...e){return e.reduce((r,n)=>(n&&n.tokenUsage&&(r.tokenUsage.completionTokens+=n.tokenUsage.completionTokens??0,r.tokenUsage.promptTokens+=n.tokenUsage.promptTokens??0,r.tokenUsage.totalTokens+=n.tokenUsage.totalTokens??0),r),{tokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}withStructuredOutput(e,r){let n,o,i,a;dBn(e)?(n=e.schema,o=e.name,i=e.method,a=e.includeRaw):(n=e,o=r?.name,i=r?.method,a=r?.includeRaw);let s,u;if(r?.strict!==void 0&&i==="jsonMode")throw new Error("Argument `strict` is only supported for `method` = 'function_calling'");if(!this.model.startsWith("gpt-3")&&!this.model.startsWith("gpt-4-")&&this.model!=="gpt-4"?i===void 0&&(i="jsonSchema"):i==="jsonSchema"&&console.warn(`[WARNING]: JSON Schema is not supported for model "${this.model}". Falling back to tool calling.`),i==="jsonMode")s=this.bind({response_format:{type:"json_object"}}),sye(n)?u=Sd.fromZodSchema(n):u=new Cd;else if(i==="jsonSchema")if(s=this.bind({response_format:{type:"json_schema",json_schema:{name:o??"extract",description:n.description,schema:n,strict:r?.strict}}}),sye(n)){let f=Sd.fromZodSchema(n);u=Mp.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Cd;else{let f=o??"extract";if(sye(n)){let p=ss(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:f}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new Hd({returnSingle:!0,keyName:f,zodSchema:n})}else{let p;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(p=n,f=n.name):(f=n.title??f,p={name:f,description:n.description??"",parameters:n}),s=this.bind({tools:[{type:"function",function:p}],tool_choice:{type:"function",function:{name:f}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new Hd({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Fo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Fo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Fi.from([{raw:s},d])}}});var Ter=b(()=>{no();uye();w1()});var cVe=b(()=>{ag();Qf();no();RL();Ry();w1();fH()});var Aer=b(()=>{no();cVe();w1()});var dVe=b(()=>{no();NP();Ry();w1();fH()});var Ier=b(()=>{no();dVe();w1();fH()});var Mer=b(()=>{});var fVe,Rer=b(()=>{no();ok();tG();fVe=class extends dR{static lc_name(){return"DallEAPIWrapper"}constructor(e){e?.responseFormat!==void 0&&["url","b64_json"].includes(e.responseFormat)&&(e.dallEResponseFormat=e.responseFormat,e.responseFormat="content"),super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:"A wrapper around OpenAI DALL-E API. Useful for when you need to generate images from a text description. Input should be an image description."}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"dall-e-3"}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:"vivid"}),Object.defineProperty(this,"quality",{enumerable:!0,configurable:!0,writable:!0,value:"standard"}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:"1024x1024"}),Object.defineProperty(this,"dallEResponseFormat",{enumerable:!0,configurable:!0,writable:!0,value:"url"}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let r=e?.apiKey??e?.openAIApiKey??lt("OPENAI_API_KEY"),n=e?.organization??lt("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new Cr(o),this.model=e?.model??e?.modelName??this.model,this.style=e?.style??this.style,this.quality=e?.quality??this.quality,this.n=e?.n??this.n,this.size=e?.size??this.size,this.dallEResponseFormat=e?.dallEResponseFormat??this.dallEResponseFormat,this.user=e?.user}processMultipleGeneratedUrls(e){return this.dallEResponseFormat==="url"?e.flatMap(r=>r.data.flatMap(o=>o.url?{type:"image_url",image_url:o.url}:[]).filter(o=>o!==void 0&&o.type==="image_url"&&typeof o.image_url=="string"&&o.image_url!==void 0)):e.flatMap(r=>r.data.flatMap(o=>o.b64_json?{type:"image_url",image_url:{url:o.b64_json}}:[]).filter(o=>o!==void 0&&o.type==="image_url"&&typeof o.image_url=="object"&&"url"in o.image_url&&typeof o.image_url.url=="string"&&o.image_url.url!==void 0))}async _call(e){let r={model:this.model,prompt:e,n:1,size:this.size,response_format:this.dallEResponseFormat,style:this.style,quality:this.quality,user:this.user};if(this.n>1){let i=await Promise.all(Array.from({length:this.n}).map(()=>this.client.images.generate(r)));return this.processMultipleGeneratedUrls(i)}let n=await this.client.images.generate(r),o="";return this.dallEResponseFormat==="url"?[o]=n.data.map(i=>i.url).filter(i=>i!=="undefined"):[o]=n.data.map(i=>i.b64_json).filter(i=>i!=="undefined"),o}};Object.defineProperty(fVe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"})});var Ner=b(()=>{Rer()});var jer=b(()=>{uye()});var Der=b(()=>{uye();Ter();cVe();Aer();Ier();dVe();Mer();fH();w1();Ner();jer()});var Ler=b(()=>{Der()});var lye,Fer=b(()=>{no();Ler();lye=class extends m7{static lc_name(){return"ChatXAI"}_llmType(){return"xai"}get lc_secrets(){return{apiKey:"XAI_API_KEY"}}constructor(e){let r=e?.apiKey||lt("XAI_API_KEY");if(!r)throw new Error('xAI API key not found. Please set the XAI_API_KEY environment variable or provide the key into "apiKey" field.');super({...e,model:e?.model||"grok-beta",apiKey:r,configuration:{baseURL:"https://api.x.ai/v1"}}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","xai"]})}toJSON(){let e=super.toJSON();return"kwargs"in e&&typeof e.kwargs=="object"&&e.kwargs!=null&&(delete e.kwargs.openai_api_key,delete e.kwargs.configuration),e}getLsParams(e){let r=super.getLsParams(e);return r.ls_provider="xai",r}async completionWithRetry(e,r){delete e.frequency_penalty,delete e.presence_penalty,delete e.logit_bias,delete e.functions;let n=e.messages.map(i=>i.content?i:{...i,content:""}),o={...e,messages:n};return o.stream===!0?super.completionWithRetry(o,r):super.completionWithRetry(o,r)}_convertOpenAIDeltaToBaseMessageChunk(e,r,n){let o=super._convertOpenAIDeltaToBaseMessageChunk(e,r,n);return r.choices[0]?.finish_reason?o.usage_metadata=o.response_metadata.usage:(delete o.response_metadata.usage,delete o.usage_metadata),o}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=super._convertOpenAIChatCompletionMessageToBaseMessage(e,r);return n.additional_kwargs.reasoning_content=e.reasoning_content,n}withStructuredOutput(e,r){let n={...r};return n?.method===void 0&&(n.method="functionCalling"),super.withStructuredOutput(e,n)}}});var ker=b(()=>{Fer()});var $er=b(()=>{ker()});var Ber={};as(Ber,{default:()=>x1});var cye,fBn,sd,x1,dye=b(()=>{la();er();qj();$t();_t();kt();OK();ZVt();EFe();m5t();NFe();Z5t();ber();KFe();Ace();$er();cye=require("obsidian"),fBn={openai:lO,"azure openai":lO,anthropic:Gfe,cohereai:yle,google:Cle,xai:lye,openrouterai:lO,ollama:Ale,"lm-studio":lO,groq:Ype,"3rd party (openai-format)":lO,"copilot-plus":lO,mistralai:iye,deepseek:Bpe},sd=class sd{constructor(){this.providerApiKeyMap={openai:()=>ne().openAIApiKey,google:()=>ne().googleApiKey,"azure openai":()=>ne().azureOpenAIApiKey,anthropic:()=>ne().anthropicApiKey,cohereai:()=>ne().cohereApiKey,openrouterai:()=>ne().openRouterAiApiKey,groq:()=>ne().groqApiKey,xai:()=>ne().xaiApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key","copilot-plus":()=>ne().plusLicenseKey,mistralai:()=>ne().mistralApiKey,deepseek:()=>ne().deepseekApiKey};this.buildModelMap(),oa(()=>{this.buildModelMap(),this.validateCurrentModel()})}static getInstance(){return sd.instance||(sd.instance=new sd),sd.instance}getTemperatureForModel(e,r,n){if(!e.isThinkingEnabled)return e.isOSeries||e.isGPT5?sd.REASONING_MODEL_TEMPERATURE:r.temperature??n.temperature}async getModelConfig(e){let r=ne(),n=e.name,o=az(n),{isThinkingEnabled:i}=o,a={modelName:n,streaming:e.stream??!0,maxRetries:3,maxConcurrency:3,enableCors:e.enableCors,...!i&&{temperature:e.temperature??r.temperature}},u={openai:{modelName:n,apiKey:await Co(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?wu:void 0,organization:await Co(e.openAIOrgId||r.openAIOrgId)},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},anthropic:{anthropicApiKey:await Co(e.apiKey||r.anthropicApiKey),model:n,anthropicApiUrl:e.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:e.enableCors?wu:void 0},...i&&{thinking:{type:"enabled",budget_tokens:2048}}},"azure openai":{modelName:e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,apiKey:await Co(e.apiKey||r.azureOpenAIApiKey),configuration:{baseURL:e.baseUrl||`https://${e.azureOpenAIApiInstanceName||r.azureOpenAIApiInstanceName}.openai.azure.com/openai/deployments/${e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName}`,defaultQuery:{"api-version":e.azureOpenAIApiVersion||r.azureOpenAIApiVersion},defaultHeaders:{"Content-Type":"application/json","api-key":await Co(e.apiKey||r.azureOpenAIApiKey)},fetch:e.enableCors?wu:void 0},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},cohereai:{apiKey:await Co(e.apiKey||r.cohereApiKey),model:n},google:{apiKey:await Co(e.apiKey||r.googleApiKey),modelName:n,safetySettings:[{category:NL.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:jL.BLOCK_NONE},{category:NL.HARM_CATEGORY_HATE_SPEECH,threshold:jL.BLOCK_NONE},{category:NL.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:jL.BLOCK_NONE},{category:NL.HARM_CATEGORY_HARASSMENT,threshold:jL.BLOCK_NONE}],baseUrl:e.baseUrl},xai:{apiKey:await Co(e.apiKey||r.xaiApiKey),model:n},openrouterai:{modelName:n,apiKey:await Co(e.apiKey||r.openRouterAiApiKey),configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?wu:void 0,defaultHeaders:{"HTTP-Referer":"https://obsidiancopilot.com","X-Title":"Obsidian Copilot"}}},groq:{apiKey:await Co(e.apiKey||r.groqApiKey),modelName:n},ollama:{model:n,baseUrl:e.baseUrl||"http://localhost:11434",headers:new Headers({Authorization:`Bearer ${await Co(e.apiKey||"default-key")}`})},"lm-studio":{modelName:n,apiKey:e.apiKey||"default-key",configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?wu:void 0}},"3rd party (openai-format)":{modelName:n,apiKey:await Co(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?wu:void 0,defaultHeaders:{"dangerously-allow-browser":"true"}},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},"copilot-plus":{modelName:n,apiKey:await Co(r.plusLicenseKey),configuration:{baseURL:aI,fetch:e.enableCors?wu:void 0}},mistralai:{model:n,apiKey:await Co(e.apiKey||r.mistralApiKey),serverURL:e.baseUrl},deepseek:{modelName:n,apiKey:await Co(e.apiKey||r.deepseekApiKey),configuration:{baseURL:e.baseUrl||uz.deepseek.host,fetch:e.enableCors?wu:void 0}}}[e.provider]||{},l=this.getProviderSpecificParams(e.provider,e),c=i?{maxTokens:e.maxTokens??r.maxTokens}:{maxTokens:e.maxTokens??r.maxTokens};return{...a,...u,...l,...c}}getOpenAISpecialConfig(e,r,n,o){let i=ne(),a=az(e),s=this.getTemperatureForModel(a,o||{},i),u={maxTokens:r,temperature:s};if((a.isOSeries||a.isGPT5)&&o?.reasoningEffort&&(u.reasoning={effort:o.reasoningEffort},a.isGPT5&&o?.verbosity)){let l=o.verbosity;u.text={verbosity:l}}return u}getProviderSpecificParams(e,r){let n={};return r.topP!==void 0&&["openai","azure openai","anthropic","google","openrouterai","ollama","lm-studio","3rd party (openai-format)","mistralai","deepseek"].includes(e)&&(n.topP=r.topP),r.frequencyPenalty!==void 0&&["openai","azure openai","openrouterai","ollama","lm-studio","3rd party (openai-format)","mistralai","deepseek"].includes(e)&&(n.frequencyPenalty=r.frequencyPenalty),n}buildModelMap(){let e=ne().activeModels;sd.modelMap={};let r=sd.modelMap;(e??jv).forEach(o=>{if(o.enabled){if(!Object.values(RE).contains(o.provider)){console.warn(`Unknown provider: ${o.provider} for model: ${o.name}`);return}let i=this.getProviderConstructor(o),a=this.providerApiKeyMap[o.provider],s=o.apiKey||a(),u=Qr(o);r[u]={hasApiKey:!!(o.apiKey||s),AIConstructor:i,vendor:o.provider}}})}getProviderConstructor(e){let r=fBn[e.provider];if(!r)throw console.warn(`Unknown provider: ${e.provider} for model: ${e.name}`),new Error(`Unknown provider: ${e.provider} for model: ${e.name}`);return r}getChatModel(){if(!sd.chatModel)throw new Error("No valid chat model available. Please check your API key settings.");return sd.chatModel}async setChatModel(e){let r=Qr(e);try{let n=await this.createModelInstance(e);sd.chatModel=n,az(e.name).isGPT5&&(e.provider==="openai"||e.provider==="azure openai"||e.provider==="3rd party (openai-format)")&&B(`Chat model set with Responses API for GPT-5: ${e.name}`)}catch(n){ie(n),new cye.Notice(`Error creating model: ${r}`)}}async createModelInstance(e){let r=Qr(e),n=sd.modelMap[r];if(!n)throw new Error(`No model found for: ${r}`);if(!n.hasApiKey){let u=`API key is not provided for the model: ${r}.`;throw new cye.Notice(u),new Error(u)}let o=await this.getModelConfig(e),i=az(e.name),a={...o};return i.isGPT5&&(n.vendor==="openai"||n.vendor==="azure openai"||n.vendor==="3rd party (openai-format)")&&(a.useResponsesApi=!0,B(`Enabling Responses API for GPT-5 model: ${e.name} (${n.vendor})`)),new n.AIConstructor(a)}validateChatModel(e){return e!=null}estimateTokens(e){return e?Math.ceil(e.length/4):0}async countTokens(e){try{return await Od(async()=>sd.chatModel?.getNumTokens(e)??0)}catch(r){if(r instanceof Error&&r.message.includes("Unknown model"))return B("Using estimated token count due to tokenizer error"),this.estimateTokens(e);throw r}}validateCurrentModel(){if(!sd.chatModel)return;let e=Vee();if(!e)return;sd.modelMap[e]?.hasApiKey||(sd.chatModel=null,console.log("Failed to reinitialize model due to missing API key"))}async ping(e){let r=async n=>{let o={...e,enableCors:n},i=await this.getModelConfig(o),{streaming:a,maxTokens:s,maxCompletionTokens:u,...l}=i,c={maxTokens:30},d=az(e.name),f={...l,...c};d.isGPT5&&(e.provider==="openai"||e.provider==="azure openai"||e.provider==="3rd party (openai-format)")&&(f.useResponsesApi=!0),await new(this.getProviderConstructor(o))(f).invoke([{role:"user",content:"hello"}],{timeout:8e3})};try{return await r(!1),!0}catch(n){console.log("First ping attempt failed, trying with CORS...");try{return await r(!0),new cye.Notice("Connection successful, but requires CORS to be enabled. Please enable CORS for this model once you add it above."),!0}catch(o){let i=`
without CORS Error: `+Fn(n)+`
with CORS Error: `+Fn(o);throw new Error(i)}}}findModelByName(e){return ne().activeModels.find(n=>n.name===e)}};sd.REASONING_MODEL_TEMPERATURE=1;x1=sd});var fye={};as(fye,{TieredLexicalRetriever:()=>h7});async function pBn(){try{if(!pVe){let e=await Promise.resolve().then(()=>(dye(),Ber));pVe=()=>e.default.getInstance()}return pVe().getChatModel()}catch{return null}}var mVe,pVe,h7,g7=b(()=>{$t();_t();Yp();kt();hG();Fze();mVe=require("obsidian");Yde();rVt();pVe=null;h7=class extends C4{constructor(r,n){super();this.app=r;this.options=n;this.lc_namespace=["tiered_lexical_retriever"];this.searchCore=new bfe(r,pBn),typeof this.searchCore.getChunkManager=="function"?this.chunkManager=this.searchCore.getChunkManager():this.chunkManager=new xR(r)}async getRelevantDocuments(r,n){try{if(this.options.timeRange)return this.getTimeRangeDocuments(r);let o=Zg(r,this.app.vault),i=o.map(f=>f.basename),a=[...new Set([...this.options.salientTerms,...i])];ne().debug&&B("TieredLexicalRetriever: Starting search",{query:r,salientTerms:a,maxK:this.options.maxK});let s=ne(),u=await this.searchCore.retrieve(r,{maxResults:this.options.maxK,salientTerms:a,enableLexicalBoosts:s.enableLexicalBoosts}),l=await this.getTitleMatches(o),c=await this.convertToDocuments(u),d=this.combineResults(c,l);return ne().debug&&B("TieredLexicalRetriever: Search complete",{totalResults:d.length,titleMatches:l.length,searchResults:u.length}),d}catch(o){return Ft("TieredLexicalRetriever: Error during search",o),[]}}async getTimeRangeDocuments(r){if(!this.options.timeRange)return[];let{startTime:n,endTime:o}=this.options.timeRange,i=this.generateDailyNoteDateRange(n,o);ne().debug&&B("TieredLexicalRetriever: Generated daily note titles",{startTime:new Date(n).toISOString(),endTime:new Date(o).toISOString(),titlesCount:i.length,firstTitle:i[0],lastTitle:i[i.length-1]});let a=i.join(", "),s=Zg(a,this.app.vault).filter(h=>!g4(h)),l=(await this.getTitleMatches(s)).map(h=>(h.metadata.includeInContext=!0,h)),c=this.app.vault.getMarkdownFiles().filter(h=>!g4(h)),d=[],f=Math.min(this.options.maxK,100);for(let h of c)if(h.stat.mtime>=n&&h.stat.mtime<=o){if(s.some(y=>y.path===h.path))continue;if(d.length>=f)break;try{let y=await this.app.vault.cachedRead(h),g=this.app.metadataCache.getFileCache(h),_=(Date.now()-h.stat.mtime)/(1e3*60*60*24),w=Math.max(.3,Math.min(1,1-_/30));d.push(new sh({pageContent:y,metadata:{path:h.path,title:h.basename,mtime:h.stat.mtime,ctime:h.stat.ctime,tags:g?.tags?.map(S=>S.tag)||[],includeInContext:!0,score:w,rerank_score:w,source:"time-filtered"}}))}catch(y){Ft(`TieredLexicalRetriever: Failed to read file ${h.path}`,y)}}let p=new Map;for(let h of l)p.set(h.metadata.path,h);for(let h of d)p.has(h.metadata.path)||p.set(h.metadata.path,{...h,metadata:{...h.metadata,includeInContext:!0}});let m=Array.from(p.values()).sort((h,y)=>{let g=h.metadata.score||0;return(y.metadata.score||0)-g});return ne().debug&&B("TieredLexicalRetriever: Time range search complete",{timeRange:this.options.timeRange,dailyNotesFound:s.length,timeFilteredDocs:d.length,totalResults:m.length}),m}generateDailyNoteDateRange(r,n){let o=[],i=new Date(r),a=new Date(n),s=365;Math.ceil((n-r)/(1e3*60*60*24))>s&&(Ft(`TieredLexicalRetriever: Date range exceeds ${s} days, limiting to recent ${s} days`),i.setTime(a.getTime()-s*24*60*60*1e3));let l=new Date(i);for(;l<=a;)o.push(`[[${l.toLocaleDateString("en-CA")}]]`),l.setDate(l.getDate()+1);return o}async getTitleMatches(r){let n=[];for(let o of r)if(!g4(o))try{let i=await this.app.vault.cachedRead(o),a=this.app.metadataCache.getFileCache(o);n.push(new sh({pageContent:i,metadata:{path:o.path,title:o.basename,mtime:o.stat.mtime,ctime:o.stat.ctime,tags:a?.tags?.map(s=>s.tag)||[],includeInContext:!0,score:1,rerank_score:1,source:"title-match"}}))}catch(i){Ft(`TieredLexicalRetriever: Failed to read title-matched file ${o.path}`,i)}return n}async convertToDocuments(r){let n=[];for(let o of r)try{if(o.id.includes("#")){let[a]=o.id.split("#"),s=this.app.vault.getAbstractFileByPath(a);if(!s||!(s instanceof mVe.TFile))continue;let u="",l=this.chunkManager;if(typeof l.getChunkText=="function"?u=await l.getChunkText(o.id):typeof l.getChunkTextSync=="function"&&(u=l.getChunkTextSync(o.id)||""),!u)continue;let c=this.app.metadataCache.getFileCache(s);n.push(new sh({pageContent:u,metadata:{path:a,chunkId:o.id,title:s.basename,mtime:s.stat.mtime,ctime:s.stat.ctime,tags:c?.tags?.map(d=>d.tag)||[],score:o.score,rerank_score:o.score,engine:o.engine||"chunk-v3",includeInContext:o.score>(this.options.minSimilarityScore||.1),explanation:o.explanation,isChunk:!0}}))}else{let a=this.app.vault.getAbstractFileByPath(o.id);if(!a||!(a instanceof mVe.TFile))continue;let s=await this.app.vault.cachedRead(a);if(!s)continue;let u=this.app.metadataCache.getFileCache(a);n.push(new sh({pageContent:s,metadata:{path:o.id,title:a.basename,mtime:a.stat.mtime,ctime:a.stat.ctime,tags:u?.tags?.map(l=>l.tag)||[],score:o.score,rerank_score:o.score,engine:o.engine||"v3",includeInContext:o.score>(this.options.minSimilarityScore||.1),explanation:o.explanation,isChunk:!1}}))}}catch(i){Ft(`TieredLexicalRetriever: Failed to convert result ${o.id}`,i)}return B(`TieredLexicalRetriever: Converted ${n.length} results to Documents`),n}combineResults(r,n){let o=[];o.push(...n);for(let i of r)n.some(s=>s.metadata.path===i.metadata.path)||o.push(i);return o.sort((i,a)=>{let s=i.metadata.score||0,l=(a.metadata.score||0)-s;if(Math.abs(l)>.01)return l;if(i.metadata.isChunk&&a.metadata.isChunk&&i.metadata.path===a.metadata.path){let c=parseInt(i.metadata.chunkId?.split("#")[1]||"0"),d=parseInt(a.metadata.chunkId?.split("#")[1]||"0");return c-d}return l})}}});function hBn(t){return`
<guidance>
${Uer}
Source Catalog (for reference only):
${t.join(`
`)}
</guidance>`}function gBn(t){return`
${Uer}
Source Catalog (for reference only):
${t}`}function qer(t,e){return t?hBn(e):""}function Her(t,e){return t?gBn(e):""}function pye(t,e,r){if(!r||!e?.length||!t)return t||"";if(bBn(t))return t;let n=e.slice(0,yBn).map((o,i)=>{let a=(o.title||o.path||"Untitled").replace(/^\[\[|\]\]$/g,"");return`[^${i+1}]: [[${a}]]`}).join(`
`);return`${t}
#### Sources:
${n}`}function mye(t){if(!t)return"";let e=t.replace(/\[\^\d+\]/g,"");return e=e.replace(/\[(\d+(?:\s*,\s*\d+)*)\](?!\()/g,""),e=e.replace(/^\s*\[\^\d+\]:.*$/gm,""),e}function bBn(t){let e=t||"",r=/(^|\n)\s*#{1,6}\s*Sources\b/i.test(e),n=/(^|\n)\s*Sources\s*(?:[:-]\s*)?(\n|$)/i.test(e),o=/<summary[^>]*>\s*Sources\s*<\/summary>/i.test(e),i=/(^|\n)\s*\[\^\d+\]:\s*/.test(e);return r||n||o||i}function Ver(t){return t?`
${mBn}`:""}function _Bn(t){let e=/([\s\S]*?)\n+(?:####\s*)?Sources\s*:?\s*\n+([\s\S]*)$/i,r=t.match(e);return r?{mainContent:r[1],sourcesBlock:(r[2]||"").trim()}:null}function vBn(t){return t.includes(`
`)||(t=t.replace(/\s*\[(\d+)\]\s*/g,`
[$1] `),t=t.replace(/\s+(\d+)\.\s/g,`
$1. `),t=t.trim()),t}function wBn(t){return t.split(`
`).map(e=>e.trim()).filter(e=>/^\[\^\d+\]:/.test(e))}function xBn(t,e){let r=new Map,n=new Set,o=[],i=/\[\^(\d+)\]/g,a;for(;(a=i.exec(t))!==null;){let s=parseInt(a[1],10);n.has(s)||(n.add(s),o.push(s))}if(o.length>0)o.forEach((s,u)=>r.set(s,u+1));else{let s=1;for(let u of e){let l=u.match(/^\[\^(\d+)\]:/);if(l){let c=parseInt(l[1],10);r.has(c)||r.set(c,s++)}}}return r}function SBn(t,e){let r=t,n;do n=!1,r=r.replace(/\[\^(\d+)\]/g,(o,i)=>{let a=parseInt(i,10),u=`[${e.get(a)??a}]`;return u!==o&&(n=!0),u}),r=r.replace(/\[\^(\d+(?:\s*,\s*\^?\d+)*)\]/g,(o,i)=>{let s=`[${i.split(",").map(u=>{let l=u.trim().replace(/^\^/,""),c=parseInt(l,10);return e.get(c)??c}).sort((u,l)=>u-l).map(u=>u.toString()).join(", ")}]`;return s!==o&&(n=!0),s});while(n);return r=r.replace(/\[(\d+)\]\./g,"[$1]"),r}function CBn(t,e){let r=[];return t.split(`
`).forEach(n=>{let o=n.match(/^\[\^(\d+)\]:\s*(.*)$/);if(!o)return;let i=parseInt(o[1],10),a=e.get(i)??i,s=o[2].match(/\[([^\]]+)\]\(([^)]+)\)/),u=o[2].match(/\[\[(.*?)\]\]/),l;if(s)l=`<a href="${s[2]}">${s[1]}</a>`;else if(u)l=`[[${u[1]}]]`;else{let c=o[2].match(/^(.*?)\]\s*\(([^)]+)\)\s*$/);if(c){let d=c[1].trim();l=`<a href="${c[2].trim()}">${d}</a>`}else l=o[2].replace(/\s*\([^)]*\)\s*$/,"")}r[a-1]=l}),r}function OBn(t){let e=[],r=new Set,n=new Map;return t.forEach((o,i)=>{if(!o)return;let a=o.match(/\[\[(.*?)\]\]/),s=a?a[1].toLowerCase():o.toLowerCase();if(!r.has(s))r.add(s),e.push(o),n.set(i+1,e.length);else{let u=e.findIndex(l=>{let c=l.match(/\[\[(.*?)\]\]/);return(c?c[1].toLowerCase():l.toLowerCase())===s});u>=0&&n.set(i+1,u+1)}}),{uniqueItems:e,consolidationMap:n}}function EBn(t,e){return e.size===0?t:t.replace(/\[(\d+(?:\s*,\s*\d+)*)\]/g,(r,n)=>`[${n.split(/\s*,\s*/).map(a=>{let s=parseInt(a,10);return String(e.get(s)||s)}).join(", ")}]`)}function PBn(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function TBn(t){return t!=null}function zer(t){let e=t.split(`
`),r=[];return e.forEach(n=>{let o=n.trim();if(!o)return;let i=o.replace(/^<li>/i,"").replace(/<\/li>$/i,"").replace(/^[-*]\s*/,"").trim();if(!i)return;let a=i.match(/\[([^\]]+)\]\(([^)]+)\)/),s=i.match(/\[\[(.*?)\]\]/),u;a?u=`<a href="${a[2]}">${a[1]}</a>`:s?u=`[[${s[1]}]]`:u=PBn(i),r.push({index:r.length+1,html:u})}),r}function hVe(t,e){if(e.length===0)return t;let r=e.map(({index:n,html:o})=>`<li class="copilot-sources__item"><span class="copilot-sources__index">[${n}]</span><span class="copilot-sources__text">${o}</span></li>`).join(`
`);return`${t}
<br/>
<details class="copilot-sources"><summary class="copilot-sources__summary">Sources</summary>
<ul class="copilot-sources__list">
${r}
</ul>
</details>`}function Wer(t,e){let r=_Bn(t);if(!r)return t;let{mainContent:n,sourcesBlock:o}=r;if(o=vBn(o),!e){let d=zer(o);return hVe(n,d)}let i=wBn(o);if(i.length===0){let d=zer(o);return hVe(n,d)}let a=xBn(n,i);n=SBn(n,a);let s=CBn(o,a),{uniqueItems:u,consolidationMap:l}=OBn(s);l.size>0&&(n=EBn(n,l),s=u);let c=s.map((d,f)=>d?{index:f+1,html:d}:null).filter(TBn);return hVe(n,c)}function hye(t){return t.map(e=>{let r=e.title||e.path||"Untitled",n=e.path||r;return`- [[${r}]] (${n})`})}var Uer,mBn,yBn,y7=b(()=>{Uer=`CITATION RULES:
1. START with [^1] and increment sequentially ([^1], [^2], [^3], etc.) with NO gaps
2. BE SELECTIVE: ONLY cite when introducing NEW factual claims, specific data, or direct quotes from sources
3. IMPORTANT: Do NOT cite every sentence or bullet point. This creates clutter and poor readability.
4. DO NOT cite for:
- General knowledge or common facts
- Your own analysis or synthesis
- Transitional or concluding statements
- Every single sentence (AVOID CITATION CLUTTER - aim for 1-3 citations per paragraph maximum)
5. Citations are for SOURCE ATTRIBUTION, not for proving every statement
6. GOOD: One citation per key concept. BAD: Citation after every sentence.
7. Place citations immediately after the specific claim: "The study found X [^1]" not "The study found X. [^1]"
8. Do not reuse any bracketed numbers that appear inside the source content itself
9. If multiple source chunks come from the same document, cite each relevant chunk separately (e.g., [^1] and [^2] can both be from the same document title)
10. End with '#### Sources' section containing: [^n]: [[Title]] (one per line, matching citation order)`,mBn=`WEB CITATION RULES:
1. START with [^1] and increment sequentially ([^1], [^2], [^3], etc.) with NO gaps
2. Cite ONLY when introducing new factual claims, statistics, or direct quotes from the search results
3. After every cited claim, place the corresponding footnote immediately after the sentence ("The study found X [^1]")
4. End with '#### Sources' and provide definitions EXACTLY in this format: [^n]: [Short Title](URL)
IMPORTANT: Each source definition must follow this exact pattern:
- Start with [^n]: (where n is the citation number)
- Follow with [Title](URL) where Title is SHORT (2-5 words) and wrapped in square brackets
- Example: [^1]: [Paul Graham Essay](https://paulgraham.com/wealth.html)
- DO NOT write long descriptions - keep titles concise`;yBn=20});var b7,Ker=b(()=>{er();$t();CG();g7();_t();kt();wG();y7();S4();b7=class extends JP{async run(e,r,n,o,i){let a=new C_(n);try{let l=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),c=iz(l),d=e.message;c.length>0&&(d=e.message);let f=ne(),m=await(f.enableSemanticSearchV3?new SG({minSimilarityScore:.01,maxK:f.maxSourceChunks,salientTerms:[]}):new h7(app,{minSimilarityScore:.01,maxK:f.maxSourceChunks,salientTerms:[],timeRange:void 0,textWeight:void 0,returnAll:!1,useRerankerThreshold:void 0})).getRelevantDocuments(d);this.chainManager.storeRetrieverDocuments(m);let h=m.map(T=>{let I=T.metadata?.title||"Untitled",N=T.metadata?.path||I;return`<${bCe}>
<title>${I}</title>
<path>${N}</path>
<content>
${mye(T.pageContent)}
</content>
</${bCe}>`}).join(`
`),y=[],g=Rf(),_=m.slice(0,Math.max(5,Math.min(20,m.length))).map(T=>({title:T.metadata?.title||T.metadata?.path||"Untitled",path:T.metadata?.path||T.metadata?.title||""})),w=hye(_).join(`
`),S=`
Answer the question based only on the following context:
`+h+Her(f.enableInlineCitations,w),C=g+S,E=this.chainManager.chatModelManager.getChatModel();C&&y.push({role:iI(E),content:C});for(let T of c)y.push({role:T.role,content:T.content});if(e.content&&Array.isArray(e.content)){let T=e.content.map(I=>I.type==="text"?{...I,text:e.message}:I);y.push({role:"user",content:T})}else y.push({role:"user",content:e.message});B(`Final Request to AI:
`,y);let P=await Od(()=>this.chainManager.chatModelManager.getChatModel().stream(y,{signal:r.signal}));for await(let T of P){if(r.signal.aborted){B("VaultQA stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(T)}}catch(u){u.name==="AbortError"||r.signal.aborted?B("VaultQA stream aborted by user",{reason:r.signal.reason}):await this.handleError(u,o,n)}let s=a.close();return r.signal.aborted&&r.signal.reason==="new-chat"?(n(""),""):(s=this.addSourcestoResponse(s),this.handleResponse(s,e,r,o,n))}addSourcestoResponse(e){let r=ne(),n=this.chainManager.getRetrievedDocuments(),o=Xet(n).map(i=>({title:i}));return pye(e,o,r.enableInlineCitations)}}});async function gye(t,e){let r=`Given the following conversation and a follow up question,
summarize the conversation as context and keep the follow up question unchanged, in its original language.
If the follow up question is unrelated to its preceding messages, return this follow up question directly.
If it is related, then combine the summary and the follow up question to construct a standalone question.
Make sure to keep any [[]] wrapped note titles in the question unchanged.
If there's nothing in the chat history, just return the follow up question.
Chat History:
{chat_history}
Follow Up Input: {question}
Standalone question:`,n=e.map(({role:o,content:i})=>`${o}: ${i}`).join(`
`);return await Od(async()=>{let i=await Wd.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",t)}]);return kj(i.content)})}var gVe=b(()=>{wR();kt()});function q_(){}function Ger(t,e,r,n,o){for(var i=[],a;e;)i.push(e),a=e.previousComponent,delete e.previousComponent,e=a;i.reverse();for(var s=0,u=i.length,l=0,c=0;s<u;s++){var d=i[s];if(d.removed)d.value=t.join(n.slice(c,c+d.count)),c+=d.count;else{if(!d.added&&o){var f=r.slice(l,l+d.count);f=f.map(function(p,m){var h=n[c+m];return h.length>p.length?h:p}),d.value=t.join(f)}else d.value=t.join(r.slice(l,l+d.count));l+=d.count,d.added||(c+=d.count)}}return i}function Jer(t,e){var r;for(r=0;r<t.length&&r<e.length;r++)if(t[r]!=e[r])return t.slice(0,r);return t.slice(0,r)}function Zer(t,e){var r;if(!t||!e||t[t.length-1]!=e[e.length-1])return"";for(r=0;r<t.length&&r<e.length;r++)if(t[t.length-(r+1)]!=e[e.length-(r+1)])return t.slice(-r);return t.slice(-r)}function yVe(t,e,r){if(t.slice(0,e.length)!=e)throw Error("string ".concat(JSON.stringify(t)," doesn't start with prefix ").concat(JSON.stringify(e),"; this is a bug"));return r+t.slice(e.length)}function bVe(t,e,r){if(!e)return t+r;if(t.slice(-e.length)!=e)throw Error("string ".concat(JSON.stringify(t)," doesn't end with suffix ").concat(JSON.stringify(e),"; this is a bug"));return t.slice(0,-e.length)+r}function _7(t,e){return yVe(t,e,"")}function yye(t,e){return bVe(t,e,"")}function Yer(t,e){return e.slice(0,ABn(t,e))}function ABn(t,e){var r=0;t.length>e.length&&(r=t.length-e.length);var n=e.length;t.length<e.length&&(n=t.length);var o=Array(n),i=0;o[0]=0;for(var a=1;a<n;a++){for(e[a]==e[i]?o[a]=o[i]:o[a]=i;i>0&&e[a]!=e[i];)i=o[i];e[a]==e[i]&&i++}i=0;for(var s=r;s<t.length;s++){for(;i>0&&t[s]!=e[i];)i=o[i];t[s]==e[i]&&i++}return i}function Qer(t,e,r){return r?.ignoreWhitespace!=null&&!r.ignoreWhitespace?MBn(t,e,r):w7.diff(t,e,r)}function Xer(t,e,r,n){if(e&&r){var o=e.value.match(/^\s*/)[0],i=e.value.match(/\s*$/)[0],a=r.value.match(/^\s*/)[0],s=r.value.match(/\s*$/)[0];if(t){var u=Jer(o,a);t.value=bVe(t.value,a,u),e.value=_7(e.value,u),r.value=_7(r.value,u)}if(n){var l=Zer(i,s);n.value=yVe(n.value,s,l),e.value=yye(e.value,l),r.value=yye(r.value,l)}}else if(r)t&&(r.value=r.value.replace(/^\s*/,"")),n&&(n.value=n.value.replace(/^\s*/,""));else if(t&&n){var c=n.value.match(/^\s*/)[0],d=e.value.match(/^\s*/)[0],f=e.value.match(/\s*$/)[0],p=Jer(c,d);e.value=_7(e.value,p);var m=Zer(_7(c,p),f);e.value=yye(e.value,m),n.value=yVe(n.value,c,m),t.value=bVe(t.value,c,c.slice(0,c.length-m.length))}else if(n){var h=n.value.match(/^\s*/)[0],y=e.value.match(/\s*$/)[0],g=Yer(y,h);e.value=yye(e.value,g)}else if(t){var _=t.value.match(/\s*$/)[0],w=e.value.match(/^\s*/)[0],S=Yer(_,w);e.value=_7(e.value,S)}}function MBn(t,e,r){return etr.diff(t,e,r)}function RBn(t,e){if(typeof t=="function")e.callback=t;else if(t)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function ttr(t,e,r){var n=RBn(r,{ignoreWhitespace:!0});return _ye.diff(t,e,n)}function _Ve(t){"@babel/helpers - typeof";return _Ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_Ve(t)}function vVe(t,e,r,n,o){e=e||[],r=r||[],n&&(t=n(o,t));var i;for(i=0;i<e.length;i+=1)if(e[i]===t)return r[i];var a;if(Object.prototype.toString.call(t)==="[object Array]"){for(e.push(t),a=new Array(t.length),r.push(a),i=0;i<t.length;i+=1)a[i]=vVe(t[i],e,r,n,o);return e.pop(),r.pop(),a}if(t&&t.toJSON&&(t=t.toJSON()),_Ve(t)==="object"&&t!==null){e.push(t),a={},r.push(a);var s=[],u;for(u in t)Object.prototype.hasOwnProperty.call(t,u)&&s.push(u);for(s.sort(),i=0;i<s.length;i+=1)u=s[i],a[u]=vVe(t[u],e,r,n,u);e.pop(),r.pop()}else a=t;return a}var aRi,bye,IBn,w7,etr,_ye,NBn,jBn,v7,wVe,xVe=b(()=>{q_.prototype={diff:function(e,r){var n,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=o.callback;typeof o=="function"&&(i=o,o={});var a=this;function s(S){return S=a.postProcess(S,o),i?(setTimeout(function(){i(S)},0),!0):S}e=this.castInput(e,o),r=this.castInput(r,o),e=this.removeEmpty(this.tokenize(e,o)),r=this.removeEmpty(this.tokenize(r,o));var u=r.length,l=e.length,c=1,d=u+l;o.maxEditLength!=null&&(d=Math.min(d,o.maxEditLength));var f=(n=o.timeout)!==null&&n!==void 0?n:1/0,p=Date.now()+f,m=[{oldPos:-1,lastComponent:void 0}],h=this.extractCommon(m[0],r,e,0,o);if(m[0].oldPos+1>=l&&h+1>=u)return s(Ger(a,m[0].lastComponent,r,e,a.useLongestToken));var y=-1/0,g=1/0;function _(){for(var S=Math.max(y,-c);S<=Math.min(g,c);S+=2){var C=void 0,E=m[S-1],P=m[S+1];E&&(m[S-1]=void 0);var T=!1;if(P){var I=P.oldPos-S;T=P&&0<=I&&I<u}var N=E&&E.oldPos+1<l;if(!T&&!N){m[S]=void 0;continue}if(!N||T&&E.oldPos<P.oldPos?C=a.addToPath(P,!0,!1,0,o):C=a.addToPath(E,!1,!0,1,o),h=a.extractCommon(C,r,e,S,o),C.oldPos+1>=l&&h+1>=u)return s(Ger(a,C.lastComponent,r,e,a.useLongestToken));m[S]=C,C.oldPos+1>=l&&(g=Math.min(g,S-1)),h+1>=u&&(y=Math.max(y,S+1))}c++}if(i)(function S(){setTimeout(function(){if(c>d||Date.now()>p)return i();_()||S()},0)})();else for(;c<=d&&Date.now()<=p;){var w=_();if(w)return w}},addToPath:function(e,r,n,o,i){var a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===r&&a.removed===n?{oldPos:e.oldPos+o,lastComponent:{count:a.count+1,added:r,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:r,removed:n,previousComponent:a}}},extractCommon:function(e,r,n,o,i){for(var a=r.length,s=n.length,u=e.oldPos,l=u-o,c=0;l+1<a&&u+1<s&&this.equals(n[u+1],r[l+1],i);)l++,u++,c++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!i.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=u,l},equals:function(e,r,n){return n.comparator?n.comparator(e,r):e===r||n.ignoreCase&&e.toLowerCase()===r.toLowerCase()},removeEmpty:function(e){for(var r=[],n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r},castInput:function(e){return e},tokenize:function(e){return Array.from(e)},join:function(e){return e.join("")},postProcess:function(e){return e}};aRi=new q_;bye="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",IBn=new RegExp("[".concat(bye,"]+|\\s+|[^").concat(bye,"]"),"ug"),w7=new q_;w7.equals=function(t,e,r){return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};w7.tokenize=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r;if(e.intlSegmenter){if(e.intlSegmenter.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(e.intlSegmenter.segment(t),function(i){return i.segment})}else r=t.match(IBn)||[];var n=[],o=null;return r.forEach(function(i){/\s/.test(i)?o==null?n.push(i):n.push(n.pop()+i):/\s/.test(o)?n[n.length-1]==o?n.push(n.pop()+i):n.push(o+i):n.push(i),o=i}),n};w7.join=function(t){return t.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};w7.postProcess=function(t,e){if(!t||e.oneChangePerToken)return t;var r=null,n=null,o=null;return t.forEach(function(i){i.added?n=i:i.removed?o=i:((n||o)&&Xer(r,o,n,i),r=i,n=null,o=null)}),(n||o)&&Xer(r,o,n,null),t};etr=new q_;etr.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(bye,"]+|[^\\S\\n\\r]+|[^").concat(bye,"]"),"ug");return t.match(e)||[]};_ye=new q_;_ye.tokenize=function(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
`));var r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var o=0;o<n.length;o++){var i=n[o];o%2&&!e.newlineIsToken?r[r.length-1]+=i:r.push(i)}return r};_ye.equals=function(t,e,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
`))&&(t=t.trim()),(!r.newlineIsToken||!e.includes(`
`))&&(e=e.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
`)&&(t=t.slice(0,-1)),e.endsWith(`
`)&&(e=e.slice(0,-1))),q_.prototype.equals.call(this,t,e,r)};NBn=new q_;NBn.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};jBn=new q_;jBn.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};v7=new q_;v7.useLongestToken=!0;v7.tokenize=_ye.tokenize;v7.castInput=function(t,e){var r=e.undefinedReplacement,n=e.stringifyReplacer,o=n===void 0?function(i,a){return typeof a>"u"?r:a}:n;return typeof t=="string"?t:JSON.stringify(vVe(t,null,null,o),o," ")};v7.equals=function(t,e,r){return q_.prototype.equals.call(v7,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};wVe=new q_;wVe.tokenize=function(t){return t.slice()};wVe.join=wVe.removeEmpty=function(t){return t}});function rtr(t){let e=[],r=[];return t.forEach(n=>{n.added||n.removed?r.push(n):(r.length>0&&(e.push(r),r=[]),e.push([n]))}),r.length>0&&e.push(r),e}var ntr=b(()=>{});var QT,Lr,otr,itr,x7,vye,atr,DBn,SVe=b(()=>{dn();$t();xVe();_n();QT=require("obsidian"),Lr=j(Z()),otr=j(Bc());Un();itr=j(Z());ntr();kt();x7="obsidian-copilot-apply-view",vye=class extends QT.ItemView{constructor(r){super(r);this.root=null;this.state=null;this.result=null}getViewType(){return x7}getDisplayText(){return"Preview Changes"}async setState(r){this.state=r,this.render()}async onOpen(){this.render()}async onClose(){this.root&&(this.root.unmount(),this.root=null),this.state?.resultCallback?.(this.result?this.result:"aborted")}render(){if(!this.state)return;let r=this.containerEl.children[1];r.empty();let n=r.createDiv();this.root||(this.root=(0,otr.createRoot)(n)),this.root.render(Lr.default.createElement(DBn,{app:this.app,state:this.state,close:o=>{this.result=o,this.leaf.detach()}}))}},atr=(0,Lr.memo)(({oldLine:t,newLine:e})=>{let r=Qer(t,e);return Lr.default.createElement(Lr.default.Fragment,null,r.map((n,o)=>n.added?Lr.default.createElement("span",{key:o,className:"tw-text-success"},n.value):n.removed?Lr.default.createElement("span",{key:o,className:"tw-text-error tw-line-through"},n.value):Lr.default.createElement("span",{key:o},n.value)))});atr.displayName="WordDiff";DBn=({app:t,state:e,close:r})=>{let[n,o]=(0,itr.useState)(()=>e.changes.map(m=>({...m,accepted:null}))),i=rtr(n),a=(0,Lr.useRef)([]);if(!e||!e.changes)return ie("Invalid state:",e),Lr.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col tw-items-center tw-justify-center"},Lr.default.createElement("div",{className:"tw-text-error"},"Error: Invalid state - missing changes"),Lr.default.createElement(me,{onClick:()=>r("failed"),className:"tw-mt-4"},"Close"));let s=async()=>{try{let m=n.map(y=>y.accepted===null?{...y,accepted:!0}:y),h=await c(m);r(h?"accepted":"failed")}catch(m){ie("Error applying changes:",m),new QT.Notice(`Error applying changes: ${m.message}`),r("failed")}},u=async()=>{try{let m=n.map(y=>y.accepted===null?{...y,accepted:!1}:y),h=await c(m);r(h?"rejected":"failed")}catch(m){ie("Error applying changes:",m),new QT.Notice(`Error applying changes: ${m.message}`),r("failed")}},l=async m=>{let h=t.vault.getAbstractFileByPath(m);if(h)return h;if(m.includes("/")){let y=m.split("/").slice(0,-1).join("/");await Mm(y)}return await t.vault.create(m,"")},c=async m=>{let h=m.filter(g=>g.added?g.accepted===!0:g.removed?g.accepted===!1:!0).map(g=>g.value).join(""),y=await l(e.path);return!y||!(y instanceof QT.TFile)?(ie("Error in getting file",e.path),new QT.Notice("Failed to create file"),!1):(await t.vault.modify(y,h),new QT.Notice("Changes applied successfully"),!0)},d=m=>{if(!i)return;let h=-1;for(let y=m+1;y<i.length;y++){let g=i[y],_=g.some(S=>S.added||S.removed),w=g.some(S=>(S.added||S.removed)&&S.accepted===null);if(_&&w){h=y;break}}h!==-1&&a.current[h]&&a.current[h]?.scrollIntoView({behavior:"smooth",block:"center"})},f=m=>{o(h=>{let y=[...h],g=i?.[m];return g&&g.forEach(_=>{let w=y.findIndex(S=>S===_);w!==-1&&(y[w]={...y[w],accepted:!0})}),y}),setTimeout(()=>d(m),0)},p=m=>{o(h=>{let y=[...h],g=i?.[m];return g&&g.forEach(_=>{let w=y.findIndex(S=>S===_);w!==-1&&(y[w]={...y[w],accepted:!1})}),y}),setTimeout(()=>d(m),0)};return Lr.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},Lr.default.createElement("div",{className:"tw-fixed tw-bottom-2 tw-left-1/2 tw-z-[1] tw-flex tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-secondary tw-p-2"},Lr.default.createElement(me,{variant:"destructive",size:"sm",onClick:u},Lr.default.createElement(_i,{className:"tw-size-4"}),"Reject"),Lr.default.createElement(me,{variant:"success",size:"sm",onClick:s},Lr.default.createElement(ds,{className:"tw-size-4"}),"Accept")),Lr.default.createElement("div",{className:"tw-flex tw-items-center tw-border-b tw-border-solid tw-border-border tw-p-2 tw-text-sm tw-font-medium"},e.path),Lr.default.createElement("div",{className:"tw-flex-1 tw-overflow-auto tw-p-2"},i?.map((m,h)=>{let y=m.some(_=>_.added||_.removed),g=y?m.every(_=>!_.added&&!_.removed||_.accepted===!0)?"accepted":m.every(_=>!_.added&&!_.removed||_.accepted===!1)?"rejected":"undecided":"unchanged";return Lr.default.createElement("div",{key:h,ref:_=>a.current[h]=_,className:he("tw-mb-4 tw-overflow-hidden tw-rounded-md")},g==="accepted"?Lr.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm tw-text-normal"},m.filter(_=>!_.removed).map((_,w)=>Lr.default.createElement("div",{key:w},_.value))):g==="rejected"?Lr.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm tw-text-normal"},m.filter(_=>!_.added).map((_,w)=>Lr.default.createElement("div",{key:w},_.value))):m.map((_,w)=>{if(_.added){let S=m.findIndex((C,E)=>C.removed&&E!==w);if(S!==-1){let C=m[S].value;return Lr.default.createElement("div",{key:`${h}-${w}`,className:"tw-relative"},Lr.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm"},Lr.default.createElement(atr,{oldLine:C,newLine:_.value})))}}return _.removed&&m.findIndex((C,E)=>C.added&&E!==w)!==-1?null:Lr.default.createElement("div",{key:`${h}-${w}`,className:"tw-relative"},Lr.default.createElement("div",{className:he("tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm",{"tw-text-success":_.added,"tw-text-error":_.removed,"tw-text-normal":!_.added&&!_.removed,"tw-line-through":_.removed})},_.value))}),y&&g==="undecided"&&Lr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-p-2"},Lr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Lr.default.createElement(me,{variant:"destructive",size:"sm",onClick:()=>p(h)},Lr.default.createElement(_i,{className:"tw-size-4"}),"Reject"),Lr.default.createElement(me,{variant:"success",size:"sm",onClick:()=>f(h)},Lr.default.createElement(ds,{className:"tw-size-4"}),"Accept"))),y&&(g==="accepted"||g==="rejected")&&Lr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-p-2"},Lr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Lr.default.createElement("div",{className:"tw-mr-2 tw-text-sm tw-font-medium"},g==="accepted"?Lr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-success"},Lr.default.createElement(ds,{className:"tw-size-4"}),Lr.default.createElement("div",null,"Accepted")):Lr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-error"},Lr.default.createElement(_i,{className:"tw-size-4"}),Lr.default.createElement("div",null,"Rejected"))),Lr.default.createElement(me,{variant:"secondary",size:"sm",onClick:()=>{o(_=>{let w=[..._],S=i?.[h];return S&&S.forEach(C=>{let E=w.findIndex(P=>P===C);E!==-1&&(w[E]={...w[E],accepted:null})}),w})}},"Revert"))))})))}});function Jl(t){return{name:t.name,description:t.description,schema:t.schema,call:async e=>{try{t.schema instanceof dt.ZodVoid&&e&&typeof e=="object"&&Object.keys(e).length===0&&(e=void 0);let r={};t.requiresUserMessageContent&&e?._userMessageContent&&(r={_userMessageContent:e._userMessageContent},e=Object.fromEntries(Object.entries(e).filter(([i])=>i!=="_userMessageContent")));let o={...t.schema.parse(e),...r};return await t.handler(o)}catch(r){if(r instanceof dt.ZodError){let n=r.errors.map(o=>`${o.path.join(".")}: ${o.message}`).join(", ");throw new Error(`Tool ${t.name} validation failed: ${n}`)}throw r}},timeoutMs:t.timeoutMs,isBackground:t.isBackground,isPlusOnly:t.isPlusOnly,requiresUserMessageContent:t.requiresUserMessageContent,version:t.version,deprecated:t.deprecated,metadata:t.metadata}}function str(t){let e={};if(t instanceof dt.ZodObject){let r=t.shape;for(let[n,o]of Object.entries(r)){let i=o;e[n]=utr(i)||"No description"}}else{if(t instanceof dt.ZodVoid)return{};(t instanceof dt.ZodUnion||t instanceof dt.ZodDiscriminatedUnion)&&(e._union="Multiple parameter formats supported")}return e}function utr(t){return t instanceof dt.ZodOptional||t instanceof dt.ZodNullable||t instanceof dt.ZodDefault?utr(t._def.innerType):t._def.description||""}var wRi,Kk=b(()=>{xd();wRi={emptyParams:dt.void(),stringParam:t=>dt.string().describe(t),numberParam:t=>dt.number().describe(t),booleanParam:t=>dt.boolean().describe(t),optionalString:t=>dt.string().optional().describe(t),nonEmptyString:t=>dt.string().min(1).describe(t),url:t=>dt.string().url().describe(t),email:t=>dt.string().email().describe(t)}});async function LBn(t){let e=app.vault.getAbstractFileByPath(t);if(e&&e instanceof mH.TFile)return e;if(e&&!(e instanceof mH.TFile))throw new Error(`Path "${t}" exists but is not a file`);try{let r=t.includes("/")?t.split("/").slice(0,-1).join("/"):"";if(r&&await Mm(r),e=app.vault.getAbstractFileByPath(t),e&&e instanceof mH.TFile)return e;if(e=await app.vault.create(t,""),!(e instanceof mH.TFile))throw new Error(`Failed to create file: unexpected type returned for "${t}"`);return e}catch(r){throw new Error(`Failed to get or create file "${t}": ${r.message}`)}}async function ltr(t,e){let r=await LBn(t),n=app.workspace.getActiveFile();r&&(!n||n.path!==t)&&await app.workspace.getLeaf().openFile(r);let o="";r&&(o=await app.vault.read(r));let i=ttr(o,e,{newlineIsToken:!0});return new Promise(a=>{app.workspace.getLeaf(!0).setViewState({type:x7,active:!0,state:{changes:i,path:t,resultCallback:u=>{a(u)}}})})}function S7(t){return t.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function $Bn(t,e,r){let n=(t.match(/\r\n/g)||[]).length,o=(t.match(/(?<!\r)\n/g)||[]).length,i=n>o,a=S7(t),s=S7(e),u=S7(r),l=a.replaceAll(s,u);return i?l.replace(/\n/g,`\r
`):l}function BBn(t){let e=[],r=/-{3,}\s*SEARCH\s*(?:\r?\n)?/,n=/(?:\r?\n)?={3,}\s*(?:\r?\n)?/,o=/(?:\r?\n)?\+{3,}\s*REPLACE/,i=new RegExp(r.source+"([\\s\\S]*?)"+n.source+"([\\s\\S]*?)"+o.source,"g"),a;for(;(a=i.exec(t))!==null;){let s=a[1].trim(),u=a[2].trim();e.push({searchText:s,replaceText:u})}return e}var mH,FBn,wye,kBn,ctr,CVe=b(()=>{mH=require("obsidian");SVe();xVe();xd();Kk();kt();FBn=dt.object({path:dt.string().describe(`(Required) The path to the file to write to.
The path must end with explicit file extension, such as .md or .canvas .
Prefer to create new files in existing folders or root folder unless the user's request specifies otherwise.
The path must be relative to the root of the vault.`),content:dt.union([dt.string(),dt.object({}).passthrough()]).describe(`(Required) The content to write to the file. Can be either a string or an object.
ALWAYS provide the COMPLETE intended content of the file, without any truncation or omissions.
You MUST include ALL parts of the file, even if they haven't been modified.
# For string content
* Use when writing text files like .md, .txt, etc.
# For object content
* Use when writing structured data files like .json, .canvas, etc.
* The object will be automatically converted to JSON string format
# Rules for Obsidian Canvas content
* For canvas files, both 'nodes' and 'edges' arrays must be properly closed with ]
* Every node must have: id, type, x, y, width, height
* Every edge must have: id, fromNode, toNode
* All IDs must be unique
* Edge fromNode and toNode must reference existing node IDs
# Example content of a canvas file (as object)
{
"nodes": [
{
"id": "1",
"type": "text",
"text": "Hello, world!",
"x": 0,
"y": 0,
"width": 200,
"height": 50
}
],
"edges": [
{
"id": "e1-2",
"fromNode": "1",
"toNode": "2",
"label": "connects to"
}
]
}`)}),wye=Jl({name:"writeToFile",description:`Request to write content to a file at the specified path and show the changes in a Change Preview UI.
# Steps to find the the target path
1. Extract the target file information from user message and find out the file path from the context.
2. If target file is not specified, use the active note as the target file.
3. If still failed to find the target file or the file path, ask the user to specify the target file.
`,schema:FBn,handler:async({path:t,content:e})=>{let r=typeof e=="string"?e:JSON.stringify(e,null,2),n=await ltr(t,r);return JSON.stringify({result:n,message:`File change result: ${n}. Do not retry or attempt alternative approaches to modify this file in response to the current user request.`})},timeoutMs:0}),kBn=dt.object({path:dt.string().describe("(Required) The path of the file to modify (relative to the root of the vault and include the file extension)."),diff:dt.string().describe(`(Required) One or more SEARCH/REPLACE blocks. Each block MUST follow this exact format with these exact markers:
------- SEARCH
[exact content to find, including all whitespace and indentation]
=======
[new content to replace with]
+++++++ REPLACE
WHEN TO USE THIS TOOL vs writeToFile:
- Use replaceInFile for: small edits, fixing typos, updating specific sections, targeted changes
- Use writeToFile for: creating new files, major rewrites, when you can't identify specific text to replace
CRITICAL RULES:
1. SEARCH content must match EXACTLY - every character, space, and line break
2. Use the exact markers: "------- SEARCH", "=======", "+++++++ REPLACE"
3. For multiple changes, include multiple SEARCH/REPLACE blocks in order
4. Keep blocks concise - include only the lines being changed plus minimal context
COMMON MISTAKES TO AVOID:
- Wrong: Using different markers like "---- SEARCH" or "SEARCH -------"
- Wrong: Including too many unchanged lines
- Wrong: Not matching whitespace/indentation exactly`)});ctr=Jl({name:"replaceInFile",description:"Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a LARGE file.",schema:kBn,handler:async({path:t,diff:e})=>{let r=app.vault.getAbstractFileByPath(t);if(!r||!(r instanceof mH.TFile))return`File not found at path: ${t}. Please check the file path and try again.`;try{let n=await app.vault.read(r),o=n;if(n.length<3e3)return"File is too small to use this tool. Please use writeToFile instead.";let a=BBn(e);if(a.length===0)return`No valid SEARCH/REPLACE blocks found in diff. Please use the correct format with ------- SEARCH, =======, and +++++++ REPLACE markers.
diff: ${e}`;let s=0;for(let l of a){let{searchText:c,replaceText:d}=l,f=S7(o),p=S7(c);if(!f.includes(p))if(f.includes(p.trimEnd()))c=c.trimEnd(),d=d.trimEnd();else return`Search text not found in file ${t} : "${c}".`;let m=o;o=$Bn(o,c,d),o!==m&&s++}if(n===o)return`No changes made to ${t}. The search text was not found or replacement resulted in identical content. Call writeToFile instead`;let u=await ltr(t,o);return JSON.stringify({result:u,blocksApplied:s,message:`Applied ${s} SEARCH/REPLACE block(s) (replacing all occurrences). Result: ${u}. Do not call this tool again to modify this file in response to the current user request.`})}catch(n){return`Error performing SEARCH/REPLACE on ${t}: ${n}. Please check the file path and diff format and try again.`}},timeoutMs:0})});var OVe,dtr,$O,C7=b(()=>{OVe=require("obsidian"),dtr=t=>{switch(t){case"@vault":return"Search through your vault for relevant information";case"@websearch":return"Search the web for information";case"@youtube":return"Get the transcript of a YouTube video. Example: @youtube <video_url>";case"@pomodoro":return"Start a pomodoro timer. Example: @pomodoro 25m";case"@composer":return"Edit existing notes or create new notes.";default:return""}},$O=class{static async callTool(e,r){try{if(!e)throw new Error("Tool is undefined");let n=await e.call(r);return n??(console.warn(`Tool ${e.name} returned null/undefined result`),null)}catch(n){return console.error("Error calling tool:",n),n instanceof Error?new OVe.Notice(n.message):new OVe.Notice("An error occurred while executing the tool. Check console for details."),null}}}});function zBn(t){return"children"in t&&"path"in t}function UBn(t){return"path"in t&&!("children"in t)}function qBn(t){let e=t.split(".");return e.length>1&&e.pop()?.toLowerCase()||""}function EVe(t,e=!0){let r=[],n={},o={},{inclusions:i,exclusions:a}=mu();for(let u of t.children)if(UBn(u)){if(Ma(u,i,a)){e&&r.push(u.name);let l=qBn(u.name)||"unknown";l&&(n[l]=(n[l]||0)+1)}}else if(zBn(u)){let l=EVe(u,e);if(Object.keys(l).length>0&&(o[u.name]=l[u.name],l[u.name].extensionCounts))for(let[c,d]of Object.entries(l[u.name].extensionCounts))n[c]=(n[c]||0)+d}let s={};return Object.keys(n).length>0&&(s.extensionCounts=n),e&&r.length>0&&(s.files=r),Object.keys(o).length>0&&(s.subFolders=o),Object.keys(s).length===0?{}:t.name?{[t.name]:s}:{vault:s}}var xye,PVe=b(()=>{Yp();xd();Kk();xye=t=>Jl({name:"getFileTree",description:"Get the file tree as a nested structure of folders and files",schema:dt.void(),handler:async()=>{let e=EVe(t,!0),r=`A JSON represents the file tree as a nested structure:
* The root object has a key "vault" which contains a FileTreeNode object.
* Each FileTreeNode has these properties:
* files: An array of filenames in the current directory (if any files exist)
* subFolders: An object mapping folder names to their FileTreeNode objects (if any subfolders exist)
* extensionCounts: An object with counts of file extensions in this folder and all subfolders
`,n=JSON.stringify(e);if(n.length>5e5){let o=EVe(t,!1);return r+JSON.stringify(o)}return r+n},isBackground:!0})});async function TVe(t,e,r){try{if(!t||!t.name)return{toolName:t?.name||"unknown",result:"Error: Invalid tool call - missing tool name",success:!1};let o=e.find(u=>u.name===t.name);if(!o){let u=e.map(l=>l.name).join(", ");return{toolName:t.name,result:`Error: Tool '${t.name}' not found. Available tools: ${u}. Make sure you have the tool enabled in the Agent settings.`,success:!1}}if(o.isPlusOnly&&!await pO())return{toolName:t.name,result:`Error: ${Gk(t.name)} requires a Copilot Plus subscription`,success:!1};let i={...t.args};o.requiresUserMessageContent&&r&&(i._userMessageContent=r);let a=6e4;typeof o.timeoutMs=="number"&&(a=o.timeoutMs);let s;return!a||a===1/0?s=await $O.callTool(o,i):s=await Promise.race([$O.callTool(o,i),new Promise((u,l)=>setTimeout(()=>l(new Error(`Tool execution timed out after ${a}ms`)),a))]),s==null?(Ft(`Tool ${t.name} returned null/undefined result`),{toolName:t.name,result:JSON.stringify({message:"Tool executed but returned no result",status:"empty"}),success:!0}):{toolName:t.name,result:typeof s=="string"?s:JSON.stringify(s),success:!0}}catch(o){return ie(`Error executing tool ${t.name}:`,o),{toolName:t.name,result:`Error: ${Fn(o)}`,success:!1}}}function Gk(t){return t==="localSearch"?ne().enableSemanticSearchV3?"vault search (semantic)":"vault search (index-free)":{webSearch:"web search",getFileTree:"file tree",getCurrentTime:"current time",getTimeRangeMs:"time range",getTimeInfoByEpoch:"time info",convertTimeBetweenTimezones:"timezone converter",startPomodoro:"pomodoro timer",pomodoroTool:"pomodoro timer",simpleYoutubeTranscriptionTool:"YouTube transcription",youtubeTranscription:"YouTube transcription",indexVault:"vault indexing",indexTool:"index",writeToFile:"file editor",replaceInFile:"file editor"}[t]||t}function hH(t){return{localSearch:"\u{1F50D}",webSearch:"\u{1F310}",getFileTree:"\u{1F4C1}",getCurrentTime:"\u{1F552}",getTimeRangeMs:"\u{1F4C5}",getTimeInfoByEpoch:"\u{1F570}\uFE0F",convertTimeBetweenTimezones:"\u{1F30D}",startPomodoro:"\u23F1\uFE0F",pomodoroTool:"\u23F1\uFE0F",simpleYoutubeTranscriptionTool:"\u{1F4FA}",youtubeTranscription:"\u{1F4FA}",indexVault:"\u{1F4DA}",indexTool:"\u{1F4DA}",writeToFile:"\u270F\uFE0F",replaceInFile:"\u{1F504}"}[t]||"\u{1F527}"}function ftr(t,e){if(t=="writeToFile"||t=="replaceInFile")return"Accept / reject in the Preview";if(t==="localSearch"&&e?.salientTerms&&!ne().enableSemanticSearchV3){let n=Array.isArray(e.salientTerms)?e.salientTerms:[];if(n.length>0)return`Terms: ${n.slice(0,3).join(", ")}${n.length>3?"...":""}`}return null}function AVe(t,e){let r=Gk(t.name),n=hH(t.name),o=Object.keys(t.args).length>0?JSON.stringify(t.args,null,2):"(no parameters)";B(`${n} [Iteration ${e}] ${r.toUpperCase()}`),B("Parameters:",o),B("---")}function IVe(t,e){if(t==="localSearch")return;let r=Gk(t),n=hH(t),o=e.success?"\u2705 SUCCESS":"\u274C FAILED";B(`${n} ${r.toUpperCase()} RESULT: ${o}`);let i=300,a=String(e.result??"");a.length>i?B(`Result: ${a.substring(0,i)}... (truncated, ${a.length} chars total)`):a.length>0&&B("Result:",a)}function S1(t){let e=new Map;for(let r of t){let n=r.path||r.title,o=e.get(n);(!o||r.score>o.score)&&e.set(n,r)}return Array.from(e.values()).sort((r,n)=>n.score-r.score)}var O7=b(()=>{$t();fy();_t();C7();kt()});var MVe,HBn,VBn,E7,ptr,WBn,P7,RVe=b(()=>{gVe();er();jy();$t();_t();xd();O7();Kk();y7();MVe=dt.object({query:dt.string().min(1).describe("The search query"),salientTerms:dt.array(dt.string()).describe("List of salient terms extracted from the query"),timeRange:dt.object({startTime:dt.any(),endTime:dt.any()}).optional().describe("Time range for search")}),HBn=Jl({name:"lexicalSearch",description:"Search for notes using lexical/keyword-based search",schema:MVe,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=ne(),o=t!==void 0,i=o?Math.max(n.maxSourceChunks,200):n.maxSourceChunks;B(`lexicalSearch returnAll: ${o}`);let s=await new(await Promise.resolve().then(()=>(g7(),fye))).TieredLexicalRetriever(app,{minSimilarityScore:o?0:.1,maxK:i,salientTerms:r,timeRange:t?{startTime:t.startTime.epoch,endTime:t.endTime.epoch}:void 0,textWeight:_Ce,returnAll:o,useRerankerThreshold:.5}).getRelevantDocuments(e);B(`lexicalSearch found ${s.length} documents for query: "${e}"`),t&&B(`Time range search from ${new Date(t.startTime.epoch).toISOString()} to ${new Date(t.endTime.epoch).toISOString()}`);let u=s.map(p=>{let m=p.metadata.rerank_score??p.metadata.score??0;return{title:p.metadata.title||"Untitled",content:p.pageContent,path:p.metadata.path||"",score:m,rerank_score:m,includeInContext:p.metadata.includeInContext??!0,source:p.metadata.source,mtime:p.metadata.mtime??null,ctime:p.metadata.ctime??null,chunkId:p.metadata.chunkId??null,isChunk:p.metadata.isChunk??!1,explanation:p.metadata.explanation??null}}),l=u.map(p=>({title:p.title||p.path||"Untitled",path:p.path||p.title||"",score:p.rerank_score||p.score||0})),c=S1(l),d=new Map;for(let p of u){let m=(p.path||p.title).toLowerCase(),h=d.get(m);(!h||(p.rerank_score||0)>(h.rerank_score||0))&&d.set(m,p)}let f=c.map(p=>d.get((p.path||p.title).toLowerCase())).filter(Boolean);return JSON.stringify({type:"local_search",documents:f})}}),VBn=Jl({name:"semanticSearch",description:"Search for notes using semantic/meaning-based search with embeddings",schema:MVe,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=ne(),o=t!==void 0,i=o?Math.max(n.maxSourceChunks,200):n.maxSourceChunks;B(`semanticSearch returnAll: ${o}`);let s=await new(await Promise.resolve().then(()=>(CG(),Zde))).HybridRetriever({minSimilarityScore:o?0:.1,maxK:i,salientTerms:r,timeRange:t?{startTime:t.startTime.epoch,endTime:t.endTime.epoch}:void 0,textWeight:_Ce,returnAll:o,useRerankerThreshold:.5}).getRelevantDocuments(e);B(`semanticSearch found ${s.length} documents for query: "${e}"`),t&&B(`Time range search from ${new Date(t.startTime.epoch).toISOString()} to ${new Date(t.endTime.epoch).toISOString()}`);let u=s.map(p=>{let m=p.metadata.rerank_score??p.metadata.score??0;return{title:p.metadata.title||"Untitled",content:p.pageContent,path:p.metadata.path||"",score:m,rerank_score:m,includeInContext:p.metadata.includeInContext??!0,source:p.metadata.source,mtime:p.metadata.mtime??null,ctime:p.metadata.ctime??null,chunkId:p.metadata.chunkId??null,isChunk:p.metadata.isChunk??!1,explanation:p.metadata.explanation??null}}),l=u.map(p=>({title:p.title||p.path||"Untitled",path:p.path||p.title||"",score:p.rerank_score||p.score||0})),c=S1(l),d=new Map;for(let p of u){let m=(p.path||p.title).toLowerCase(),h=d.get(m);(!h||(p.rerank_score||0)>(h.rerank_score||0))&&d.set(m,p)}let f=c.map(p=>d.get((p.path||p.title).toLowerCase())).filter(Boolean);return JSON.stringify({type:"local_search",documents:f})}}),E7=Jl({name:"localSearch",description:"Search for notes based on the time range and query",schema:MVe,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=ne();return B(`localSearch delegating to ${n.enableSemanticSearchV3?"semantic":"lexical"} search`),n.enableSemanticSearchV3?await VBn.call({timeRange:t,query:e,salientTerms:r}):await HBn.call({timeRange:t,query:e,salientTerms:r})}}),ptr=Jl({name:"indexVault",description:"Index the vault to the Copilot index",schema:dt.void(),handler:async()=>{if(ne().enableSemanticSearchV3)try{let r=await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().indexVaultToVectorStore();return`Semantic search index refreshed with ${r} documents.
`+JSON.stringify({success:!0,message:`Semantic search index has been refreshed with ${r} documents.`,documentCount:r})}catch(e){return JSON.stringify({success:!1,message:`Failed to index with semantic search: ${e.message}`})}else return`The tiered lexical retriever builds indexes on demand and doesn't require manual indexing.
`+JSON.stringify({success:!0,message:"Tiered lexical retriever uses on-demand indexing. No manual indexing required."})},isBackground:!0}),WBn=dt.object({query:dt.string().min(1).describe("The search query"),chatHistory:dt.array(dt.object({role:dt.enum(["user","assistant"]),content:dt.string()})).describe("Previous conversation turns")}),P7=Jl({name:"webSearch",description:"Search the web for information",schema:WBn,isPlusOnly:!0,handler:async({query:t,chatHistory:e})=>{try{let r=await gye(t,e),n=await Zi.getInstance().webSearch(r),o=n.response.citations||[],a=[{type:"web_search",content:n.response.choices[0].message.content,citations:o,instruction:Ver(ne().enableInlineCitations)}];return JSON.stringify(a)}catch(r){return console.error(`Error processing web search query ${t}:`,r),""}}})});var mtr=x((NVe,jVe)=>{(function(t,e){typeof NVe=="object"&&typeof jVe<"u"?jVe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_quarterOfYear=e()})(NVe,function(){"use strict";var t="month",e="quarter";return function(r,n){var o=n.prototype;o.quarter=function(s){return this.$utils().u(s)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(s-1))};var i=o.add;o.add=function(s,u){return s=Number(s),this.$utils().p(u)===e?this.add(3*s,t):i.bind(this)(s,u)};var a=o.startOf;o.startOf=function(s,u){var l=this.$utils(),c=!!l.u(u)||u;if(l.p(s)===e){var d=this.quarter()-1;return c?this.month(3*d).startOf(t).startOf("day"):this.month(3*d+2).endOf(t).endOf("day")}return a.bind(this)(s,u)}}})});var C1=x((DVe,LVe)=>{(function(t,e){typeof DVe=="object"&&typeof LVe<"u"?LVe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(DVe,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",u="week",l="month",c="quarter",d="year",f="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(D){var k=["th","st","nd","rd"],L=D%100;return"["+D+(k[(L-20)%10]||k[L]||k[0])+"]"}},g=function(D,k,L){var H=String(D);return!H||H.length>=k?D:""+Array(k+1-H.length).join(L)+D},_={s:g,z:function(D){var k=-D.utcOffset(),L=Math.abs(k),H=Math.floor(L/60),K=L%60;return(k<=0?"+":"-")+g(H,2,"0")+":"+g(K,2,"0")},m:function D(k,L){if(k.date()<L.date())return-D(L,k);var H=12*(L.year()-k.year())+(L.month()-k.month()),K=k.clone().add(H,l),G=L-K<0,X=k.clone().add(H+(G?-1:1),l);return+(-(H+(L-K)/(G?K-X:X-K))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:l,y:d,w:u,d:s,D:f,h:a,m:i,s:o,ms:n,Q:c}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},w="en",S={};S[w]=y;var C="$isDayjsObject",E=function(D){return D instanceof N||!(!D||!D[C])},P=function D(k,L,H){var K;if(!k)return w;if(typeof k=="string"){var G=k.toLowerCase();S[G]&&(K=G),L&&(S[G]=L,K=G);var X=k.split("-");if(!K&&X.length>1)return D(X[0])}else{var F=k.name;S[F]=k,K=F}return!H&&K&&(w=K),K||!H&&w},T=function(D,k){if(E(D))return D.clone();var L=typeof k=="object"?k:{};return L.date=D,L.args=arguments,new N(L)},I=_;I.l=P,I.i=E,I.w=function(D,k){return T(D,{locale:k.$L,utc:k.$u,x:k.$x,$offset:k.$offset})};var N=function(){function D(L){this.$L=P(L.locale,null,!0),this.parse(L),this.$x=this.$x||L.x||{},this[C]=!0}var k=D.prototype;return k.parse=function(L){this.$d=function(H){var K=H.date,G=H.utc;if(K===null)return new Date(NaN);if(I.u(K))return new Date;if(K instanceof Date)return new Date(K);if(typeof K=="string"&&!/Z$/i.test(K)){var X=K.match(m);if(X){var F=X[2]-1||0,Q=(X[7]||"0").substring(0,3);return G?new Date(Date.UTC(X[1],F,X[3]||1,X[4]||0,X[5]||0,X[6]||0,Q)):new Date(X[1],F,X[3]||1,X[4]||0,X[5]||0,X[6]||0,Q)}}return new Date(K)}(L),this.init()},k.init=function(){var L=this.$d;this.$y=L.getFullYear(),this.$M=L.getMonth(),this.$D=L.getDate(),this.$W=L.getDay(),this.$H=L.getHours(),this.$m=L.getMinutes(),this.$s=L.getSeconds(),this.$ms=L.getMilliseconds()},k.$utils=function(){return I},k.isValid=function(){return this.$d.toString()!==p},k.isSame=function(L,H){var K=T(L);return this.startOf(H)<=K&&K<=this.endOf(H)},k.isAfter=function(L,H){return T(L)<this.startOf(H)},k.isBefore=function(L,H){return this.endOf(H)<T(L)},k.$g=function(L,H,K){return I.u(L)?this[H]:this.set(K,L)},k.unix=function(){return Math.floor(this.valueOf()/1e3)},k.valueOf=function(){return this.$d.getTime()},k.startOf=function(L,H){var K=this,G=!!I.u(H)||H,X=I.p(L),F=function(J,se){var be=I.w(K.$u?Date.UTC(K.$y,se,J):new Date(K.$y,se,J),K);return G?be:be.endOf(s)},Q=function(J,se){return I.w(K.toDate()[J].apply(K.toDate("s"),(G?[0,0,0,0]:[23,59,59,999]).slice(se)),K)},ee=this.$W,U=this.$M,z=this.$D,V="set"+(this.$u?"UTC":"");switch(X){case d:return G?F(1,0):F(31,11);case l:return G?F(1,U):F(0,U+1);case u:var q=this.$locale().weekStart||0,W=(ee<q?ee+7:ee)-q;return F(G?z-W:z+(6-W),U);case s:case f:return Q(V+"Hours",0);case a:return Q(V+"Minutes",1);case i:return Q(V+"Seconds",2);case o:return Q(V+"Milliseconds",3);default:return this.clone()}},k.endOf=function(L){return this.startOf(L,!1)},k.$set=function(L,H){var K,G=I.p(L),X="set"+(this.$u?"UTC":""),F=(K={},K[s]=X+"Date",K[f]=X+"Date",K[l]=X+"Month",K[d]=X+"FullYear",K[a]=X+"Hours",K[i]=X+"Minutes",K[o]=X+"Seconds",K[n]=X+"Milliseconds",K)[G],Q=G===s?this.$D+(H-this.$W):H;if(G===l||G===d){var ee=this.clone().set(f,1);ee.$d[F](Q),ee.init(),this.$d=ee.set(f,Math.min(this.$D,ee.daysInMonth())).$d}else F&&this.$d[F](Q);return this.init(),this},k.set=function(L,H){return this.clone().$set(L,H)},k.get=function(L){return this[I.p(L)]()},k.add=function(L,H){var K,G=this;L=Number(L);var X=I.p(H),F=function(U){var z=T(G);return I.w(z.date(z.date()+Math.round(U*L)),G)};if(X===l)return this.set(l,this.$M+L);if(X===d)return this.set(d,this.$y+L);if(X===s)return F(1);if(X===u)return F(7);var Q=(K={},K[i]=e,K[a]=r,K[o]=t,K)[X]||1,ee=this.$d.getTime()+L*Q;return I.w(ee,this)},k.subtract=function(L,H){return this.add(-1*L,H)},k.format=function(L){var H=this,K=this.$locale();if(!this.isValid())return K.invalidDate||p;var G=L||"YYYY-MM-DDTHH:mm:ssZ",X=I.z(this),F=this.$H,Q=this.$m,ee=this.$M,U=K.weekdays,z=K.months,V=K.meridiem,q=function(se,be,ce,pe){return se&&(se[be]||se(H,G))||ce[be].slice(0,pe)},W=function(se){return I.s(F%12||12,se,"0")},J=V||function(se,be,ce){var pe=se<12?"AM":"PM";return ce?pe.toLowerCase():pe};return G.replace(h,function(se,be){return be||function(ce){switch(ce){case"YY":return String(H.$y).slice(-2);case"YYYY":return I.s(H.$y,4,"0");case"M":return ee+1;case"MM":return I.s(ee+1,2,"0");case"MMM":return q(K.monthsShort,ee,z,3);case"MMMM":return q(z,ee);case"D":return H.$D;case"DD":return I.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return q(K.weekdaysMin,H.$W,U,2);case"ddd":return q(K.weekdaysShort,H.$W,U,3);case"dddd":return U[H.$W];case"H":return String(F);case"HH":return I.s(F,2,"0");case"h":return W(1);case"hh":return W(2);case"a":return J(F,Q,!0);case"A":return J(F,Q,!1);case"m":return String(Q);case"mm":return I.s(Q,2,"0");case"s":return String(H.$s);case"ss":return I.s(H.$s,2,"0");case"SSS":return I.s(H.$ms,3,"0");case"Z":return X}return null}(se)||X.replace(":","")})},k.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},k.diff=function(L,H,K){var G,X=this,F=I.p(H),Q=T(L),ee=(Q.utcOffset()-this.utcOffset())*e,U=this-Q,z=function(){return I.m(X,Q)};switch(F){case d:G=z()/12;break;case l:G=z();break;case c:G=z()/3;break;case u:G=(U-ee)/6048e5;break;case s:G=(U-ee)/864e5;break;case a:G=U/r;break;case i:G=U/e;break;case o:G=U/t;break;default:G=U}return K?G:I.a(G)},k.daysInMonth=function(){return this.endOf(l).$D},k.$locale=function(){return S[this.$L]},k.locale=function(L,H){if(!L)return this.$L;var K=this.clone(),G=P(L,H,!0);return G&&(K.$L=G),K},k.clone=function(){return I.w(this.$d,this)},k.toDate=function(){return new Date(this.valueOf())},k.toJSON=function(){return this.isValid()?this.toISOString():null},k.toISOString=function(){return this.$d.toISOString()},k.toString=function(){return this.$d.toUTCString()},D}(),M=N.prototype;return T.prototype=M,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",l],["$y",d],["$D",f]].forEach(function(D){M[D[1]]=function(k){return this.$g(k,D[0],D[1])}}),T.extend=function(D,k){return D.$i||(D(k,N,T),D.$i=!0),T},T.locale=P,T.isDayjs=E,T.unix=function(D){return T(1e3*D)},T.en=S[w],T.Ls=S,T.p={},T})});var Do,Zl,Sg,O1=b(()=>{(function(t){t[t.AM=0]="AM",t[t.PM=1]="PM"})(Do||(Do={}));(function(t){t[t.SUNDAY=0]="SUNDAY",t[t.MONDAY=1]="MONDAY",t[t.TUESDAY=2]="TUESDAY",t[t.WEDNESDAY=3]="WEDNESDAY",t[t.THURSDAY=4]="THURSDAY",t[t.FRIDAY=5]="FRIDAY",t[t.SATURDAY=6]="SATURDAY"})(Zl||(Zl={}));(function(t){t[t.JANUARY=1]="JANUARY",t[t.FEBRUARY=2]="FEBRUARY",t[t.MARCH=3]="MARCH",t[t.APRIL=4]="APRIL",t[t.MAY=5]="MAY",t[t.JUNE=6]="JUNE",t[t.JULY=7]="JULY",t[t.AUGUST=8]="AUGUST",t[t.SEPTEMBER=9]="SEPTEMBER",t[t.OCTOBER=10]="OCTOBER",t[t.NOVEMBER=11]="NOVEMBER",t[t.DECEMBER=12]="DECEMBER"})(Sg||(Sg={}))});function htr(t,e){e=e.add(1,"day"),Jk(t,e),gH(t,e)}function H_(t,e){t.assign("day",e.date()),t.assign("month",e.month()+1),t.assign("year",e.year())}function Sye(t,e){t.assign("hour",e.hour()),t.assign("minute",e.minute()),t.assign("second",e.second()),t.assign("millisecond",e.millisecond()),t.get("hour")<12?t.assign("meridiem",Do.AM):t.assign("meridiem",Do.PM)}function Jk(t,e){t.imply("day",e.date()),t.imply("month",e.month()+1),t.imply("year",e.year())}function gH(t,e){t.imply("hour",e.hour()),t.imply("minute",e.minute()),t.imply("second",e.second()),t.imply("millisecond",e.millisecond())}var yH=b(()=>{O1()});function E1(t,e,r,n,o=0){let i=0,a=0;for(;a<n;)i++,new Date(t,e-1,i).getDay()===r&&a++;return new Date(t,e-1,i,o)}function gtr(t,e,r,n=0){let o=r===0?7:r,i=new Date(t,e-1+1,1,12),a=i.getDay()===0?7:i.getDay(),s;return a===o?s=7:a<o?s=7+a-o:s=a-o,i.setDate(i.getDate()-s),new Date(t,e-1,i.getDate(),n)}function Cye(t,e,r={}){if(t==null)return null;if(typeof t=="number")return t;let n=r[t]??KBn[t];return n==null?null:typeof n=="number"?n:e==null?null:(0,FVe.default)(e).isAfter(n.dstStart(e.getFullYear()))&&!(0,FVe.default)(e).isAfter(n.dstEnd(e.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}var FVe,KBn,kVe=b(()=>{FVe=j(C1(),1);O1();KBn={ACDT:630,ACST:570,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,ALMT:360,AMST:-180,AMT:-240,ANAST:720,ANAT:720,AQTT:300,ART:-180,AST:-240,AWDT:540,AWST:480,AZOST:0,AZOT:-60,AZST:300,AZT:240,BNT:480,BOT:-240,BRST:-120,BRT:-180,BST:60,BTT:360,CAST:480,CAT:120,CCT:390,CDT:-300,CEST:120,CET:{timezoneOffsetDuringDst:2*60,timezoneOffsetNonDst:60,dstStart:t=>gtr(t,Sg.MARCH,Zl.SUNDAY,2),dstEnd:t=>gtr(t,Sg.OCTOBER,Zl.SUNDAY,3)},CHADT:825,CHAST:765,CKT:-600,CLST:-180,CLT:-240,COT:-300,CST:-360,CT:{timezoneOffsetDuringDst:-5*60,timezoneOffsetNonDst:-6*60,dstStart:t=>E1(t,Sg.MARCH,Zl.SUNDAY,2,2),dstEnd:t=>E1(t,Sg.NOVEMBER,Zl.SUNDAY,1,2)},CVT:-60,CXT:420,ChST:600,DAVT:420,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEST:180,EET:120,EGST:0,EGT:-60,EST:-300,ET:{timezoneOffsetDuringDst:-4*60,timezoneOffsetNonDst:-5*60,dstStart:t=>E1(t,Sg.MARCH,Zl.SUNDAY,2,2),dstEnd:t=>E1(t,Sg.NOVEMBER,Zl.SUNDAY,1,2)},FJST:780,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GMT:0,GST:240,GYT:-240,HAA:-180,HAC:-300,HADT:-540,HAE:-240,HAP:-420,HAR:-360,HAST:-600,HAT:-90,HAY:-480,HKT:480,HLV:-210,HNA:-240,HNC:-360,HNE:-300,HNP:-480,HNR:-420,HNT:-150,HNY:-540,HOVT:420,ICT:420,IDT:180,IOT:360,IRDT:270,IRKST:540,IRKT:540,IRST:210,IST:330,JST:540,KGT:360,KRAST:480,KRAT:480,KST:540,KUYT:240,LHDT:660,LHST:630,LINT:840,MAGST:720,MAGT:720,MART:-510,MAWT:300,MDT:-360,MESZ:120,MEZ:60,MHT:720,MMT:390,MSD:240,MSK:180,MST:-420,MT:{timezoneOffsetDuringDst:-6*60,timezoneOffsetNonDst:-7*60,dstStart:t=>E1(t,Sg.MARCH,Zl.SUNDAY,2,2),dstEnd:t=>E1(t,Sg.NOVEMBER,Zl.SUNDAY,1,2)},MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:690,NOVST:420,NOVT:360,NPT:345,NST:-150,NUT:-660,NZDT:780,NZST:720,OMSST:420,OMST:420,PDT:-420,PET:-300,PETST:720,PETT:720,PGT:600,PHOT:780,PHT:480,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PT:{timezoneOffsetDuringDst:-7*60,timezoneOffsetNonDst:-8*60,dstStart:t=>E1(t,Sg.MARCH,Zl.SUNDAY,2,2),dstEnd:t=>E1(t,Sg.NOVEMBER,Zl.SUNDAY,1,2)},PWT:540,PYST:-180,PYT:-240,RET:240,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SRT:-180,SST:-660,TAHT:-600,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TVT:720,ULAT:480,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-210,VLAST:660,VLAT:660,VUT:660,WAST:120,WAT:60,WEST:60,WESZ:60,WET:0,WEZ:0,WFT:720,WGST:-120,WGT:-180,WIB:420,WIT:540,WITA:480,WST:780,WT:0,YAKST:600,YAKT:600,YAPT:600,YEKST:360,YEKT:360}});var ytr,T7,P1,Lo,eA,V_=b(()=>{ytr=j(mtr(),1),T7=j(C1(),1);yH();kVe();T7.default.extend(ytr.default);P1=class{constructor(e){e=e??new Date,e instanceof Date?this.instant=e:(this.instant=e.instant??new Date,this.timezoneOffset=Cye(e.timezone,this.instant))}getDateWithAdjustedTimezone(){return new Date(this.instant.getTime()+this.getSystemTimezoneAdjustmentMinute(this.instant)*6e4)}getSystemTimezoneAdjustmentMinute(e,r){(!e||e.getTime()<0)&&(e=new Date);let n=-e.getTimezoneOffset(),o=r??this.timezoneOffset??n;return n-o}},Lo=class t{constructor(e,r){if(this._tags=new Set,this.reference=e,this.knownValues={},this.impliedValues={},r)for(let o in r)this.knownValues[o]=r[o];let n=(0,T7.default)(e.instant);this.imply("day",n.date()),this.imply("month",n.month()+1),this.imply("year",n.year()),this.imply("hour",12),this.imply("minute",0),this.imply("second",0),this.imply("millisecond",0)}get(e){return e in this.knownValues?this.knownValues[e]:e in this.impliedValues?this.impliedValues[e]:null}isCertain(e){return e in this.knownValues}getCertainComponents(){return Object.keys(this.knownValues)}imply(e,r){return e in this.knownValues?this:(this.impliedValues[e]=r,this)}assign(e,r){return this.knownValues[e]=r,delete this.impliedValues[e],this}delete(e){delete this.knownValues[e],delete this.impliedValues[e]}clone(){let e=new t(this.reference);e.knownValues={},e.impliedValues={};for(let r in this.knownValues)e.knownValues[r]=this.knownValues[r];for(let r in this.impliedValues)e.impliedValues[r]=this.impliedValues[r];return e}isOnlyDate(){return!this.isCertain("hour")&&!this.isCertain("minute")&&!this.isCertain("second")}isOnlyTime(){return!this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")&&!this.isCertain("year")}isOnlyWeekdayComponent(){return this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")}isDateWithUnknownYear(){return this.isCertain("month")&&!this.isCertain("year")}isValidDate(){let e=this.dateWithoutTimezoneAdjustment();return!(e.getFullYear()!==this.get("year")||e.getMonth()!==this.get("month")-1||e.getDate()!==this.get("day")||this.get("hour")!=null&&e.getHours()!=this.get("hour")||this.get("minute")!=null&&e.getMinutes()!=this.get("minute"))}toString(){return`[ParsingComponents {
tags: ${JSON.stringify(Array.from(this._tags).sort())},
knownValues: ${JSON.stringify(this.knownValues)},
impliedValues: ${JSON.stringify(this.impliedValues)}},
reference: ${JSON.stringify(this.reference)}]`}dayjs(){return(0,T7.default)(this.date())}date(){let e=this.dateWithoutTimezoneAdjustment(),r=this.reference.getSystemTimezoneAdjustmentMinute(e,this.get("timezoneOffset"));return new Date(e.getTime()+r*6e4)}addTag(e){return this._tags.add(e),this}addTags(e){for(let r of e)this._tags.add(r);return this}tags(){return new Set(this._tags)}dateWithoutTimezoneAdjustment(){let e=new Date(this.get("year"),this.get("month")-1,this.get("day"),this.get("hour"),this.get("minute"),this.get("second"),this.get("millisecond"));return e.setFullYear(this.get("year")),e}static createRelativeFromReference(e,r){let n=(0,T7.default)(e.instant);for(let i in r)n=n.add(r[i],i);let o=new t(e);return r.hour||r.minute||r.second?(Sye(o,n),H_(o,n),e.timezoneOffset!==null&&o.assign("timezoneOffset",-e.instant.getTimezoneOffset())):(gH(o,n),e.timezoneOffset!==null&&o.imply("timezoneOffset",-e.instant.getTimezoneOffset()),r.d?(o.assign("day",n.date()),o.assign("month",n.month()+1),o.assign("year",n.year())):r.week?(o.assign("day",n.date()),o.assign("month",n.month()+1),o.assign("year",n.year()),o.imply("weekday",n.day())):(o.imply("day",n.date()),r.month?(o.assign("month",n.month()+1),o.assign("year",n.year())):(o.imply("month",n.month()+1),r.year?o.assign("year",n.year()):o.imply("year",n.year())))),o}},eA=class t{constructor(e,r,n,o,i){this.reference=e,this.refDate=e.instant,this.index=r,this.text=n,this.start=o||new Lo(e),this.end=i}clone(){let e=new t(this.reference,this.index,this.text);return e.start=this.start?this.start.clone():null,e.end=this.end?this.end.clone():null,e}date(){return this.start.date()}tags(){let e=new Set(this.start.tags());if(this.end)for(let r of this.end.tags())e.add(r);return e}toString(){let e=Array.from(this.tags()).sort();return`[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(e)} ...}]`}}});function $Ve(t,e,r="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${t}${n}(?:${r}${n}){0,10}`}function GBn(t){let e;return t instanceof Array?e=[...t]:t instanceof Map?e=Array.from(t.keys()):e=Object.keys(t),e}function rf(t){return`(?:${GBn(t).sort((r,n)=>n.length-r.length).join("|").replace(/\./g,"\\.")})`}var T1=b(()=>{});function Oye(t){return t<100&&(t>50?t=t+1900:t=t+2e3),t}function A1(t,e,r){let n=(0,btr.default)(t),o=n;o=o.month(r-1),o=o.date(e),o=o.year(n.year());let i=o.add(1,"y"),a=o.add(-1,"y");return Math.abs(i.diff(n))<Math.abs(o.diff(n))?o=i:Math.abs(a.diff(n))<Math.abs(o.diff(n))&&(o=a),o.year()}var btr,bH=b(()=>{btr=j(C1(),1)});function JBn(t){let e=t.toLowerCase();return BVe[e]!==void 0?BVe[e]:e==="a"||e==="an"||e=="the"?1:e.match(/few/)?3:e.match(/half/)?.5:e.match(/couple/)?2:e.match(/several/)?7:parseFloat(e)}function vH(t){let e=t.toLowerCase();return zVe[e]!==void 0?zVe[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}function M1(t){if(/BE/i.test(t))return t=t.replace(/BE/i,""),parseInt(t)-543;if(/BCE?/i.test(t))return t=t.replace(/BCE?/i,""),-parseInt(t);if(/(AD|CE)/i.test(t))return t=t.replace(/(AD|CE)/i,""),parseInt(t);let e=parseInt(t);return Oye(e)}function ib(t){let e={},r=t,n=_tr.exec(r);for(;n;)YBn(e,n),r=r.substring(n[0].length).trim(),n=_tr.exec(r);return Object.keys(e).length==0?null:e}function YBn(t,e){if(e[0].match(/^[a-zA-Z]+$/))return;let r=JBn(e[1]),n=A7[e[2].toLowerCase()];t[n]=r}var UVe,qVe,ob,BVe,zVe,vtr,A7,wtr,_H,I1,xtr,_tr,ZBn,Str,tA,R1,Tc=b(()=>{T1();bH();UVe={sunday:0,sun:0,"sun.":0,monday:1,mon:1,"mon.":1,tuesday:2,tue:2,"tue.":2,wednesday:3,wed:3,"wed.":3,thursday:4,thurs:4,"thurs.":4,thur:4,"thur.":4,thu:4,"thu.":4,friday:5,fri:5,"fri.":5,saturday:6,sat:6,"sat.":6},qVe={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},ob={...qVe,jan:1,"jan.":1,feb:2,"feb.":2,mar:3,"mar.":3,apr:4,"apr.":4,jun:6,"jun.":6,jul:7,"jul.":7,aug:8,"aug.":8,sep:9,"sep.":9,sept:9,"sept.":9,oct:10,"oct.":10,nov:11,"nov.":11,dec:12,"dec.":12},BVe={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},zVe={first:1,second:2,third:3,fourth:4,fifth:5,sixth:6,seventh:7,eighth:8,ninth:9,tenth:10,eleventh:11,twelfth:12,thirteenth:13,fourteenth:14,fifteenth:15,sixteenth:16,seventeenth:17,eighteenth:18,nineteenth:19,twentieth:20,"twenty first":21,"twenty-first":21,"twenty second":22,"twenty-second":22,"twenty third":23,"twenty-third":23,"twenty fourth":24,"twenty-fourth":24,"twenty fifth":25,"twenty-fifth":25,"twenty sixth":26,"twenty-sixth":26,"twenty seventh":27,"twenty-seventh":27,"twenty eighth":28,"twenty-eighth":28,"twenty ninth":29,"twenty-ninth":29,thirtieth:30,"thirty first":31,"thirty-first":31},vtr={second:"second",seconds:"second",minute:"minute",minutes:"minute",hour:"hour",hours:"hour",day:"d",days:"d",week:"week",weeks:"week",month:"month",months:"month",quarter:"quarter",quarters:"quarter",year:"year",years:"year"},A7={s:"second",sec:"second",second:"second",seconds:"second",m:"minute",min:"minute",mins:"minute",minute:"minute",minutes:"minute",h:"hour",hr:"hour",hrs:"hour",hour:"hour",hours:"hour",d:"d",day:"d",days:"d",w:"w",week:"week",weeks:"week",mo:"month",mon:"month",mos:"month",month:"month",months:"month",qtr:"quarter",quarter:"quarter",quarters:"quarter",y:"year",yr:"year",year:"year",years:"year",...vtr},wtr=`(?:${rf(BVe)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?\\b(?:\\s{0,2}few)?|few|several|the|a?\\s{0,2}couple\\s{0,2}(?:of)?)`;_H=`(?:${rf(zVe)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;I1="(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9]|2[0-5])";xtr=`(${wtr})\\s{0,3}(${rf(A7)})`,_tr=new RegExp(xtr,"i"),ZBn=`(${wtr})\\s{0,3}(${rf(vtr)})`,Str="\\s{0,5},?(?:\\s*and)?\\s{0,5}",tA=$Ve("(?:(?:about|around)\\s{0,3})?",xtr,Str),R1=$Ve("(?:(?:about|around)\\s{0,3})?",ZBn,Str)});var ji,rm=b(()=>{ji=class{constructor(){this.cachedInnerPattern=null,this.cachedPattern=null}innerPatternHasChange(e,r){return this.innerPattern(e)!==r}patternLeftBoundary(){return"(\\W|^)"}pattern(e){return this.cachedInnerPattern&&!this.innerPatternHasChange(e,this.cachedInnerPattern)?this.cachedPattern:(this.cachedInnerPattern=this.innerPattern(e),this.cachedPattern=new RegExp(`${this.patternLeftBoundary()}${this.cachedInnerPattern.source}`,this.cachedInnerPattern.flags),this.cachedPattern)}extract(e,r){let n=r[1]??"";r.index=r.index+n.length,r[0]=r[0].substring(n.length);for(let o=2;o<r.length;o++)r[o-1]=r[o];return this.innerExtract(e,r)}}});var XBn,QBn,ezn,I7,Ctr=b(()=>{Tc();V_();rm();XBn=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${tA})(?=\\W|$)`,"i"),QBn=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${tA})(?=\\W|$)`,"i"),ezn=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${R1})(?=\\W|$)`,"i"),I7=class extends ji{constructor(e){super(),this.strictMode=e}innerPattern(e){return this.strictMode?ezn:e.option.forwardDate?XBn:QBn}innerExtract(e,r){if(r[0].match(/^for\s*the\s*\w+/))return null;let n=ib(r[1]);return n?Lo.createRelativeFromReference(e.reference,n):null}}});var tzn,Otr,Etr,rzn,Ptr,M7,Ttr=b(()=>{bH();Tc();Tc();Tc();T1();rm();tzn=new RegExp(`(?:on\\s{0,3})?(${_H})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${_H}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${rf(ob)})(?:(?:-|/|,?\\s{0,3})(${I1}(?!\\w)))?(?=\\W|$)`,"i"),Otr=1,Etr=2,rzn=3,Ptr=4,M7=class extends ji{innerPattern(){return tzn}innerExtract(e,r){let n=e.createParsingResult(r.index,r[0]),o=ob[r[rzn].toLowerCase()],i=vH(r[Otr]);if(i>31)return r.index=r.index+r[Otr].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[Ptr]){let a=M1(r[Ptr]);n.start.assign("year",a)}else{let a=A1(e.refDate,i,o);n.start.imply("year",a)}if(r[Etr]){let a=vH(r[Etr]);n.end=n.start.clone(),n.end.assign("day",a)}return n}}});var nzn,ozn,Atr,HVe,VVe,R7,Itr=b(()=>{bH();Tc();Tc();Tc();T1();rm();nzn=new RegExp(`(${rf(ob)})(?:-|/|\\s*,?\\s*)(${_H})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${_H})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${I1}))?(?=\\W|$)(?!\\:\\d)`,"i"),ozn=1,Atr=2,HVe=3,VVe=4,R7=class extends ji{constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return nzn}innerExtract(e,r){let n=ob[r[ozn].toLowerCase()],o=vH(r[Atr]);if(o>31||this.shouldSkipYearLikeDate&&!r[HVe]&&!r[VVe]&&r[Atr].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[VVe]){let u=M1(r[VVe]);i.assign("year",u)}else{let u=A1(e.refDate,o,n);i.imply("year",u)}if(!r[HVe])return i;let a=vH(r[HVe]),s=e.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}}});var izn,azn,szn,Mtr,N7,Rtr=b(()=>{Tc();bH();T1();Tc();rm();izn=new RegExp(`((?:in)\\s*)?(${rf(ob)})\\s*(?:[,-]?\\s*(${I1})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),azn=1,szn=2,Mtr=3,N7=class extends ji{innerPattern(){return izn}innerExtract(e,r){let n=r[szn].toLowerCase();if(r[0].length<=3&&!qVe[n])return null;let o=e.createParsingResult(r.index+(r[azn]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=ob[n];if(o.start.assign("month",i),r[Mtr]){let a=M1(r[Mtr]);o.start.assign("year",a)}else{let a=A1(e.refDate,1,i);o.start.imply("year",a)}return o}}});var uzn,lzn,czn,Ntr,dzn,j7,jtr=b(()=>{Tc();T1();rm();uzn=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${rf(ob)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),lzn=1,czn=2,Ntr=3,dzn=4,j7=class extends ji{constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return uzn}innerExtract(e,r){let n=parseInt(r[lzn]),o=parseInt(r[dzn]),i=r[Ntr]?parseInt(r[Ntr]):ob[r[czn].toLowerCase()];if(i<1||i>12){if(this.strictMonthDateOrder)return null;o>=1&&o<=12&&([i,o]=[o,i])}return o<1||o>31?null:{day:o,month:i,year:n}}}});var fzn,pzn,mzn,D7,Dtr=b(()=>{rm();fzn=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),pzn=1,mzn=2,D7=class extends ji{innerPattern(){return fzn}innerExtract(e,r){let n=parseInt(r[mzn]),o=parseInt(r[pzn]);return e.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}}});function hzn(t,e,r,n){return new RegExp(`${t}${e}(\\d{1,4})(?:(?:\\.|:|\uFF1A)(\\d{1,2})(?:(?::|\uFF1A)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${r}`,n)}function gzn(t,e){return new RegExp(`^(${t})(\\d{1,4})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${e}`,"i")}var Ltr,wH,Eye,Pye,L7,Tye,Ftr=b(()=>{O1();Ltr=2,wH=3,Eye=4,Pye=5,L7=6,Tye=class{constructor(e=!1){this.cachedPrimaryPrefix=null,this.cachedPrimarySuffix=null,this.cachedPrimaryTimePattern=null,this.cachedFollowingPhase=null,this.cachedFollowingSuffix=null,this.cachedFollowingTimePatten=null,this.strictMode=e}patternFlags(){return"i"}primaryPatternLeftBoundary(){return"(^|\\s|T|\\b)"}primarySuffix(){return"(?!/)(?=\\W|$)"}followingSuffix(){return"(?!/)(?=\\W|$)"}pattern(e){return this.getPrimaryTimePatternThroughCache()}extract(e,r){let n=this.extractPrimaryTimeComponents(e,r);if(!n)return r[0].match(/^\d{4}/)?(r.index+=4,null):(r.index+=r[0].length,null);let o=r.index+r[1].length,i=r[0].substring(r[1].length),a=e.createParsingResult(o,i,n);r.index+=r[0].length;let s=e.text.substring(r.index),l=this.getFollowingTimePatternThroughCache().exec(s);return i.match(/^\d{3,4}/)&&l&&(l[0].match(/^\s*([+-])\s*\d{2,4}$/)||l[0].match(/^\s*([+-])\s*\d{2}\W\d{2}/))?null:!l||l[0].match(/^\s*([+-])\s*\d{3,4}$/)?this.checkAndReturnWithoutFollowingPattern(a):(a.end=this.extractFollowingTimeComponents(e,l,a),a.end&&(a.text+=l[0]),this.checkAndReturnWithFollowingPattern(a))}extractPrimaryTimeComponents(e,r,n=!1){let o=e.createParsingComponents(),i=0,a=null,s=parseInt(r[Ltr]);if(s>100){if(this.strictMode||r[wH]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[wH]!=null){if(r[wH].length==1&&!r[L7])return null;i=parseInt(r[wH])}if(i>=60)return null;if(s>12&&(a=Do.PM),r[L7]!=null){if(s>12)return null;let u=r[L7][0].toLowerCase();u=="a"&&(a=Do.AM,s==12&&(s=0)),u=="p"&&(a=Do.PM,s!=12&&(s+=12))}if(o.assign("hour",s),o.assign("minute",i),a!==null?o.assign("meridiem",a):s<12?o.imply("meridiem",Do.AM):o.imply("meridiem",Do.PM),r[Pye]!=null){let u=parseInt(r[Pye].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[Eye]!=null){let u=parseInt(r[Eye]);if(u>=60)return null;o.assign("second",u)}return o}extractFollowingTimeComponents(e,r,n){let o=e.createParsingComponents();if(r[Pye]!=null){let u=parseInt(r[Pye].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[Eye]!=null){let u=parseInt(r[Eye]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[Ltr]),a=0,s=-1;if(r[wH]!=null?a=parseInt(r[wH]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=Do.PM),r[L7]!=null){if(i>12)return null;let u=r[L7][0].toLowerCase();u=="a"&&(s=Do.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=Do.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==Do.AM?(n.start.imply("meridiem",Do.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",Do.PM),n.start.get("hour")!=12&&n.start.assign("hour",n.start.get("hour")+12)))}return o.assign("hour",i),o.assign("minute",a),s>=0?o.assign("meridiem",s):n.start.isCertain("meridiem")&&n.start.get("hour")>12?n.start.get("hour")-12>i?o.imply("meridiem",Do.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",Do.PM)):i>12?o.imply("meridiem",Do.PM):i<=12&&o.imply("meridiem",Do.AM),o.date().getTime()<n.start.date().getTime()&&o.imply("day",o.get("day")+1),o}checkAndReturnWithoutFollowingPattern(e){if(e.text.match(/^\d$/)||e.text.match(/^\d\d\d+$/)||e.text.match(/\d[apAP]$/))return null;let r=e.text.match(/[^\d:.](\d[\d.]+)$/);if(r){let n=r[1];if(this.strictMode||n.includes(".")&&!n.match(/\d(\.\d{2})+$/)||parseInt(n)>24)return null}return e}checkAndReturnWithFollowingPattern(e){if(e.text.match(/^\d+-\d+$/))return null;let r=e.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);if(r){if(this.strictMode)return null;let n=r[1],o=r[2];if(o.includes(".")&&!o.match(/\d(\.\d{2})+$/))return null;let i=parseInt(o),a=parseInt(n);if(i>24||a>24)return null}return e}getPrimaryTimePatternThroughCache(){let e=this.primaryPrefix(),r=this.primarySuffix();return this.cachedPrimaryPrefix===e&&this.cachedPrimarySuffix===r?this.cachedPrimaryTimePattern:(this.cachedPrimaryTimePattern=hzn(this.primaryPatternLeftBoundary(),e,r,this.patternFlags()),this.cachedPrimaryPrefix=e,this.cachedPrimarySuffix=r,this.cachedPrimaryTimePattern)}getFollowingTimePatternThroughCache(){let e=this.followingPhase(),r=this.followingSuffix();return this.cachedFollowingPhase===e&&this.cachedFollowingSuffix===r?this.cachedFollowingTimePatten:(this.cachedFollowingTimePatten=gzn(e,r),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}}});var F7,ktr=b(()=>{O1();Ftr();F7=class extends Tye{constructor(e){super(e)}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|to|until|through|till|\\?)\\s*"}primaryPrefix(){return"(?:(?:at|from)\\s*)??"}primarySuffix(){return"(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)"}extractPrimaryTimeComponents(e,r){let n=super.extractPrimaryTimeComponents(e,r);if(!n)return n;if(r[0].endsWith("night")){let o=n.get("hour");o>=6&&o<12?(n.assign("hour",n.get("hour")+12),n.assign("meridiem",Do.PM)):o<6&&n.assign("meridiem",Do.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",Do.PM);let o=n.get("hour");o>=0&&o<=6&&n.assign("hour",n.get("hour")+12)}return r[0].endsWith("morning")&&(n.assign("meridiem",Do.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}}});function N1(t){let e={};for(let r in t)e[r]=-t[r];return e}function $tr(t,e){let r=t.clone(),n=t.dayjs();for(let o in e)n=n.add(e[o],o);return("day"in e||"d"in e||"week"in e||"month"in e||"year"in e)&&(r.imply("day",n.date()),r.imply("month",n.month()+1),r.imply("year",n.year())),("second"in e||"minute"in e||"hour"in e)&&(r.imply("second",n.second()),r.imply("minute",n.minute()),r.imply("hour",n.hour())),r}var xH=b(()=>{});var yzn,bzn,k7,Btr=b(()=>{Tc();V_();rm();xH();yzn=new RegExp(`(${tA})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),bzn=new RegExp(`(${R1})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),k7=class extends ji{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?bzn:yzn}innerExtract(e,r){let n=ib(r[1]);if(!n)return null;let o=N1(n);return Lo.createRelativeFromReference(e.reference,o)}}});var _zn,vzn,wzn,$7,ztr=b(()=>{Tc();V_();rm();_zn=new RegExp(`(${tA})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),vzn=new RegExp(`(${R1})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),wzn=1,$7=class extends ji{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?vzn:_zn}innerExtract(e,r){let n=ib(r[wzn]);return n?Lo.createRelativeFromReference(e.reference,n):null}}});var Aye,ab,Zk=b(()=>{Aye=class{refine(e,r){return r.filter(n=>this.isValid(e,n))}},ab=class{refine(e,r){if(r.length<2)return r;let n=[],o=r[0],i=null;for(let a=1;a<r.length;a++){i=r[a];let s=e.text.substring(o.index+o.text.length,i.index);if(!this.shouldMergeResults(s,o,i,e))n.push(o),o=i;else{let u=o,l=i,c=this.mergeResults(s,u,l,e);e.debug(()=>{console.log(`${this.constructor.name} merged ${u} and ${l} into ${c}`)}),o=c}}return o!=null&&n.push(o),n}}});var B7,Utr=b(()=>{Zk();B7=class extends ab{shouldMergeResults(e,r,n){return!r.end&&!n.end&&e.match(this.patternBetween())!=null}mergeResults(e,r,n){if(!r.start.isOnlyWeekdayComponent()&&!n.start.isOnlyWeekdayComponent()&&(n.start.getCertainComponents().forEach(i=>{r.start.isCertain(i)||r.start.imply(i,n.start.get(i))}),r.start.getCertainComponents().forEach(i=>{n.start.isCertain(i)||n.start.imply(i,r.start.get(i))})),r.start.date().getTime()>n.start.date().getTime()){let i=r.start.dayjs(),a=n.start.dayjs();n.start.isOnlyWeekdayComponent()&&a.add(7,"days").isAfter(i)?(a=a.add(7,"days"),n.start.imply("day",a.date()),n.start.imply("month",a.month()+1),n.start.imply("year",a.year())):r.start.isOnlyWeekdayComponent()&&i.add(-7,"days").isBefore(a)?(i=i.add(-7,"days"),r.start.imply("day",i.date()),r.start.imply("month",i.month()+1),r.start.imply("year",i.year())):n.start.isDateWithUnknownYear()&&a.add(1,"years").isAfter(i)?(a=a.add(1,"years"),n.start.imply("year",a.year())):r.start.isDateWithUnknownYear()&&i.add(-1,"years").isBefore(a)?(i=i.add(-1,"years"),r.start.imply("year",i.year())):[n,r]=[r,n]}let o=r.clone();return o.start=r.start,o.end=n.start,o.index=Math.min(r.index,n.index),r.index<n.index?o.text=r.text+e+n.text:o.text=n.text+e+r.text,o}}});var z7,qtr=b(()=>{Utr();z7=class extends B7{patternBetween(){return/^\s*(to|-||until|through|till)\s*$/i}}});function WVe(t,e){let r=t.clone(),n=t.start,o=e.start;if(r.start=Htr(n,o),t.end!=null||e.end!=null){let i=t.end==null?t.start:t.end,a=e.end==null?e.start:e.end,s=Htr(i,a);if(t.end==null&&s.date().getTime()<r.start.date().getTime()){let u=s.dayjs().add(1,"day");s.isCertain("day")?H_(s,u):Jk(s,u)}r.end=s}return r}function Htr(t,e){let r=t.clone();return e.isCertain("hour")?(r.assign("hour",e.get("hour")),r.assign("minute",e.get("minute")),e.isCertain("second")?(r.assign("second",e.get("second")),e.isCertain("millisecond")?r.assign("millisecond",e.get("millisecond")):r.imply("millisecond",e.get("millisecond"))):(r.imply("second",e.get("second")),r.imply("millisecond",e.get("millisecond")))):(r.imply("hour",e.get("hour")),r.imply("minute",e.get("minute")),r.imply("second",e.get("second")),r.imply("millisecond",e.get("millisecond"))),e.isCertain("timezoneOffset")&&r.assign("timezoneOffset",e.get("timezoneOffset")),e.isCertain("meridiem")?r.assign("meridiem",e.get("meridiem")):e.get("meridiem")!=null&&r.get("meridiem")==null&&r.imply("meridiem",e.get("meridiem")),r.get("meridiem")==Do.PM&&r.get("hour")<12&&(e.isCertain("hour")?r.assign("hour",r.get("hour")+12):r.imply("hour",r.get("hour")+12)),r.addTags(t.tags()),r.addTags(e.tags()),r}var Vtr=b(()=>{O1();yH()});var U7,Wtr=b(()=>{Zk();Vtr();U7=class extends ab{shouldMergeResults(e,r,n){return(r.start.isOnlyDate()&&n.start.isOnlyTime()||n.start.isOnlyDate()&&r.start.isOnlyTime())&&e.match(this.patternBetween())!=null}mergeResults(e,r,n){let o=r.start.isOnlyDate()?WVe(r,n):WVe(n,r);return o.index=r.index,o.text=r.text+e+n.text,o}}});var SH,Ktr=b(()=>{Wtr();SH=class extends U7{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}}});var xzn,q7,Gtr=b(()=>{kVe();xzn=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),q7=class{constructor(e){this.timezoneOverrides=e}refine(e,r){let n=e.option.timezones??{};return r.forEach(o=>{let i=e.text.substring(o.index+o.text.length),a=xzn.exec(i);if(!a)return;let s=a[1].toUpperCase(),u=o.start.date()??o.refDate??new Date,l={...this.timezoneOverrides,...n},c=Cye(s,u,l);if(c==null)return;e.debug(()=>{console.log(`Extracting timezone: '${s}' into: ${c} for: ${o.start}`)});let d=o.start.get("timezoneOffset");d!==null&&c!=d&&(o.start.isCertain("timezoneOffset")||s!=a[1])||o.start.isOnlyDate()&&s!=a[1]||(o.text+=a[0],o.start.isCertain("timezoneOffset")||o.start.assign("timezoneOffset",c),o.end!=null&&!o.end.isCertain("timezoneOffset")&&o.end.assign("timezoneOffset",c))}),r}}});var Szn,Czn,Ozn,Ezn,H7,Jtr=b(()=>{Szn=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),Czn=1,Ozn=2,Ezn=3,H7=class{refine(e,r){return r.forEach(function(n){if(n.start.isCertain("timezoneOffset"))return;let o=e.text.substring(n.index+n.text.length),i=Szn.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[Ozn]),s=parseInt(i[Ezn]||"0"),u=a*60+s;u>14*60||(i[Czn]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}}});var j1,KVe=b(()=>{j1=class{refine(e,r){if(r.length<2)return r;let n=[],o=r[0];for(let i=1;i<r.length;i++){let a=r[i];if(a.index>=o.index+o.text.length){n.push(o),o=a;continue}let s=null,u=null;a.text.length>o.text.length?(s=a,u=o):(s=o,u=a),e.debug(()=>{console.log(`${this.constructor.name} remove ${u} by ${s}`)}),o=s}return o!=null&&n.push(o),n}}});var Ztr,V7,Ytr=b(()=>{Ztr=j(C1(),1);yH();V7=class{refine(e,r){return e.option.forwardDate&&r.forEach(n=>{let o=(0,Ztr.default)(e.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),Jk(n.start,o),n.end&&n.end.isOnlyTime()&&(Jk(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),Jk(n.end,o))),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} time result (${n.start})`)})),n.start.isOnlyWeekdayComponent()&&o.isAfter(n.start.dayjs())&&(o.day()>=n.start.get("weekday")?o=o.day(n.start.get("weekday")+7):o=o.day(n.start.get("weekday")),n.start.imply("day",o.date()),n.start.imply("month",o.month()+1),n.start.imply("year",o.year()),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} weekday (${n.start})`)}),n.end&&n.end.isOnlyWeekdayComponent()&&(o.day()>n.end.get("weekday")?o=o.day(n.end.get("weekday")+7):o=o.day(n.end.get("weekday")),n.end.imply("day",o.date()),n.end.imply("month",o.month()+1),n.end.imply("year",o.year()),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} weekday (${n.end})`)}))),n.start.isDateWithUnknownYear()&&o.isAfter(n.start.dayjs()))for(let i=0;i<3&&o.isAfter(n.start.dayjs());i++)n.start.imply("year",n.start.get("year")+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} year (${n.start})`)}),n.end&&!n.end.isCertain("year")&&(n.end.imply("year",n.end.get("year")+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} month (${n.start})`)}))}),r}}});var W7,Xtr=b(()=>{Zk();W7=class extends Aye{constructor(e){super(),this.strictMode=e}isValid(e,r){return r.text.replace(" ","").match(/^\d*(\.\d*)?$/)?(e.debug(()=>{console.log(`Removing unlikely result '${r.text}'`)}),!1):r.start.isValidDate()?r.end&&!r.end.isValidDate()?(e.debug(()=>{console.log(`Removing invalid result: ${r} (${r.end})`)}),!1):this.strictMode?this.isStrictModeValid(e,r):!0:(e.debug(()=>{console.log(`Removing invalid result: ${r} (${r.start})`)}),!1)}isStrictModeValid(e,r){return r.start.isOnlyWeekdayComponent()?(e.debug(()=>{console.log(`(Strict) Removing weekday only component: ${r} (${r.end})`)}),!1):r.start.isOnlyTime()&&(!r.start.isCertain("hour")||!r.start.isCertain("minute"))?(e.debug(()=>{console.log(`(Strict) Removing uncertain time component: ${r} (${r.end})`)}),!1):!0}}});var Pzn,Tzn,Azn,Izn,Qtr,Mzn,err,trr,Rzn,rrr,nrr,K7,orr=b(()=>{rm();Pzn=new RegExp("([0-9]{4})\\-([0-9]{1,2})\\-([0-9]{1,2})(?:T([0-9]{1,2}):([0-9]{1,2})(?::([0-9]{1,2})(?:\\.(\\d{1,4}))?)?(Z|([+-]\\d{2}):?(\\d{2})?)?)?(?=\\W|$)","i"),Tzn=1,Azn=2,Izn=3,Qtr=4,Mzn=5,err=6,trr=7,Rzn=8,rrr=9,nrr=10,K7=class extends ji{innerPattern(){return Pzn}innerExtract(e,r){let n=e.createParsingComponents({year:parseInt(r[Tzn]),month:parseInt(r[Azn]),day:parseInt(r[Izn])});if(r[Qtr]!=null&&(n.assign("hour",parseInt(r[Qtr])),n.assign("minute",parseInt(r[Mzn])),r[err]!=null&&n.assign("second",parseInt(r[err])),r[trr]!=null&&n.assign("millisecond",parseInt(r[trr])),r[Rzn]!=null)){let o=0;if(r[rrr]){let i=parseInt(r[rrr]),a=0;r[nrr]!=null&&(a=parseInt(r[nrr])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}}});var G7,irr=b(()=>{Zk();G7=class extends ab{mergeResults(e,r,n){let o=n.clone();return o.index=r.index,o.text=r.text+e+o.text,o.start.assign("weekday",r.start.get("weekday")),o.end&&o.end.assign("weekday",r.start.get("weekday")),o}shouldMergeResults(e,r,n){return r.start.isOnlyWeekdayComponent()&&!r.start.isCertain("hour")&&n.start.isCertain("day")&&e.match(/^,?\s*$/)!=null}}});function arr(t,e=!1){return t.parsers.unshift(new K7),t.refiners.unshift(new G7),t.refiners.unshift(new H7),t.refiners.unshift(new j1),t.refiners.push(new q7),t.refiners.push(new j1),t.refiners.push(new V7),t.refiners.push(new W7(e)),t}var srr=b(()=>{Gtr();Jtr();KVe();Ytr();Xtr();orr();irr()});function urr(t){let e=(0,CH.default)(t.instant),r=new Lo(t,{});return H_(r,e),Sye(r,e),t.timezoneOffset!==null&&r.assign("timezoneOffset",e.utcOffset()),r.addTag("casualReference/now"),r}function lrr(t){let e=(0,CH.default)(t.instant),r=new Lo(t,{});return H_(r,e),gH(r,e),r.addTag("casualReference/today"),r}function crr(t){return Nzn(t,1).addTag("casualReference/yesterday")}function Nzn(t,e){return frr(t,-e)}function drr(t){return frr(t,1).addTag("casualReference/tomorrow")}function frr(t,e){let r=(0,CH.default)(t.instant),n=new Lo(t,{});return r=r.add(e,"day"),H_(n,r),gH(n,r),n}function prr(t,e=22){let r=(0,CH.default)(t.instant),n=new Lo(t,{});return H_(n,r),n.imply("hour",e),n.imply("meridiem",Do.PM),n.addTag("casualReference/tonight"),n}function mrr(t,e=20){let r=new Lo(t,{});return r.imply("meridiem",Do.PM),r.imply("hour",e),r.addTag("casualReference/evening"),r}function hrr(t){let e=new Lo(t,{}),r=(0,CH.default)(t.instant);return r.hour()>2&&htr(e,r),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function grr(t,e=6){let r=new Lo(t,{});return r.imply("meridiem",Do.AM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function yrr(t,e=15){let r=new Lo(t,{});return r.imply("meridiem",Do.PM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function brr(t){let e=new Lo(t,{});return e.imply("meridiem",Do.AM),e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var CH,GVe=b(()=>{V_();CH=j(C1(),1);yH();O1()});var vrr,jzn,J7,wrr=b(()=>{vrr=j(C1(),1);rm();yH();GVe();jzn=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,J7=class extends ji{innerPattern(e){return jzn}innerExtract(e,r){let n=(0,vrr.default)(e.refDate),o=r[0].toLowerCase(),i=e.createParsingComponents();switch(o){case"now":i=urr(e.reference);break;case"today":i=lrr(e.reference);break;case"yesterday":i=crr(e.reference);break;case"tomorrow":case"tmr":case"tmrw":i=drr(e.reference);break;case"tonight":i=prr(e.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),H_(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}}});var Dzn,Z7,xrr=b(()=>{rm();GVe();Dzn=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,Z7=class extends ji{innerPattern(){return Dzn}innerExtract(e,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=yrr(e.reference);break;case"evening":case"night":n=mrr(e.reference);break;case"midnight":n=hrr(e.reference);break;case"morning":n=grr(e.reference);break;case"noon":case"midday":n=brr(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}}});function Srr(t,e,r){let n=t.getDateWithAdjustedTimezone(),o=Lzn(n,e,r),i=new Lo(t);return i=$tr(i,{day:o}),i.assign("weekday",e),i}function Lzn(t,e,r){let n=t.getDay();switch(r){case"this":return Iye(t,e);case"last":return Crr(t,e);case"next":return n==Zl.SUNDAY?e==Zl.SUNDAY?7:e:n==Zl.SATURDAY?e==Zl.SATURDAY?7:e==Zl.SUNDAY?8:1+e:e<n&&e!=Zl.SUNDAY?Iye(t,e):Iye(t,e)+7}return Fzn(t,e)}function Fzn(t,e){let r=Crr(t,e),n=Iye(t,e);return n<-r?n:r}function Iye(t,e){let r=t.getDay(),n=e-r;return n<0&&(n+=7),n}function Crr(t,e){let r=t.getDay(),n=e-r;return n>=0&&(n-=7),n}var Orr=b(()=>{O1();V_();xH()});var kzn,$zn,Bzn,zzn,Y7,Err=b(()=>{Tc();T1();rm();Orr();kzn=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${rf(UVe)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),$zn=1,Bzn=2,zzn=3,Y7=class extends ji{innerPattern(){return kzn}innerExtract(e,r){let n=r[Bzn].toLowerCase(),o=UVe[n],i=r[$zn],a=r[zzn],s=i||a;s=s||"",s=s.toLowerCase();let u=null;return s=="last"||s=="past"?u="last":s=="next"?u="next":s=="this"&&(u="this"),Srr(e.reference,o,u)}}});var Prr,Uzn,qzn,Hzn,X7,Trr=b(()=>{Tc();V_();Prr=j(C1(),1);rm();T1();Uzn=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${rf(A7)})(?=\\s*)(?=\\W|$)`,"i"),qzn=1,Hzn=2,X7=class extends ji{innerPattern(){return Uzn}innerExtract(e,r){let n=r[qzn].toLowerCase(),o=r[Hzn].toLowerCase(),i=A7[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,Lo.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,Lo.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),s=(0,Prr.default)(e.reference.instant);return o.match(/week/i)?(s=s.add(-s.get("d"),"d"),a.imply("day",s.date()),a.imply("month",s.month()+1),a.imply("year",s.year())):o.match(/month/i)?(s=s.add(-s.date()+1,"d"),a.imply("day",s.date()),a.assign("year",s.year()),a.assign("month",s.month()+1)):o.match(/year/i)&&(s=s.add(-s.date()+1,"d"),s=s.add(-s.month(),"month"),a.imply("day",s.date()),a.imply("month",s.month()+1),a.assign("year",s.year())),a}}});var Vzn,Wzn,Kzn,Arr,Irr,JVe,Q7,Mrr=b(()=>{bH();Vzn=new RegExp("([^\\d]|^)([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?(\\W|$)","i"),Wzn=1,Kzn=5,Arr=2,Irr=3,JVe=4,Q7=class{constructor(e){this.groupNumberMonth=e?Irr:Arr,this.groupNumberDay=e?Arr:Irr}pattern(){return Vzn}extract(e,r){let n=r.index+r[Wzn].length,o=r.index+r[0].length-r[Kzn].length;if(n>0&&e.text.substring(0,n).match("\\d/?$")||o<e.text.length&&e.text.substring(o).match("^/?\\d"))return;let i=e.text.substring(n,o);if(i.match(/^\d\.\d$/)||i.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)||!r[JVe]&&i.indexOf("/")<0)return;let a=e.createParsingResult(n,i),s=parseInt(r[this.groupNumberMonth]),u=parseInt(r[this.groupNumberDay]);if((s<1||s>12)&&s>12)if(u>=1&&u<=12&&s<=31)[u,s]=[s,u];else return null;if(u<1||u>31)return null;if(a.start.assign("day",u),a.start.assign("month",s),r[JVe]){let l=parseInt(r[JVe]),c=Oye(l);a.start.assign("year",c)}else{let l=A1(e.refDate,u,s);a.start.imply("year",l)}return a}}});var Gzn,Jzn,eZ,Rrr=b(()=>{Tc();V_();rm();xH();Gzn=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${tA})(?=\\W|$)`,"i"),Jzn=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${R1})(?=\\W|$)`,"i"),eZ=class extends ji{constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?Gzn:Jzn}innerExtract(e,r){let n=r[1].toLowerCase(),o=ib(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=N1(o);break}return Lo.createRelativeFromReference(e.reference,o)}}});function Zzn(t){return t.text.match(/^[+-]/i)!=null}function Nrr(t){return t.text.match(/^-/i)!=null}var tZ,jrr=b(()=>{Zk();V_();Tc();xH();tZ=class extends ab{shouldMergeResults(e,r,n){return e.match(/^\s*$/i)?Zzn(n)||Nrr(n):!1}mergeResults(e,r,n,o){let i=ib(n.text);Nrr(n)&&(i=N1(i));let a=Lo.createRelativeFromReference(new P1(r.start.date()),i);return new eA(r.reference,r.index,`${r.text}${e}${n.text}`,a)}}});function Drr(t){return t.text.match(/\s+(before|from)$/i)!=null}function Yzn(t){return t.text.match(/\s+(after|since)$/i)!=null}var rZ,Lrr=b(()=>{Zk();V_();Tc();xH();rZ=class extends ab{patternBetween(){return/^\s*$/i}shouldMergeResults(e,r,n){return!e.match(this.patternBetween())||!Drr(r)&&!Yzn(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,r,n){let o=ib(r.text);Drr(r)&&(o=N1(o));let i=Lo.createRelativeFromReference(new P1(n.start.date()),o);return new eA(n.reference,r.index,`${r.text}${e}${n.text}`,i)}}});var Xzn,Qzn,nZ,Frr=b(()=>{Tc();Xzn=new RegExp(`^\\s*(${I1})`,"i"),Qzn=1,nZ=class{refine(e,r){return r.forEach(function(n){if(!n.start.isDateWithUnknownYear())return;let o=e.text.substring(n.index+n.text.length),i=Xzn.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=M1(i[Qzn]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}}});var Yk,ZVe=b(()=>{Ctr();Ttr();Itr();Rtr();jtr();Dtr();ktr();Btr();ztr();qtr();Ktr();srr();wrr();xrr();Err();Trr();Mrr();Rrr();jrr();Lrr();KVe();Frr();Yk=class{createCasualConfiguration(e=!1){let r=this.createConfiguration(!1,e);return r.parsers.push(new J7),r.parsers.push(new Z7),r.parsers.push(new N7),r.parsers.push(new X7),r.parsers.push(new eZ),r}createConfiguration(e=!0,r=!1){let n=arr({parsers:[new Q7(r),new I7(e),new M7,new R7(r),new Y7,new D7,new F7(e),new k7(e),new $7(e)],refiners:[new SH]},e);return n.parsers.unshift(new j7(e)),n.refiners.unshift(new rZ),n.refiners.unshift(new tZ),n.refiners.unshift(new j1),n.refiners.push(new SH),n.refiners.push(new nZ),n.refiners.push(new z7),n}}});var OH,YVe,krr=b(()=>{V_();ZVe();OH=class t{constructor(e){this.defaultConfig=new Yk,e=e||this.defaultConfig.createCasualConfiguration(),this.parsers=[...e.parsers],this.refiners=[...e.refiners]}clone(){return new t({parsers:[...this.parsers],refiners:[...this.refiners]})}parseDate(e,r,n){let o=this.parse(e,r,n);return o.length>0?o[0].start.date():null}parse(e,r,n){let o=new YVe(e,r,n),i=[];return this.parsers.forEach(a=>{let s=t.executeParser(o,a);i=i.concat(s)}),i.sort((a,s)=>a.index-s.index),this.refiners.forEach(function(a){i=a.refine(o,i)}),i}static executeParser(e,r){let n=[],o=r.pattern(e),i=e.text,a=e.text,s=o.exec(a);for(;s;){let u=s.index+i.length-a.length;s.index=u;let l=r.extract(e,s);if(!l){a=i.substring(s.index+1),s=o.exec(a);continue}let c=null;l instanceof eA?c=l:l instanceof Lo?(c=e.createParsingResult(s.index,s[0]),c.start=l):c=e.createParsingResult(s.index,s[0],l);let d=c.index,f=c.text;e.debug(()=>console.log(`${r.constructor.name} extracted (at index=${d}) '${f}'`)),n.push(c),a=i.substring(d+f.length),s=o.exec(a)}return n}},YVe=class{constructor(e,r,n){this.text=e,this.reference=new P1(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof Lo?e:new Lo(this.reference,e)}createParsingResult(e,r,n,o){let i=typeof r=="string"?r:this.text.substring(e,r),a=n?this.createParsingComponents(n):null,s=o?this.createParsingComponents(o):null;return new eA(this.reference,e,i,a,s)}debug(e){this.option.debug&&(this.option.debug instanceof Function?this.option.debug(e):this.option.debug.debug(e))}}});var XVe,$rr,eUn,Zji,Brr=b(()=>{krr();ZVe();XVe=new Yk,$rr=new OH(XVe.createCasualConfiguration(!1)),eUn=new OH(XVe.createConfiguration(!0,!1)),Zji=new OH(XVe.createCasualConfiguration(!0))});function QVe(t,e,r){return zrr.parse(t,e,r)}function Urr(t,e,r){return zrr.parseDate(t,e,r)}var zrr,qrr=b(()=>{Brr();zrr=$rr});var rA,Mye,Rye,Nye,W_,EH,Vs,K_,D1=b(()=>{rA=class extends Error{},Mye=class extends rA{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Rye=class extends rA{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Nye=class extends rA{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},W_=class extends rA{},EH=class extends rA{constructor(e){super(`Invalid unit ${e}`)}},Vs=class extends rA{},K_=class extends rA{constructor(){super("Zone is an abstract class")}}});var ft,G_,Cg,L1,oZ,e6e,iZ,aZ,sZ,uZ,lZ,cZ,dZ,fZ,pZ,mZ,hZ,gZ,yZ,bZ,t6e,_Z,vZ,wZ,xZ,SZ=b(()=>{ft="numeric",G_="short",Cg="long",L1={year:ft,month:ft,day:ft},oZ={year:ft,month:G_,day:ft},e6e={year:ft,month:G_,day:ft,weekday:G_},iZ={year:ft,month:Cg,day:ft},aZ={year:ft,month:Cg,day:ft,weekday:Cg},sZ={hour:ft,minute:ft},uZ={hour:ft,minute:ft,second:ft},lZ={hour:ft,minute:ft,second:ft,timeZoneName:G_},cZ={hour:ft,minute:ft,second:ft,timeZoneName:Cg},dZ={hour:ft,minute:ft,hourCycle:"h23"},fZ={hour:ft,minute:ft,second:ft,hourCycle:"h23"},pZ={hour:ft,minute:ft,second:ft,hourCycle:"h23",timeZoneName:G_},mZ={hour:ft,minute:ft,second:ft,hourCycle:"h23",timeZoneName:Cg},hZ={year:ft,month:ft,day:ft,hour:ft,minute:ft},gZ={year:ft,month:ft,day:ft,hour:ft,minute:ft,second:ft},yZ={year:ft,month:G_,day:ft,hour:ft,minute:ft},bZ={year:ft,month:G_,day:ft,hour:ft,minute:ft,second:ft},t6e={year:ft,month:G_,day:ft,weekday:G_,hour:ft,minute:ft},_Z={year:ft,month:Cg,day:ft,hour:ft,minute:ft,timeZoneName:G_},vZ={year:ft,month:Cg,day:ft,hour:ft,minute:ft,second:ft,timeZoneName:G_},wZ={year:ft,month:Cg,day:ft,weekday:Cg,hour:ft,minute:ft,timeZoneName:Cg},xZ={year:ft,month:Cg,day:ft,weekday:Cg,hour:ft,minute:ft,second:ft,timeZoneName:Cg}});var bh,Xk=b(()=>{D1();bh=class{get type(){throw new K_}get name(){throw new K_}get ianaName(){return this.name}get isUniversal(){throw new K_}offsetName(e,r){throw new K_}formatOffset(e,r){throw new K_}offset(e){throw new K_}equals(e){throw new K_}get isValid(){throw new K_}}});var r6e,F1,Dye=b(()=>{nm();Xk();r6e=null,F1=class t extends bh{static get instance(){return r6e===null&&(r6e=new t),r6e}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Lye(e,r,n)}formatOffset(e,r){return k1(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}});function nUn(t){return kye[t]||(kye[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),kye[t]}function iUn(t,e){let r=t.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,o,i,a,s,u,l,c]=n;return[a,o,i,s,u,l,c]}function aUn(t,e){let r=t.formatToParts(e),n=[];for(let o=0;o<r.length;o++){let{type:i,value:a}=r[o],s=oUn[i];i==="era"?n[s]=a:hr(s)||(n[s]=parseInt(a,10))}return n}var kye,oUn,Fye,lp,$1=b(()=>{nm();Xk();kye={};oUn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};Fye={},lp=class t extends bh{static create(e){return Fye[e]||(Fye[e]=new t(e)),Fye[e]}static resetCache(){Fye={},kye={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Lye(e,r,n,this.name)}formatOffset(e,r){return k1(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=nUn(this.name),[o,i,a,s,u,l,c]=n.formatToParts?aUn(n,r):iUn(n,r);s==="BC"&&(o=-Math.abs(o)+1);let f=PH({year:o,month:i,day:a,hour:u===24?0:u,minute:l,second:c,millisecond:0}),p=+r,m=p%1e3;return p-=m>=0?m:1e3+m,(f-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}});function sUn(t,e={}){let r=JSON.stringify([t,e]),n=Hrr[r];return n||(n=new Intl.ListFormat(t,e),Hrr[r]=n),n}function o6e(t,e={}){let r=JSON.stringify([t,e]),n=n6e[r];return n||(n=new Intl.DateTimeFormat(t,e),n6e[r]=n),n}function uUn(t,e={}){let r=JSON.stringify([t,e]),n=i6e[r];return n||(n=new Intl.NumberFormat(t,e),i6e[r]=n),n}function lUn(t,e={}){let{base:r,...n}=e,o=JSON.stringify([t,n]),i=a6e[o];return i||(i=new Intl.RelativeTimeFormat(t,e),a6e[o]=i),i}function cUn(){return CZ||(CZ=new Intl.DateTimeFormat().resolvedOptions().locale,CZ)}function dUn(t){let e=Vrr[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,Vrr[t]=e}return e}function fUn(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let r=t.indexOf("-u-");if(r===-1)return[t];{let n,o;try{n=o6e(t).resolvedOptions(),o=t}catch{let u=t.substring(0,r);n=o6e(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function pUn(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function mUn(t){let e=[];for(let r=1;r<=12;r++){let n=Er.utc(2009,r,1);e.push(t(n))}return e}function hUn(t){let e=[];for(let r=1;r<=7;r++){let n=Er.utc(2016,11,13+r);e.push(t(n))}return e}function $ye(t,e,r,n){let o=t.listingMode();return o==="error"?null:o==="en"?r(e):n(e)}function gUn(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}var Hrr,n6e,i6e,a6e,CZ,Vrr,s6e,u6e,l6e,yUn,hi,EZ=b(()=>{nm();Uye();B1();z1();$1();Hrr={};n6e={};i6e={};a6e={};CZ=null;Vrr={};s6e=class{constructor(e,r,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:o,floor:i,...a}=n;if(!r||Object.keys(a).length>0){let s={useGrouping:!1,...n};n.padTo>0&&(s.minimumIntegerDigits=n.padTo),this.inf=uUn(e,s)}}format(e){if(this.inf){let r=this.floor?Math.floor(e):e;return this.inf.format(r)}else{let r=this.floor?Math.floor(e):TH(e,3);return Ss(r,this.padTo)}}},u6e=class{constructor(e,r,n){this.opts=n,this.originalZone=void 0;let o;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let a=-1*(e.offset/60),s=a>=0?`Etc/GMT+${a}`:`Etc/GMT${a}`;e.offset!==0&&lp.create(s).valid?(o=s,this.dt=e):(o="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,o=e.zone.name):(o="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let i={...this.opts};i.timeZone=i.timeZone||o,this.dtf=o6e(r,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(r=>{if(r.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:n}}else return r}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},l6e=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&Bye()&&(this.rtf=lUn(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):Wrr(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},yUn={firstDay:1,minimalDays:4,weekend:[6,7]},hi=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,r,n,o,i=!1){let a=e||mi.defaultLocale,s=a||(i?"en-US":cUn()),u=r||mi.defaultNumberingSystem,l=n||mi.defaultOutputCalendar,c=OZ(o)||mi.defaultWeekSettings;return new t(s,u,l,c,a)}static resetCache(){CZ=null,n6e={},i6e={},a6e={}}static fromObject({locale:e,numberingSystem:r,outputCalendar:n,weekSettings:o}={}){return t.create(e,r,n,o)}constructor(e,r,n,o,i){let[a,s,u]=fUn(e);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=pUn(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=gUn(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&r?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:t.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,OZ(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,r=!1){return $ye(this,e,c6e,()=>{let n=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=mUn(i=>this.extract(i,n,"month"))),this.monthsCache[o][e]})}weekdays(e,r=!1){return $ye(this,e,d6e,()=>{let n=r?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},o=r?"format":"standalone";return this.weekdaysCache[o][e]||(this.weekdaysCache[o][e]=hUn(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return $ye(this,void 0,()=>f6e,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Er.utc(2016,11,13,9),Er.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return $ye(this,e,p6e,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[Er.utc(-40,1,1),Er.utc(2017,1,1)].map(n=>this.extract(n,r,"era"))),this.eraCache[e]})}extract(e,r,n){let o=this.dtFormatter(e,r),i=o.formatToParts(),a=i.find(s=>s.type.toLowerCase()===n);return a?a.value:null}numberFormatter(e={}){return new s6e(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new u6e(e,this.intl,r)}relFormatter(e={}){return new l6e(this.intl,this.isEnglish(),e)}listFormatter(e={}){return sUn(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:zye()?dUn(this.locale):yUn}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}});var h6e,ud,AH=b(()=>{nm();Xk();h6e=null,ud=class t extends bh{static get utcInstance(){return h6e===null&&(h6e=new t(0)),h6e}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let r=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new t(Qk(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${k1(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${k1(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return k1(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}});var IH,g6e=b(()=>{Xk();IH=class extends bh{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}});function J_(t,e){let r;if(hr(t)||t===null)return e;if(t instanceof bh)return t;if(Krr(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?F1.instance:n==="utc"||n==="gmt"?ud.utcInstance:ud.parseSpecifier(n)||lp.create(t)}else return Z_(t)?ud.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new IH(t)}var qye=b(()=>{Xk();$1();AH();g6e();nm();Dye()});function Jrr(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r);if(t[r].search(y6e.hanidec)!==-1)e+=bUn.indexOf(t[r]);else for(let o in Grr){let[i,a]=Grr[o];n>=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}function Zrr(){MH={}}function sb({numberingSystem:t},e=""){let r=t||"latn";return MH[r]||(MH[r]={}),MH[r][e]||(MH[r][e]=new RegExp(`${y6e[r]}${e}`)),MH[r][e]}var y6e,Grr,bUn,MH,b6e=b(()=>{y6e={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},Grr={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},bUn=y6e.hanidec.replace(/[\[|\]]/g,"").split("");MH={}});var Yrr,Xrr,Qrr,enr,tnr,rnr,nnr,onr,mi,B1=b(()=>{Dye();$1();EZ();z1();qye();nm();b6e();Yrr=()=>Date.now(),Xrr="system",Qrr=null,enr=null,tnr=null,rnr=60,onr=null,mi=class{static get now(){return Yrr}static set now(e){Yrr=e}static set defaultZone(e){Xrr=e}static get defaultZone(){return J_(Xrr,F1.instance)}static get defaultLocale(){return Qrr}static set defaultLocale(e){Qrr=e}static get defaultNumberingSystem(){return enr}static set defaultNumberingSystem(e){enr=e}static get defaultOutputCalendar(){return tnr}static set defaultOutputCalendar(e){tnr=e}static get defaultWeekSettings(){return onr}static set defaultWeekSettings(e){onr=OZ(e)}static get twoDigitCutoffYear(){return rnr}static set twoDigitCutoffYear(e){rnr=e%100}static get throwOnInvalid(){return nnr}static set throwOnInvalid(e){nnr=e}static resetCaches(){hi.resetCache(),lp.resetCache(),Er.resetCache(),Zrr()}}});var ld,PZ=b(()=>{ld=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}});function ub(t,e){return new ld("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Hye(t,e,r){let n=new Date(Date.UTC(t,e-1,r));t<100&&t>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let o=n.getUTCDay();return o===0?7:o}function snr(t,e,r){return r+(t$(t)?anr:inr)[e-1]}function unr(t,e){let r=t$(t)?anr:inr,n=r.findIndex(i=>i<e),o=e-r[n];return{month:n+1,day:o}}function Vye(t,e){return(t-e+7)%7+1}function TZ(t,e=4,r=1){let{year:n,month:o,day:i}=t,a=snr(n,o,i),s=Vye(Hye(n,o,i),r),u=Math.floor((a-s+14-e)/7),l;return u<1?(l=n-1,u=e$(l,e,r)):u>e$(n,e,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...IZ(t)}}function _6e(t,e=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=t,a=Vye(Hye(n,1,e),r),s=U1(n),u=o*7+i-a-7+e,l;u<1?(l=n-1,u+=U1(l)):u>s?(l=n+1,u-=U1(n)):l=n;let{month:c,day:d}=unr(l,u);return{year:l,month:c,day:d,...IZ(t)}}function Wye(t){let{year:e,month:r,day:n}=t,o=snr(e,r,n);return{year:e,ordinal:o,...IZ(t)}}function v6e(t){let{year:e,ordinal:r}=t,{month:n,day:o}=unr(e,r);return{year:e,month:n,day:o,...IZ(t)}}function w6e(t,e){if(!hr(t.localWeekday)||!hr(t.localWeekNumber)||!hr(t.localWeekYear)){if(!hr(t.weekday)||!hr(t.weekNumber)||!hr(t.weekYear))throw new W_("Cannot mix locale-based week fields with ISO-based week fields");return hr(t.localWeekday)||(t.weekday=t.localWeekday),hr(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),hr(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function lnr(t,e=4,r=1){let n=AZ(t.weekYear),o=Og(t.weekNumber,1,e$(t.weekYear,e,r)),i=Og(t.weekday,1,7);return n?o?i?!1:ub("weekday",t.weekday):ub("week",t.weekNumber):ub("weekYear",t.weekYear)}function cnr(t){let e=AZ(t.year),r=Og(t.ordinal,1,U1(t.year));return e?r?!1:ub("ordinal",t.ordinal):ub("year",t.year)}function x6e(t){let e=AZ(t.year),r=Og(t.month,1,12),n=Og(t.day,1,RH(t.year,t.month));return e?r?n?!1:ub("day",t.day):ub("month",t.month):ub("year",t.year)}function S6e(t){let{hour:e,minute:r,second:n,millisecond:o}=t,i=Og(e,0,23)||e===24&&r===0&&n===0&&o===0,a=Og(r,0,59),s=Og(n,0,59),u=Og(o,0,999);return i?a?s?u?!1:ub("millisecond",o):ub("second",n):ub("minute",r):ub("hour",e)}var inr,anr,C6e=b(()=>{nm();PZ();D1();inr=[0,31,59,90,120,151,181,212,243,273,304,334],anr=[0,31,60,91,121,152,182,213,244,274,305,335]});function hr(t){return typeof t>"u"}function Z_(t){return typeof t=="number"}function AZ(t){return typeof t=="number"&&t%1===0}function Krr(t){return typeof t=="string"}function fnr(t){return Object.prototype.toString.call(t)==="[object Date]"}function Bye(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function zye(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function pnr(t){return Array.isArray(t)?t:[t]}function O6e(t,e,r){if(t.length!==0)return t.reduce((n,o)=>{let i=[e(o),o];return n&&r(n[0],i[0])===n[0]?n:i},null)[1]}function mnr(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function q1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function OZ(t){if(t==null)return null;if(typeof t!="object")throw new Vs("Week settings must be an object");if(!Og(t.firstDay,1,7)||!Og(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Og(e,1,7)))throw new Vs("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Og(t,e,r){return AZ(t)&&t>=e&&t<=r}function _Un(t,e){return t-e*Math.floor(t/e)}function Ss(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function nA(t){if(!(hr(t)||t===null||t===""))return parseInt(t,10)}function H1(t){if(!(hr(t)||t===null||t===""))return parseFloat(t)}function MZ(t){if(!(hr(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function TH(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function t$(t){return t%4===0&&(t%100!==0||t%400===0)}function U1(t){return t$(t)?366:365}function RH(t,e){let r=_Un(e-1,12)+1,n=t+(e-r)/12;return r===2?t$(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function PH(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function dnr(t,e,r){return-Vye(Hye(t,1,e),r)+e-1}function e$(t,e=4,r=1){let n=dnr(t,e,r),o=dnr(t+1,e,r);return(U1(t)-n+o)/7}function RZ(t){return t>99?t:t>mi.twoDigitCutoffYear?1900+t:2e3+t}function Lye(t,e,r,n=null){let o=new Date(t),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(i.timeZone=n);let a={timeZoneName:e,...i},s=new Intl.DateTimeFormat(r,a).formatToParts(o).find(u=>u.type.toLowerCase()==="timezonename");return s?s.value:null}function Qk(t,e){let r=parseInt(t,10);Number.isNaN(r)&&(r=0);let n=parseInt(e,10)||0,o=r<0||Object.is(r,-0)?-n:n;return r*60+o}function E6e(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Vs(`Invalid unit value ${t}`);return e}function NH(t,e){let r={};for(let n in t)if(q1(t,n)){let o=t[n];if(o==null)continue;r[e(n)]=E6e(o)}return r}function k1(t,e){let r=Math.trunc(Math.abs(t/60)),n=Math.trunc(Math.abs(t%60)),o=t>=0?"+":"-";switch(e){case"short":return`${o}${Ss(r,2)}:${Ss(n,2)}`;case"narrow":return`${o}${r}${n>0?`:${n}`:""}`;case"techie":return`${o}${Ss(r,2)}${Ss(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function IZ(t){return mnr(t,["hour","minute","second","millisecond"])}var nm=b(()=>{D1();B1();C6e()});function c6e(t){switch(t){case"narrow":return[...wUn];case"short":return[...P6e];case"long":return[...vUn];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}function d6e(t){switch(t){case"narrow":return[...xUn];case"short":return[...A6e];case"long":return[...T6e];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}function p6e(t){switch(t){case"narrow":return[...OUn];case"short":return[...CUn];case"long":return[...SUn];default:return null}}function hnr(t){return f6e[t.hour<12?0:1]}function gnr(t,e){return d6e(e)[t.weekday-1]}function ynr(t,e){return c6e(e)[t.month-1]}function bnr(t,e){return p6e(e)[t.year<0?0:1]}function Wrr(t,e,r="always",n=!1){let o={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(t)===-1;if(r==="auto"&&i){let d=t==="days";switch(e){case 1:return d?"tomorrow":`next ${o[t][0]}`;case-1:return d?"yesterday":`last ${o[t][0]}`;case 0:return d?"today":`this ${o[t][0]}`;default:}}let a=Object.is(e,-0)||e<0,s=Math.abs(e),u=s===1,l=o[t],c=n?u?l[1]:l[2]||l[1]:u?o[t][0]:t;return a?`${s} ${c} ago`:`in ${s} ${c}`}var vUn,P6e,wUn,T6e,A6e,xUn,f6e,SUn,CUn,OUn,Uye=b(()=>{SZ();nm();vUn=["January","February","March","April","May","June","July","August","September","October","November","December"],P6e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wUn=["J","F","M","A","M","J","J","A","S","O","N","D"];T6e=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],A6e=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],xUn=["M","T","W","T","F","S","S"];f6e=["AM","PM"],SUn=["Before Christ","Anno Domini"],CUn=["BC","AD"],OUn=["B","A"]});function _nr(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var EUn,cd,NZ=b(()=>{Uye();SZ();nm();EUn={D:L1,DD:oZ,DDD:iZ,DDDD:aZ,t:sZ,tt:uZ,ttt:lZ,tttt:cZ,T:dZ,TT:fZ,TTT:pZ,TTTT:mZ,f:hZ,ff:yZ,fff:_Z,ffff:wZ,F:gZ,FF:bZ,FFF:vZ,FFFF:xZ},cd=class t{static create(e,r={}){return new t(e,r)}static parseFormat(e){let r=null,n="",o=!1,i=[];for(let a=0;a<e.length;a++){let s=e.charAt(a);s==="'"?(n.length>0&&i.push({literal:o||/^\s+$/.test(n),val:n}),r=null,n="",o=!o):o||s===r?n+=s:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=s,r=s)}return n.length>0&&i.push({literal:o||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return EUn[e]}constructor(e,r){this.opts=r,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...r}).format()}dtFormatter(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r})}formatDateTime(e,r){return this.dtFormatter(e,r).format()}formatDateTimeParts(e,r){return this.dtFormatter(e,r).formatToParts()}formatInterval(e,r){return this.dtFormatter(e.start,r).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,r){return this.dtFormatter(e,r).resolvedOptions()}num(e,r=0){if(this.opts.forceSimple)return Ss(e,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let n=this.loc.listingMode()==="en",o=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(p,m)=>this.loc.extract(e,p,m),a=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",s=()=>n?hnr(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,m)=>n?ynr(e,p):i(m?{month:p}:{month:p,day:"numeric"},"month"),l=(p,m)=>n?gnr(e,p):i(m?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),c=p=>{let m=t.macroTokenToFormatOpts(p);return m?this.formatWithSystemDefault(e,m):p},d=p=>n?bnr(e,p):i({era:p},"era"),f=p=>{switch(p){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return a({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return a({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return a({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return s();case"d":return o?i({day:"numeric"},"day"):this.num(e.day);case"dd":return o?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return o?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return o?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return o?i({month:"numeric"},"month"):this.num(e.month);case"MM":return o?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return o?i({year:"numeric"},"year"):this.num(e.year);case"yy":return o?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return o?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return o?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(p)}};return _nr(t.parseFormat(r),f)}formatDurationFromString(e,r){let n=u=>{switch(u[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},o=u=>l=>{let c=n(l);return c?this.num(u.get(c),l.length):l},i=t.parseFormat(r),a=i.reduce((u,{literal:l,val:c})=>l?u:u.concat(c),[]),s=e.shiftTo(...a.map(n).filter(u=>u));return _nr(i,o(s))}}});function DH(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function LH(...t){return e=>t.reduce(([r,n,o],i)=>{let[a,s,u]=i(e,o);return[{...r,...a},s||n,u]},[{},null,1]).slice(0,2)}function FH(t,...e){if(t==null)return[null,null];for(let[r,n]of e){let o=r.exec(t);if(o)return n(o)}return[null,null]}function xnr(...t){return(e,r)=>{let n={},o;for(o=0;o<t.length;o++)n[t[o]]=nA(e[r+o]);return[n,null,r+o]}}function jH(t,e,r){let n=t[e];return hr(n)?r:nA(n)}function DUn(t,e){return[{year:jH(t,e),month:jH(t,e+1,1),day:jH(t,e+2,1)},null,e+3]}function kH(t,e){return[{hours:jH(t,e,0),minutes:jH(t,e+1,0),seconds:jH(t,e+2,0),milliseconds:MZ(t[e+3])},null,e+4]}function jZ(t,e){let r=!t[e]&&!t[e+1],n=Qk(t[e+1],t[e+2]),o=r?null:ud.instance(n);return[{},o,e+3]}function DZ(t,e){let r=t[e]?lp.create(t[e]):null;return[{},r,e+1]}function kUn(t){let[e,r,n,o,i,a,s,u,l]=t,c=e[0]==="-",d=u&&u[0]==="-",f=(p,m=!1)=>p!==void 0&&(m||p&&c)?-p:p;return[{years:f(H1(r)),months:f(H1(n)),weeks:f(H1(o)),days:f(H1(i)),hours:f(H1(a)),minutes:f(H1(s)),seconds:f(H1(u),u==="-0"),milliseconds:f(MZ(l),d)}]}function R6e(t,e,r,n,o,i,a){let s={year:e.length===2?RZ(nA(e)):nA(e),month:P6e.indexOf(r)+1,day:nA(n),hour:nA(o),minute:nA(i)};return a&&(s.second=nA(a)),t&&(s.weekday=t.length>3?T6e.indexOf(t)+1:A6e.indexOf(t)+1),s}function zUn(t){let[,e,r,n,o,i,a,s,u,l,c,d]=t,f=R6e(e,o,n,r,i,a,s),p;return u?p=$Un[u]:l?p=0:p=Qk(c,d),[f,new ud(p)]}function UUn(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}function vnr(t){let[,e,r,n,o,i,a,s]=t;return[R6e(e,o,n,r,i,a,s),ud.utcInstance]}function WUn(t){let[,e,r,n,o,i,a,s]=t;return[R6e(e,s,r,n,o,i,a),ud.utcInstance]}function Pnr(t){return FH(t,[KUn,Enr],[GUn,YUn],[JUn,XUn],[ZUn,QUn])}function Tnr(t){return FH(UUn(t),[BUn,zUn])}function Anr(t){return FH(t,[qUn,vnr],[HUn,vnr],[VUn,WUn])}function Inr(t){return FH(t,[FUn,kUn])}function Mnr(t){return FH(t,[LUn,eqn])}function Rnr(t){return FH(t,[tqn,Enr],[rqn,nqn])}var wnr,Snr,PUn,I6e,Cnr,M6e,TUn,AUn,IUn,MUn,RUn,NUn,Onr,jUn,LUn,FUn,$Un,BUn,qUn,HUn,VUn,KUn,GUn,JUn,ZUn,Enr,YUn,XUn,QUn,eqn,tqn,rqn,nqn,N6e=b(()=>{nm();Uye();AH();$1();wnr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;Snr=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,PUn=`(?:${Snr.source}?(?:\\[(${wnr.source})\\])?)?`,I6e=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Cnr=RegExp(`${I6e.source}${PUn}`),M6e=RegExp(`(?:T${Cnr.source})?`),TUn=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,AUn=/(\d{4})-?W(\d\d)(?:-?(\d))?/,IUn=/(\d{4})-?(\d{3})/,MUn=xnr("weekYear","weekNumber","weekDay"),RUn=xnr("year","ordinal"),NUn=/(\d{4})-(\d\d)-(\d\d)/,Onr=RegExp(`${I6e.source} ?(?:${Snr.source}|(${wnr.source}))?`),jUn=RegExp(`(?: ${Onr.source})?`);LUn=RegExp(`^T?${I6e.source}$`),FUn=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;$Un={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};BUn=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;qUn=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,HUn=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,VUn=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;KUn=DH(TUn,M6e),GUn=DH(AUn,M6e),JUn=DH(IUn,M6e),ZUn=DH(Cnr),Enr=LH(DUn,kH,jZ,DZ),YUn=LH(MUn,kH,jZ,DZ),XUn=LH(RUn,kH,jZ,DZ),QUn=LH(kH,jZ,DZ);eqn=LH(kH);tqn=DH(NUn,jUn),rqn=DH(Onr),nqn=LH(kH,jZ,DZ)});function V1(t,e,r=!1){let n={values:r?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new Cs(n)}function Lnr(t,e){let r=e.milliseconds??0;for(let n of aqn.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function jnr(t,e){let r=Lnr(t,e)<0?-1:1;r$.reduceRight((n,o)=>{if(hr(e[o]))return n;if(n){let i=e[n]*r,a=t[o][n],s=Math.floor(i/a);e[o]+=s*r,e[n]-=s*a*r}return o},null),r$.reduce((n,o)=>{if(hr(e[o]))return n;if(n){let i=e[n]%1;e[n]-=i,e[o]+=i*t[n][o]}return o},null)}function sqn(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var Nnr,Dnr,oqn,lb,$H,iqn,r$,aqn,Cs,LZ=b(()=>{D1();NZ();PZ();EZ();N6e();nm();B1();z1();Nnr="Invalid Duration",Dnr={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},oqn={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...Dnr},lb=146097/400,$H=146097/4800,iqn={years:{quarters:4,months:12,weeks:lb/7,days:lb,hours:lb*24,minutes:lb*24*60,seconds:lb*24*60*60,milliseconds:lb*24*60*60*1e3},quarters:{months:3,weeks:lb/28,days:lb/4,hours:lb*24/4,minutes:lb*24*60/4,seconds:lb*24*60*60/4,milliseconds:lb*24*60*60*1e3/4},months:{weeks:$H/7,days:$H,hours:$H*24,minutes:$H*24*60,seconds:$H*24*60*60,milliseconds:$H*24*60*60*1e3},...Dnr},r$=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],aqn=r$.slice(0).reverse();Cs=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?iqn:oqn;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||hi.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,r){return t.fromObject({milliseconds:e},r)}static fromObject(e,r={}){if(e==null||typeof e!="object")throw new Vs(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:NH(e,t.normalizeUnit),loc:hi.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(Z_(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Vs(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=Inr(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,r){let[n]=Mnr(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,r=null){if(!e)throw new Vs("need to specify a reason the Duration is invalid");let n=e instanceof ld?e:new ld(e,r);if(mi.throwOnInvalid)throw new Nye(n);return new t({invalid:n})}static normalizeUnit(e){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!r)throw new EH(e);return r}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?cd.create(this.loc,n).formatDurationFromString(this,e):Nnr}toHuman(e={}){if(!this.isValid)return Nnr;let r=r$.map(n=>{let o=this.values[n];return hr(o)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(o)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=TH(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},Er.fromMillis(r,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Lnr(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e),n={};for(let o of r$)(q1(r.values,o)||q1(this.values,o))&&(n[o]=r.get(o)+this.get(o));return V1(this,{values:n},!0)}minus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e);return this.plus(r.negate())}mapUnits(e){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=E6e(e(this.values[n],n));return V1(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...NH(e,t.normalizeUnit)};return V1(this,{values:r})}reconfigure({locale:e,numberingSystem:r,conversionAccuracy:n,matrix:o}={}){let a={loc:this.loc.clone({locale:e,numberingSystem:r}),matrix:o,conversionAccuracy:n};return V1(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return jnr(this.matrix,e),V1(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=sqn(this.normalize().shiftToAll().toObject());return V1(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(a=>t.normalizeUnit(a));let r={},n={},o=this.toObject(),i;for(let a of r$)if(e.indexOf(a)>=0){i=a;let s=0;for(let l in n)s+=this.matrix[l][a]*n[l],n[l]=0;Z_(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else Z_(o[a])&&(n[a]=o[a]);for(let a in n)n[a]!==0&&(r[i]+=a===i?n[a]:n[a]/this.matrix[i][a]);return jnr(this.matrix,r),V1(this,{values:r},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let r of Object.keys(this.values))e[r]=this.values[r]===0?0:-this.values[r];return V1(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function r(n,o){return n===void 0||n===0?o===void 0||o===0:n===o}for(let n of r$)if(!r(this.values[n],e.values[n]))return!1;return!0}}});function uqn(t,e){return!t||!t.isValid?oA.invalid("missing or invalid start"):!e||!e.isValid?oA.invalid("missing or invalid end"):e<t?oA.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var BH,oA,j6e=b(()=>{z1();LZ();B1();D1();PZ();NZ();SZ();BH="Invalid Interval";oA=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,r=null){if(!e)throw new Vs("need to specify a reason the Interval is invalid");let n=e instanceof ld?e:new ld(e,r);if(mi.throwOnInvalid)throw new Rye(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=zH(e),o=zH(r),i=uqn(n,o);return i??new t({start:n,end:o})}static after(e,r){let n=Cs.fromDurationLike(r),o=zH(e);return t.fromDateTimes(o,o.plus(n))}static before(e,r){let n=Cs.fromDurationLike(r),o=zH(e);return t.fromDateTimes(o.minus(n),o)}static fromISO(e,r){let[n,o]=(e||"").split("/",2);if(n&&o){let i,a;try{i=Er.fromISO(n,r),a=i.isValid}catch{a=!1}let s,u;try{s=Er.fromISO(o,r),u=s.isValid}catch{u=!1}if(a&&u)return t.fromDateTimes(i,s);if(a){let l=Cs.fromISO(o,r);if(l.isValid)return t.after(i,l)}else if(u){let l=Cs.fromISO(n,r);if(l.isValid)return t.before(s,l)}}return t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",r){if(!this.isValid)return NaN;let n=this.start.startOf(e,r),o;return r?.useLocaleWeeks?o=this.end.reconfigure({locale:n.locale}):o=this.end,o=o.startOf(e,r),Math.floor(o.diff(n,e).get(e))+(o.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:r}={}){return this.isValid?t.fromDateTimes(e||this.s,r||this.e):this}splitAt(...e){if(!this.isValid)return[];let r=e.map(zH).filter(a=>this.contains(a)).sort((a,s)=>a.toMillis()-s.toMillis()),n=[],{s:o}=this,i=0;for(;o<this.e;){let a=r[i]||this.e,s=+a>+this.e?this.e:a;n.push(t.fromDateTimes(o,s)),o=s,i+=1}return n}splitBy(e){let r=Cs.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,o=1,i,a=[];for(;n<this.e;){let s=this.start.plus(r.mapUnits(u=>u*o));i=+s>+this.e?this.e:s,a.push(t.fromDateTimes(n,i)),n=i,o+=1}return a}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let r=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return r>=n?null:t.fromDateTimes(r,n)}union(e){if(!this.isValid)return this;let r=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return t.fromDateTimes(r,n)}static merge(e){let[r,n]=e.sort((o,i)=>o.s-i.s).reduce(([o,i],a)=>i?i.overlaps(a)||i.abutsStart(a)?[o,i.union(a)]:[o.concat([i]),a]:[o,a],[[],null]);return n&&r.push(n),r}static xor(e){let r=null,n=0,o=[],i=e.map(u=>[{time:u.s,type:"s"},{time:u.e,type:"e"}]),a=Array.prototype.concat(...i),s=a.sort((u,l)=>u.time-l.time);for(let u of s)n+=u.type==="s"?1:-1,n===1?r=u.time:(r&&+r!=+u.time&&o.push(t.fromDateTimes(r,u.time)),r=null);return t.merge(o)}difference(...e){return t.xor([this].concat(e)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:BH}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=L1,r={}){return this.isValid?cd.create(this.s.loc.clone(r),e).formatInterval(this):BH}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:BH}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:BH}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:BH}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:BH}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):Cs.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}}});var iA,D6e=b(()=>{z1();B1();EZ();$1();qye();nm();iA=class{static hasDST(e=mi.defaultZone){let r=Er.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return lp.isValidZone(e)}static normalizeZone(e){return J_(e,mi.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||hi.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||hi.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||hi.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||hi.create(r,n,i)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||hi.create(r,n,i)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||hi.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||hi.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return hi.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return hi.create(r,null,"gregory").eras(e)}static features(){return{relative:Bye(),localeWeek:zye()}}}});function Fnr(t,e){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(Cs.fromMillis(n).as("days"))}function lqn(t,e,r){let n=[["years",(u,l)=>l.year-u.year],["quarters",(u,l)=>l.quarter-u.quarter+(l.year-u.year)*4],["months",(u,l)=>l.month-u.month+(l.year-u.year)*12],["weeks",(u,l)=>{let c=Fnr(u,l);return(c-c%7)/7}],["days",Fnr]],o={},i=t,a,s;for(let[u,l]of n)r.indexOf(u)>=0&&(a=u,o[u]=l(t,e),s=i.plus(o),s>e?(o[u]--,t=i.plus(o),t>e&&(s=t,o[u]--,t=i.plus(o))):t=s);return[t,o,s,a]}function knr(t,e,r,n){let[o,i,a,s]=lqn(t,e,r),u=e-o,l=r.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);l.length===0&&(a<e&&(a=o.plus({[s]:1})),a!==o&&(i[s]=(i[s]||0)+u/(a-o)));let c=Cs.fromObject(i,n);return l.length>0?Cs.fromMillis(u,n).shiftTo(...l).plus(c):c}var $nr=b(()=>{LZ()});function Pi(t,e=r=>r){return{regex:t,deser:([r])=>e(Jrr(r))}}function fqn(t){return t.replace(/\./g,"\\.?").replace(qnr,Unr)}function Bnr(t){return t.replace(/\./g,"").replace(qnr," ").toLowerCase()}function Y_(t,e){return t===null?null:{regex:RegExp(t.map(fqn).join("|")),deser:([r])=>t.findIndex(n=>Bnr(r)===Bnr(n))+e}}function znr(t,e){return{regex:t,deser:([,r,n])=>Qk(r,n),groups:e}}function Kye(t){return{regex:t,deser:([e])=>e}}function pqn(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function mqn(t,e){let r=sb(e),n=sb(e,"{2}"),o=sb(e,"{3}"),i=sb(e,"{4}"),a=sb(e,"{6}"),s=sb(e,"{1,2}"),u=sb(e,"{1,3}"),l=sb(e,"{1,6}"),c=sb(e,"{1,9}"),d=sb(e,"{2,4}"),f=sb(e,"{4,6}"),p=y=>({regex:RegExp(pqn(y.val)),deser:([g])=>g,literal:!0}),h=(y=>{if(t.literal)return p(y);switch(y.val){case"G":return Y_(e.eras("short"),0);case"GG":return Y_(e.eras("long"),0);case"y":return Pi(l);case"yy":return Pi(d,RZ);case"yyyy":return Pi(i);case"yyyyy":return Pi(f);case"yyyyyy":return Pi(a);case"M":return Pi(s);case"MM":return Pi(n);case"MMM":return Y_(e.months("short",!0),1);case"MMMM":return Y_(e.months("long",!0),1);case"L":return Pi(s);case"LL":return Pi(n);case"LLL":return Y_(e.months("short",!1),1);case"LLLL":return Y_(e.months("long",!1),1);case"d":return Pi(s);case"dd":return Pi(n);case"o":return Pi(u);case"ooo":return Pi(o);case"HH":return Pi(n);case"H":return Pi(s);case"hh":return Pi(n);case"h":return Pi(s);case"mm":return Pi(n);case"m":return Pi(s);case"q":return Pi(s);case"qq":return Pi(n);case"s":return Pi(s);case"ss":return Pi(n);case"S":return Pi(u);case"SSS":return Pi(o);case"u":return Kye(c);case"uu":return Kye(s);case"uuu":return Pi(r);case"a":return Y_(e.meridiems(),0);case"kkkk":return Pi(i);case"kk":return Pi(d,RZ);case"W":return Pi(s);case"WW":return Pi(n);case"E":case"c":return Pi(r);case"EEE":return Y_(e.weekdays("short",!1),1);case"EEEE":return Y_(e.weekdays("long",!1),1);case"ccc":return Y_(e.weekdays("short",!0),1);case"cccc":return Y_(e.weekdays("long",!0),1);case"Z":case"ZZ":return znr(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return znr(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return Kye(/[a-z_+-/]{1,256}?/i);case" ":return Kye(/[^\S\n\r]/);default:return p(y)}})(t)||{invalidReason:cqn};return h.token=t,h}function gqn(t,e,r){let{type:n,value:o}=t;if(n==="literal"){let u=/^\s+$/.test(o);return{literal:!u,val:u?" ":o}}let i=e[n],a=n;n==="hour"&&(e.hour12!=null?a=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?a="hour12":a="hour24":a=r.hour12?"hour12":"hour24");let s=hqn[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function yqn(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function bqn(t,e,r){let n=t.match(e);if(n){let o={},i=1;for(let a in r)if(q1(r,a)){let s=r[a],u=s.groups?s.groups+1:1;!s.literal&&s.token&&(o[s.token.val[0]]=s.deser(n.slice(i,i+u))),i+=u}return[n,o]}else return[n,{}]}function _qn(t){let e=i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},r=null,n;return hr(t.z)||(r=lp.create(t.z)),hr(t.Z)||(r||(r=new ud(t.Z)),n=t.Z),hr(t.q)||(t.M=(t.q-1)*3+1),hr(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),hr(t.u)||(t.S=MZ(t.u)),[Object.keys(t).reduce((i,a)=>{let s=e(a);return s&&(i[s]=t[a]),i},{}),r,n]}function vqn(){return L6e||(L6e=Er.fromMillis(1555555555555)),L6e}function wqn(t,e){if(t.literal)return t;let r=cd.macroTokenToFormatOpts(t.val),n=$6e(r,e);return n==null||n.includes(void 0)?t:n}function F6e(t,e){return Array.prototype.concat(...t.map(r=>wqn(r,e)))}function k6e(t,e,r){return new FZ(t,r).explainFromTokens(e)}function Hnr(t,e,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=k6e(t,e,r);return[n,o,i,a]}function $6e(t,e){if(!t)return null;let n=cd.create(e,t).dtFormatter(vqn()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>gqn(a,t,i))}var cqn,dqn,Unr,qnr,hqn,L6e,FZ,Vnr=b(()=>{nm();NZ();AH();$1();z1();b6e();D1();cqn="missing Intl.DateTimeFormat.formatToParts support";dqn="\xA0",Unr=`[ ${dqn}]`,qnr=new RegExp(Unr,"g");hqn={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};L6e=null;FZ=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=F6e(cd.parseFormat(r),e),this.units=this.tokens.map(n=>mqn(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=yqn(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[r,n]=bqn(e,this.regex,this.handlers),[o,i,a]=n?_qn(n):[null,null,void 0];if(q1(n,"a")&&q1(n,"H"))throw new W_("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:r,matches:n,result:o,zone:i,specificOffset:a}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}});function kZ(t){return new ld("unsupported zone",`the zone "${t.name}" is not supported`)}function z6e(t){return t.weekData===null&&(t.weekData=TZ(t.c)),t.weekData}function U6e(t){return t.localWeekData===null&&(t.localWeekData=TZ(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function n$(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Er({...r,...e,old:r})}function Qnr(t,e,r){let n=t-e*60*1e3,o=r.offset(n);if(e===o)return[n,e];n-=(o-e)*60*1e3;let i=r.offset(n);return o===i?[n,o]:[t-Math.min(o,i)*60*1e3,Math.max(o,i)]}function Gye(t,e){t+=e*60*1e3;let r=new Date(t);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function Zye(t,e,r){return Qnr(PH(t),e,r)}function Knr(t,e){let r=t.o,n=t.c.year+Math.trunc(e.years),o=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...t.c,year:n,month:o,day:Math.min(t.c.day,RH(n,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=Cs.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),s=PH(i),[u,l]=Qnr(s,r,t.zone);return a!==0&&(u+=a,l=t.zone.offset(u)),{ts:u,o:l}}function UH(t,e,r,n,o,i){let{setZone:a,zone:s}=r;if(t&&Object.keys(t).length!==0||e){let u=e||s,l=Er.fromObject(t,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return Er.invalid(new ld("unparsable",`the input "${o}" can't be parsed as ${n}`))}function Jye(t,e,r=!0){return t.isValid?cd.create(hi.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function q6e(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=Ss(t.c.year,r?6:4),e?(n+="-",n+=Ss(t.c.month),n+="-",n+=Ss(t.c.day)):(n+=Ss(t.c.month),n+=Ss(t.c.day)),n}function Gnr(t,e,r,n,o,i){let a=Ss(t.c.hour);return e?(a+=":",a+=Ss(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=":")):a+=Ss(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=Ss(t.c.second),(t.c.millisecond!==0||!n)&&(a+=".",a+=Ss(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=Ss(Math.trunc(-t.o/60)),a+=":",a+=Ss(Math.trunc(-t.o%60))):(a+="+",a+=Ss(Math.trunc(t.o/60)),a+=":",a+=Ss(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}function Eqn(t){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new EH(t);return e}function Jnr(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Eqn(t)}}function Pqn(t){return Xye[t]||(Yye===void 0&&(Yye=mi.now()),Xye[t]=t.offset(Yye)),Xye[t]}function Znr(t,e){let r=J_(e.zone,mi.defaultZone);if(!r.isValid)return Er.invalid(kZ(r));let n=hi.fromObject(e),o,i;if(hr(t.year))o=mi.now();else{for(let u of tor)hr(t[u])&&(t[u]=eor[u]);let a=x6e(t)||S6e(t);if(a)return Er.invalid(a);let s=Pqn(r);[o,i]=Zye(t,s,r)}return new Er({ts:o,zone:r,loc:n,o:i})}function Ynr(t,e,r){let n=hr(r.round)?!0:r.round,o=(a,s)=>(a=TH(a,n||r.calendary?0:2,!0),e.loc.clone(r).relFormatter(r).format(a,s)),i=a=>r.calendary?e.hasSame(t,a)?0:e.startOf(a).diff(t.startOf(a),a).get(a):e.diff(t,a).get(a);if(r.unit)return o(i(r.unit),r.unit);for(let a of r.units){let s=i(a);if(Math.abs(s)>=1)return o(s,a)}return o(t>e?-0:0,r.units[r.units.length-1])}function Xnr(t){let e={},r;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],r=Array.from(t).slice(0,t.length-1)):r=Array.from(t),[e,r]}function zH(t){if(Er.isDateTime(t))return t;if(t&&t.valueOf&&Z_(t.valueOf()))return Er.fromJSDate(t);if(t&&typeof t=="object")return Er.fromObject(t);throw new Vs(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var B6e,Wnr,eor,xqn,Sqn,tor,Cqn,Oqn,Yye,Xye,Er,z1=b(()=>{LZ();j6e();B1();D6e();NZ();AH();EZ();nm();qye();$nr();N6e();Vnr();C6e();SZ();D1();PZ();B6e="Invalid DateTime",Wnr=864e13;eor={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},xqn={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Sqn={ordinal:1,hour:0,minute:0,second:0,millisecond:0},tor=["year","month","day","hour","minute","second","millisecond"],Cqn=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Oqn=["year","ordinal","hour","minute","second","millisecond"];Xye={},Er=class t{constructor(e){let r=e.zone||mi.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new ld("invalid input"):null)||(r.isValid?null:kZ(r));this.ts=hr(e.ts)?mi.now():e.ts;let o=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(r))[o,i]=[e.old.c,e.old.o];else{let s=Z_(e.o)&&!e.old?e.o:r.offset(this.ts);o=Gye(this.ts,s),n=Number.isNaN(o.year)?new ld("invalid input"):null,o=n?null:o,i=n?null:s}this._zone=r,this.loc=e.loc||hi.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=o,this.o=i,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,r]=Xnr(arguments),[n,o,i,a,s,u,l]=r;return Znr({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static utc(){let[e,r]=Xnr(arguments),[n,o,i,a,s,u,l]=r;return e.zone=ud.utcInstance,Znr({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static fromJSDate(e,r={}){let n=fnr(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let o=J_(r.zone,mi.defaultZone);return o.isValid?new t({ts:n,zone:o,loc:hi.fromObject(r)}):t.invalid(kZ(o))}static fromMillis(e,r={}){if(Z_(e))return e<-Wnr||e>Wnr?t.invalid("Timestamp out of range"):new t({ts:e,zone:J_(r.zone,mi.defaultZone),loc:hi.fromObject(r)});throw new Vs(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(Z_(e))return new t({ts:e*1e3,zone:J_(r.zone,mi.defaultZone),loc:hi.fromObject(r)});throw new Vs("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=J_(r.zone,mi.defaultZone);if(!n.isValid)return t.invalid(kZ(n));let o=hi.fromObject(r),i=NH(e,Jnr),{minDaysInFirstWeek:a,startOfWeek:s}=w6e(i,o),u=mi.now(),l=hr(r.specificOffset)?n.offset(u):r.specificOffset,c=!hr(i.ordinal),d=!hr(i.year),f=!hr(i.month)||!hr(i.day),p=d||f,m=i.weekYear||i.weekNumber;if((p||c)&&m)throw new W_("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new W_("Can't mix ordinal dates with month/day");let h=m||i.weekday&&!p,y,g,_=Gye(u,l);h?(y=Cqn,g=xqn,_=TZ(_,a,s)):c?(y=Oqn,g=Sqn,_=Wye(_)):(y=tor,g=eor);let w=!1;for(let N of y){let M=i[N];hr(M)?w?i[N]=g[N]:i[N]=_[N]:w=!0}let S=h?lnr(i,a,s):c?cnr(i):x6e(i),C=S||S6e(i);if(C)return t.invalid(C);let E=h?_6e(i,a,s):c?v6e(i):i,[P,T]=Zye(E,l,n),I=new t({ts:P,zone:n,o:T,loc:o});return i.weekday&&p&&e.weekday!==I.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${I.toISO()}`):I.isValid?I:t.invalid(I.invalid)}static fromISO(e,r={}){let[n,o]=Pnr(e);return UH(n,o,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,o]=Tnr(e);return UH(n,o,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,o]=Anr(e);return UH(n,o,r,"HTTP",r)}static fromFormat(e,r,n={}){if(hr(e)||hr(r))throw new Vs("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=n,a=hi.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[s,u,l,c]=Hnr(a,e,r);return c?t.invalid(c):UH(s,u,n,`format ${r}`,e,l)}static fromString(e,r,n={}){return t.fromFormat(e,r,n)}static fromSQL(e,r={}){let[n,o]=Rnr(e);return UH(n,o,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Vs("need to specify a reason the DateTime is invalid");let n=e instanceof ld?e:new ld(e,r);if(mi.throwOnInvalid)throw new Mye(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=$6e(e,hi.fromObject(r));return n?n.map(o=>o?o.val:null).join(""):null}static expandFormat(e,r={}){return F6e(cd.parseFormat(e),hi.fromObject(r)).map(o=>o.val).join("")}static resetCache(){Yye=void 0,Xye={}}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?z6e(this).weekYear:NaN}get weekNumber(){return this.isValid?z6e(this).weekNumber:NaN}get weekday(){return this.isValid?z6e(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?U6e(this).weekday:NaN}get localWeekNumber(){return this.isValid?U6e(this).weekNumber:NaN}get localWeekYear(){return this.isValid?U6e(this).weekYear:NaN}get ordinal(){return this.isValid?Wye(this.c).ordinal:NaN}get monthShort(){return this.isValid?iA.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?iA.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?iA.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?iA.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,r=6e4,n=PH(this.c),o=this.zone.offset(n-e),i=this.zone.offset(n+e),a=this.zone.offset(n-o*r),s=this.zone.offset(n-i*r);if(a===s)return[this];let u=n-a*r,l=n-s*r,c=Gye(u,a),d=Gye(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[n$(this,{ts:u}),n$(this,{ts:l})]:[this]}get isInLeapYear(){return t$(this.year)}get daysInMonth(){return RH(this.year,this.month)}get daysInYear(){return this.isValid?U1(this.year):NaN}get weeksInWeekYear(){return this.isValid?e$(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?e$(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:o}=cd.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:o}}toUTC(e=0,r={}){return this.setZone(ud.instance(e),r)}toLocal(){return this.setZone(mi.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=J_(e,mi.defaultZone),e.equals(this.zone))return this;if(e.isValid){let o=this.ts;if(r||n){let i=e.offset(this.ts),a=this.toObject();[o]=Zye(a,i,e)}return n$(this,{ts:o,zone:e})}else return t.invalid(kZ(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return n$(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=NH(e,Jnr),{minDaysInFirstWeek:n,startOfWeek:o}=w6e(r,this.loc),i=!hr(r.weekYear)||!hr(r.weekNumber)||!hr(r.weekday),a=!hr(r.ordinal),s=!hr(r.year),u=!hr(r.month)||!hr(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new W_("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new W_("Can't mix ordinal dates with month/day");let d;i?d=_6e({...TZ(this.c,n,o),...r},n,o):hr(r.ordinal)?(d={...this.toObject(),...r},hr(r.day)&&(d.day=Math.min(RH(d.year,d.month),d.day))):d=v6e({...Wye(this.c),...r});let[f,p]=Zye(d,this.o,this.zone);return n$(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let r=Cs.fromDurationLike(e);return n$(this,Knr(this,r))}minus(e){if(!this.isValid)return this;let r=Cs.fromDurationLike(e).negate();return n$(this,Knr(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=Cs.normalizeUnit(e);switch(o){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break;case"milliseconds":break}if(o==="weeks")if(r){let i=this.loc.getStartOfWeek(),{weekday:a}=this;a<i&&(n.weekNumber=this.weekNumber-1),n.weekday=i}else n.weekday=1;if(o==="quarters"){let i=Math.ceil(this.month/3);n.month=(i-1)*3+1}return this.set(n)}endOf(e,r){return this.isValid?this.plus({[e]:1}).startOf(e,r).minus(1):this}toFormat(e,r={}){return this.isValid?cd.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):B6e}toLocaleString(e=L1,r={}){return this.isValid?cd.create(this.loc.clone(r),e).formatDateTime(this):B6e}toLocaleParts(e={}){return this.isValid?cd.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:o=!0,extendedZone:i=!1}={}){if(!this.isValid)return null;let a=e==="extended",s=q6e(this,a);return s+="T",s+=Gnr(this,a,r,n,o,i),s}toISODate({format:e="extended"}={}){return this.isValid?q6e(this,e==="extended"):null}toISOWeekDate(){return Jye(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:o=!1,extendedZone:i=!1,format:a="extended"}={}){return this.isValid?(o?"T":"")+Gnr(this,a==="extended",r,e,n,i):null}toRFC2822(){return Jye(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Jye(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?q6e(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let o="HH:mm:ss.SSS";return(r||e)&&(n&&(o+=" "),r?o+="z":e&&(o+="ZZ")),Jye(this,o,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():B6e}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let r={...this.c};return e.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,r="milliseconds",n={}){if(!this.isValid||!e.isValid)return Cs.invalid("created by diffing an invalid DateTime");let o={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=pnr(r).map(Cs.normalizeUnit),a=e.valueOf()>this.valueOf(),s=a?this:e,u=a?e:this,l=knr(s,u,i,o);return a?l.negate():l}diffNow(e="milliseconds",r={}){return this.diff(t.now(),e,r)}until(e){return this.isValid?oA.fromDateTimes(this,e):this}hasSame(e,r,n){if(!this.isValid)return!1;let o=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(r,n)<=o&&o<=i.endOf(r,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let r=e.base||t.fromObject({},{zone:this.zone}),n=e.padding?this<r?-e.padding:e.padding:0,o=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(o=e.unit,i=void 0),Ynr(r,this.plus(n),{...e,numeric:"always",units:o,unit:i})}toRelativeCalendar(e={}){return this.isValid?Ynr(e.base||t.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(t.isDateTime))throw new Vs("min requires all arguments be DateTimes");return O6e(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Vs("max requires all arguments be DateTimes");return O6e(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:o=null,numberingSystem:i=null}=n,a=hi.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return k6e(a,e,r)}static fromStringExplain(e,r,n={}){return t.fromFormatExplain(e,r,n)}static buildFormatParser(e,r={}){let{locale:n=null,numberingSystem:o=null}=r,i=hi.fromOpts({locale:n,numberingSystem:o,defaultToEN:!0});return new FZ(i,e)}static fromFormatParser(e,r,n={}){if(hr(e)||hr(r))throw new Vs("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=n,a=hi.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});if(!a.equals(r.locale))throw new Vs(`fromFormatParser called with a locale of ${a}, but the format parser was created for ${r.locale}`);let{result:s,zone:u,specificOffset:l,invalidReason:c}=r.explainFromTokens(e);return c?t.invalid(c):UH(s,u,n,`format ${r.format}`,e,l)}static get DATE_SHORT(){return L1}static get DATE_MED(){return oZ}static get DATE_MED_WITH_WEEKDAY(){return e6e}static get DATE_FULL(){return iZ}static get DATE_HUGE(){return aZ}static get TIME_SIMPLE(){return sZ}static get TIME_WITH_SECONDS(){return uZ}static get TIME_WITH_SHORT_OFFSET(){return lZ}static get TIME_WITH_LONG_OFFSET(){return cZ}static get TIME_24_SIMPLE(){return dZ}static get TIME_24_WITH_SECONDS(){return fZ}static get TIME_24_WITH_SHORT_OFFSET(){return pZ}static get TIME_24_WITH_LONG_OFFSET(){return mZ}static get DATETIME_SHORT(){return hZ}static get DATETIME_SHORT_WITH_SECONDS(){return gZ}static get DATETIME_MED(){return yZ}static get DATETIME_MED_WITH_SECONDS(){return bZ}static get DATETIME_MED_WITH_WEEKDAY(){return t6e}static get DATETIME_FULL(){return _Z}static get DATETIME_FULL_WITH_SECONDS(){return vZ}static get DATETIME_HUGE(){return wZ}static get DATETIME_HUGE_WITH_SECONDS(){return xZ}}});var ror=b(()=>{z1();LZ();j6e();D6e();Xk();AH();$1();g6e();Dye();B1()});function H6e(t){let e=t.match(/^(?:UTC|GMT)?([-+]?\d{1,2})(?::(\d{2}))?$/i);if(!e)throw new Error(`Invalid timezone offset format: ${t}. Use formats like '+8', '-5', '+5:30', 'UTC+8', 'GMT-5'`);let r=parseInt(e[1]),n=parseInt(e[2]||"0");if(Math.abs(r)>14||n>=60)throw new Error(`Invalid timezone offset: ${t}. Hours must be between -14 and +14, minutes must be less than 60`);let o=r>=0?"+":"",i=n>0?`:${n.toString().padStart(2,"0")}`:"";return`UTC${o}${r}${i}`}async function Tqn(t){let e=Er.now();if(t)try{let i=H6e(t),a=e.setZone(i);if(!a.isValid)throw new Error(`Failed to apply timezone offset: ${t}`);e=a}catch(i){throw new Error(`${i.message}`)}let r=e.toJSDate(),n=e.offset,o=e.offsetNameShort||"Unknown";return{epoch:Math.floor(r.getTime()),isoString:r.toISOString(),userLocaleString:e.toLocaleString(Er.DATETIME_FULL),localDateString:e.toISODate()||"",timezoneOffset:n,timezone:o}}function Aqn(t,e){let r=t.match(/^(last|past|previous|prior)\s+(\d+)\s+(days?|weeks?|months?|years?)$/i);if(!r)return;let[,,n,o]=r,i=parseInt(n);if(i<=0)return;let a=o.replace(/s$/,""),s=e.startOf("day");return{start:s.minus({[a+"s"]:i}),end:s}}function Iqn(t,e){switch(t){case"yesterday":return{start:e.minus({days:1}).startOf("day"),end:e.minus({days:1}).endOf("day")};case"last week":return{start:e.minus({weeks:1}).startOf("week"),end:e.minus({weeks:1}).endOf("week")};case"this week":return{start:e.startOf("week"),end:e.endOf("week")};case"next week":return{start:e.plus({weeks:1}).startOf("week"),end:e.plus({weeks:1}).endOf("week")};case"last month":return{start:e.minus({months:1}).startOf("month"),end:e.minus({months:1}).endOf("month")};case"this month":return{start:e.startOf("month"),end:e.endOf("month")};case"next month":return{start:e.plus({months:1}).startOf("month"),end:e.plus({months:1}).endOf("month")};case"last year":return{start:e.minus({years:1}).startOf("year"),end:e.minus({years:1}).endOf("year")};case"this year":return{start:e.startOf("year"),end:e.endOf("year")};case"next year":return{start:e.plus({years:1}).startOf("year"),end:e.plus({years:1}).endOf("year")};case"last quarter":return{start:e.minus({quarters:1}).startOf("quarter"),end:e.minus({quarters:1}).endOf("quarter")};case"this quarter":return{start:e.startOf("quarter"),end:e.endOf("quarter")};case"next quarter":return{start:e.plus({quarters:1}).startOf("quarter"),end:e.plus({quarters:1}).endOf("quarter")}}}function Mqn(t,e){let r=t.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=QVe(n,e.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=Er.fromJSDate(o[0].start.date()).startOf("week"),a=i.endOf("week");return i>e&&(i=i.minus({years:1}),a=a.minus({years:1})),{start:i,end:a}}function Rqn(t,e){let r=t.match(/^(jan|january|feb|february|mar|march|apr|april|may|jun|june|jul|july|aug|august|sep|september|oct|october|nov|november|dec|december)$/i);if(!r)return;let n=oor[r[1]],o=e.year;n>e.month&&o--;let i=Er.fromObject({year:o,month:n,day:1}),a=i.endOf("month");return i>e&&(i=i.minus({years:1}),a=a.minus({years:1})),{start:i,end:a}}function Nqn(t,e){let r=t.match(/^(?:(?:the\s+)?(?:year|yr)(?:\s+(?:of|in))?\s+)?(\d{4})$/i);if(!r)return;let n=parseInt(r[1]),o=Er.fromObject({year:n,month:1,day:1}),i=Er.fromObject({year:n,month:12,day:31});return o>e&&(o=o.minus({years:1}),i=i.minus({years:1})),{start:o,end:i}}function jqn(t,e){let r=t.match(/^(?:(?:q|Q)(\d{1})\s+(\d{4})|(\d{4})\s+(?:q|Q)(\d{1}))$/),n=t.match(/^(?:q|Q)(\d{1})$/),o,i;if(r)o=parseInt(r[1]||r[4]),i=parseInt(r[2]||r[3]);else if(n){o=parseInt(n[1]),i=e.year;let l=Math.floor((e.month-1)/3)+1;o>l&&i--}else return;if(o<1||o>4)return;let a=(o-1)*3+1,s=Er.fromObject({year:i,month:a,day:1}).startOf("day"),u=s.plus({months:3}).minus({days:1}).endOf("day");return s>e&&(s=s.minus({years:1}),u=u.minus({years:1})),{start:s,end:u}}function Dqn(t,e){let r=t.match(/^(jan|january|feb|february|mar|march|apr|april|may|jun|june|jul|july|aug|august|sep|september|oct|october|nov|november|dec|december)\s+(\d{4})$/i);if(!r)return;let n=oor[r[1].toLowerCase()],o=parseInt(r[2]),i=Er.fromObject({year:o,month:n,day:1}).startOf("day"),a=i.endOf("month");return i>e&&(i=i.minus({years:1}),a=a.minus({years:1})),{start:i,end:a}}function Lqn(t){let e=Er.now(),r=t.toLowerCase().replace("@vault","").trim(),n=Aqn(r,e)||Iqn(r,e)||Mqn(r,e)||Rqn(r,e)||Dqn(r,e)||jqn(r,e)||Nqn(r,e);if(n)return{startTime:$Z(n.start),endTime:$Z(n.end)};let o=QVe(t,e.toJSDate(),{forwardDate:!1});if(o.length>0){let i=Er.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?Er.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>e&&(i.minus({years:1}),a.minus({years:1})),{startTime:$Z(i),endTime:$Z(a)}}console.warn(`Unable to parse time expression: ${t}`)}function $Z(t){let e=t.toJSDate(),r=t.offset,n=t.offsetNameShort||"Unknown";return{epoch:Math.floor(e.getTime()),isoString:e.toISOString(),userLocaleString:t.toLocaleString(Er.DATETIME_FULL),localDateString:t.toISODate()||"",timezoneOffset:r,timezone:n}}function Fqn(t){let e=t.toString().length===10?t*1e3:t,r=Er.fromMillis(e);return $Z(r)}function kqn(t){let e=t.match(/^(\d+)\s*(s|sec|seconds?|m|min|minutes?|h|hr|hours?)$/i);if(!e)throw new Error(`Invalid time interval format: ${t}`);let r=parseInt(e[1],10),n=e[2].toLowerCase();switch(n){case"s":case"sec":case"second":case"seconds":return r*1e3;case"m":case"min":case"minute":case"minutes":return r*60*1e3;case"h":case"hr":case"hour":case"hours":return r*60*60*1e3;default:throw new Error(`Unsupported time unit: ${n}`)}}async function $qn(t="25min"){let e=kqn(t);return new Promise(r=>{setTimeout(()=>{new nor.Notice(`Pomodoro timer (${t}) completed! Take a break!`),r()},e)})}async function Bqn(t,e,r){let n=H6e(e),o=H6e(r);try{let i=Er.now().setZone(n),a=Urr(t,i.toJSDate());if(!a)throw new Error(`Could not parse time: ${t}`);let s=Er.fromJSDate(a,{zone:n}),u=s.setZone(o);if(!u.isValid)throw new Error("Invalid timezone conversion");let l=u.toJSDate(),c=u.offset;return{epoch:Math.floor(l.getTime()),isoString:l.toISOString(),userLocaleString:u.toLocaleString(Er.DATETIME_FULL),localDateString:u.toISODate()||"",timezoneOffset:c,timezone:u.offsetNameShort||o,originalTime:s.toLocaleString(Er.TIME_SIMPLE)+" "+s.offsetNameShort,convertedTime:u.toLocaleString(Er.TIME_SIMPLE)+" "+u.offsetNameShort}}catch(i){throw new Error(`Failed to convert time: ${i.message}`)}}var nor,Qye,oor,ebe,tbe,BZ,rbe,V6e=b(()=>{qrr();ror();nor=require("obsidian");xd();Kk();Qye=Jl({name:"getCurrentTime",description:"Get the current time in local timezone or at a specified UTC offset. Returns epoch time, ISO string, and formatted strings.",schema:dt.object({timezoneOffset:dt.string().optional().describe(`Optional UTC offset. IMPORTANT: Must be a numeric offset, NOT a timezone name.
EXAMPLES OF CORRECT USAGE:
- "what time is it" \u2192 No parameter (uses local time)
- "what time is it in Tokyo" \u2192 timezoneOffset: "+9"
- "what time is it in Beijing" \u2192 timezoneOffset: "+8"
- "what time is it in New York" \u2192 timezoneOffset: "-5" (or "-4" during DST)
- "what time is it in Mumbai" \u2192 timezoneOffset: "+5:30"
SUPPORTED FORMATS:
- Simple: "+8", "-5", "+5:30"
- With prefix: "UTC+8", "GMT-5", "UTC+5:30"
COMMON TIMEZONE OFFSETS:
- Tokyo: UTC+9
- Beijing/Singapore: UTC+8
- Mumbai: UTC+5:30
- Dubai: UTC+4
- London: UTC+0 (UTC+1 during BST)
- New York: UTC-5 (UTC-4 during DST)
- Los Angeles: UTC-8 (UTC-7 during DST)`)}),handler:async({timezoneOffset:t})=>Tqn(t),isBackground:!0}),oor={jan:1,january:1,feb:2,february:2,mar:3,march:3,apr:4,april:4,may:5,jun:6,june:6,jul:7,july:7,aug:8,august:8,sep:9,september:9,oct:10,october:10,nov:11,november:11,dec:12,december:12};ebe=Jl({name:"getTimeRangeMs",description:"Convert natural language time expressions to date ranges for use with localSearch",schema:dt.object({timeExpression:dt.string().describe(`Natural language time expression to convert to a date range.
COMMON EXPRESSIONS:
- Relative past: "yesterday", "last week", "last month", "last year"
- Relative ranges: "this week", "this month", "this year"
- Specific dates: "July 1", "July 1 2023", "2023-07-01"
- Date ranges: "from July 1 to July 15", "between May and June"
- Time periods: "last 7 days", "past 30 days", "previous 3 months"
IMPORTANT: This tool is typically used as the first step before localSearch when searching notes by time.
EXAMPLE WORKFLOW:
1. User: "what did I do last week"
2. First call getTimeRangeMs with timeExpression: "last week"
3. Then use the returned time range with localSearch`)}),handler:async({timeExpression:t})=>Lqn(t),isBackground:!0});tbe=Jl({name:"getTimeInfoByEpoch",description:"Convert a Unix timestamp (in seconds or milliseconds) to detailed time information",schema:dt.object({epoch:dt.number().describe("Unix timestamp in seconds or milliseconds")}),handler:async({epoch:t})=>Fqn(t),isBackground:!0});BZ=Jl({name:"startPomodoro",description:"Start a Pomodoro timer with a customizable interval",schema:dt.object({interval:dt.string().default("25min").describe("Time interval (e.g., '25min', '5s', '1h'). Default is 25min.")}),handler:async({interval:t})=>($qn(t),`Pomodoro timer started. It will end in ${t}.`)});rbe=Jl({name:"convertTimeBetweenTimezones",description:"Convert a specific time from one timezone to another using UTC offsets",schema:dt.object({time:dt.string().describe(`Time to convert. Supports various formats:
- 12-hour: "6pm", "3:30 PM", "11:45 am"
- 24-hour: "18:00", "15:30", "23:45"
- Relative: "noon", "midnight"`),fromOffset:dt.string().describe(`Source UTC offset. Must be numeric, not timezone name.
Examples: "-8" for PT, "+0" for London, "+8" for Beijing`),toOffset:dt.string().describe(`Target UTC offset. Must be numeric, not timezone name.
Examples: "+9" for Tokyo, "-5" for NY, "+5:30" for Mumbai
EXAMPLE USAGE:
- "what time is 6pm PT in Tokyo" \u2192 time: "6pm", fromOffset: "-8", toOffset: "+9"
- "convert 3:30 PM EST to London time" \u2192 time: "3:30 PM", fromOffset: "-5", toOffset: "+0"
- "what is 9am Beijing time in New York" \u2192 time: "9am", fromOffset: "+8", toOffset: "-5"`)}),handler:async({time:t,fromOffset:e,toOffset:r})=>Bqn(t,e,r),isBackground:!0})});var ior,aor,nbe,W6e=b(()=>{jy();kt();xd();Kk();ior=5e4,aor=Jl({name:"youtubeTranscription",description:"Get transcripts of YouTube videos when the user provides YouTube URLs",schema:dt.object({}),isPlusOnly:!0,requiresUserMessageContent:!0,handler:async t=>{let{_userMessageContent:e}=t;if(typeof e!="string")return JSON.stringify({success:!1,message:"Invalid input: User message must be a string"});if(e.length>ior)return JSON.stringify({success:!1,message:`Input too long: Maximum allowed length is ${ior} characters`});let r=Aee(e);if(r.length===0)return JSON.stringify({success:!1,message:"No YouTube URLs found in the user prompt. URLs must be in the user prompt instead of the context notes."});let n=await Promise.all(r.map(async i=>{try{let a=await Zi.getInstance().youtube4llm(i);return a.response.transcript?{url:i,success:!0,transcript:a.response.transcript,elapsed_time_ms:a.elapsed_time_ms}:{url:i,success:!1,message:"Transcript not available. Only English videos with auto transcript enabled are supported"}}catch(a){return console.error(`Error transcribing YouTube video ${i}:`,a),{url:i,success:!1,message:"An error occurred while transcribing the YouTube video"}}})),o=n.some(i=>i.success);return JSON.stringify({success:o,results:n,total_urls:r.length})}}),nbe=Jl({name:"simpleYoutubeTranscription",description:"Get the transcript of a YouTube video",schema:dt.object({url:dt.string().url().describe("The YouTube video URL")}),isPlusOnly:!0,handler:async({url:t})=>{try{let e=await Zi.getInstance().youtube4llm(t);return e.response.transcript?JSON.stringify({success:!0,transcript:e.response.transcript,elapsed_time_ms:e.elapsed_time_ms}):JSON.stringify({success:!1,message:"Transcript not available. Only English videos with the auto transcript option turned on are supported at the moment"})}catch(e){return console.error(`Error transcribing YouTube video ${t}:`,e),JSON.stringify({success:!1,message:"An error occurred while transcribing the YouTube video."})}}})});var zZ,o$,obe=b(()=>{wR();la();PVe();RVe();V6e();W6e();C7();kt();jy();zZ=["@vault","@composer","@websearch","@youtube","@pomodoro"],o$=class{static initTools(e){this.tools.length===0&&(this.tools=[Qye,rbe,tbe,ebe,E7,ptr,BZ,P7,nbe,xye(e.getRoot())])}static async analyzeIntent(e){try{let r=await Zi.getInstance().broca(e,Wj());if(!r?.response)throw new Error(r?.detail||"Broca API call failed");let n=r.response.tool_calls,o=r.response.salience_terms,i=[],a;for(let s of n){let u=this.tools.find(l=>l.name===s.tool);if(u){let l=s.args||{};if(u.name==="getTimeRangeMs"&&(a=await $O.callTool(u,l)),u.name=="getFileTree"&&Wj())continue;i.push({tool:u,args:l})}}return await this.processAtCommands(e,i,{timeRange:a,salientTerms:o}),i}catch(r){throw console.error("Error in intent analysis:",r),r}}static async processAtCommands(e,r,n){let o=e.toLowerCase(),{timeRange:i,salientTerms:a}=n;if(o.includes("@vault")){let u=this.removeAtCommands(e);r.push({tool:E7,args:{timeRange:i||void 0,query:u,salientTerms:a}})}if(o.includes("@websearch")||o.includes("@web")){let u=this.removeAtCommands(e),c=await Wd.instance.getCurrentChainManager().memoryManager.getMemory().loadMemoryVariables({}),d=iz(c);r.push({tool:P7,args:{query:u,chatHistory:d}})}if(o.includes("@pomodoro")){let u=e.match(/@pomodoro\s+(\S+)/i),l=u?u[1]:"25min";r.push({tool:BZ,args:{interval:l}})}let s=Aee(e);for(let u of s)r.some(c=>c.tool.name===nbe.name&&c.args.url===u)||r.push({tool:nbe,args:{url:u}})}static removeAtCommands(e){return e.split(" ").filter(r=>!zZ.includes(r.toLowerCase())).join(" ").trim()}};o$.tools=[]});var qH,K6e=b(()=>{qH=class{static tryParseJson(e){try{let r=JSON.parse(e);return Array.isArray(r)?r:[r]}catch{return[]}}static format(e,r){try{let n=r;if(typeof n=="string"&&n.startsWith("ENC:"))try{n=decodeURIComponent(n.slice(4))}catch{}let o;try{o=JSON.parse(n)}catch{o=n}switch(e){case"localSearch":return this.formatLocalSearch(o);case"webSearch":return this.formatWebSearch(o);case"simpleYoutubeTranscriptionTool":case"youtubeTranscription":return this.formatYoutubeTranscription(o);case"writeToFile":return this.formatWriteToFile(o);case"replaceInFile":return this.formatReplaceInFile(o);default:return r}}catch{return r}}static formatLocalSearch(e){if(typeof e=="string"){let s=e.match(/<localSearch[^>]*>([\s\S]*)<\/localSearch>/);if(s){let u=s[1].trim(),l=u.match(/<document>/g),c=l?l.length:0;if(c===0)return`\u{1F4DA} Found 0 relevant notes
No matching notes found.`;let d=[],f=/<document>([\s\S]*?)<\/document>/g,p;for(;(p=f.exec(u))!==null;){let g=p[1],_=g.match(/<title>([\s\S]*?)<\/title>/),w=g.match(/<path>([\s\S]*?)<\/path>/),S=g.match(/<modified>([\s\S]*?)<\/modified>/),C=(_?.[1]||"Untitled").trim(),E=(w?.[1]||"").trim(),P=(S?.[1]||"").trim();d.push({title:C,path:E,mtime:P||null})}let h=d.slice(0,10).map((g,_)=>{let w=[`${_+1}. ${g.title}`];return g.mtime&&w.push(` \u{1F552} Modified: ${g.mtime}`),g.path&&g.path!==g.title&&w.push(` \u{1F4C1} ${g.path}`),w.join(`
`)}).join(`
`),y=c>10?`
... and ${c-10} more results`:"";return`\u{1F4DA} Found ${c} relevant notes
Top results:
${h}${y}`}}let r=this.parseSearchResults(e);if(!Array.isArray(r))return typeof e=="string"?e:JSON.stringify(e,null,2);let n=r.length;if(n===0)return`\u{1F4DA} Found 0 relevant notes
No matching notes found.`;let i=r.slice(0,10).map((s,u)=>this.formatSearchItem(s,u)).join(`
`),a=n>10?`
... and ${n-10} more results`:"";return`\u{1F4DA} Found ${n} relevant notes
Top results:
${i}${a}`}static parseSearchResults(e){if(typeof e=="object"&&e!==null)return e.type==="local_search"&&Array.isArray(e.documents)?e.documents:[];if(typeof e=="string"){try{let r=JSON.parse(e);if(r&&r.type==="local_search"&&Array.isArray(r.documents))return r.documents}catch{}return[]}return[]}static formatSearchItem(e,r){let n=e.path?.split("/").pop()?.replace(/\.md$/,"")||e.title||"Untitled",o=e.rerank_score||e.score||0,i=typeof o=="number"?o.toFixed(4):o,a=e.source==="time-filtered"?"Recency":"Relevance",s=[`${r+1}. ${n}`];if(e.source==="time-filtered"){if(e.mtime)try{let l=new Date(e.mtime),c=isNaN(l.getTime())?String(e.mtime):l.toISOString();s.push(` \u{1F552} Modified: ${c}${e.includeInContext?" \u2713":""}`)}catch{s.push(` \u{1F552} Modified: ${String(e.mtime)}${e.includeInContext?" \u2713":""}`)}}else e.source==="title-match"?s.push(` \u{1F516} Title match${e.includeInContext?" \u2713":""}`):s.push(` \u{1F4CA} ${a}: ${i}${e.includeInContext?" \u2713":""}`);let u=this.extractContentSnippet(e.content);return u&&s.push(` \u{1F4AC} "${u}${e.content?.length>150?"...":""}"`),e.path&&!e.path.endsWith(`/${n}.md`)&&s.push(` \u{1F4C1} ${e.path}`),s.join(`
`)}static extractContentSnippet(e,r=150){return e?(e.match(/NOTE BLOCK CONTENT:\s*([\s\S]*)/)?.[1]||e).substring(0,r).replace(/\s+/g," ").trim():""}static formatWebSearch(e){if(Array.isArray(e)&&e.length>0&&e[0].type==="web_search"){let r=["\u{1F310} Web Search Results"],n=e[0];return n.content&&(r.push(""),r.push(n.content)),n.citations&&n.citations.length>0&&(r.push(""),r.push("Sources:"),n.citations.forEach((o,i)=>{r.push(`[${i+1}] ${o}`)})),n.instruction&&(r.push(""),r.push(`Note: ${n.instruction}`)),r.join(`
`)}if(typeof e=="string"){let r=e.split(`
`),n=["\u{1F310} Web Search Results"],o=!1,i=[],a=[];for(let s of r){if(s.includes("Sources:")){o=!0;continue}o?a.push(s):s.includes("Here are the web search results")||i.push(s)}return i.length>0&&(n.push(""),n.push(...i.filter(s=>s.trim()))),a.length>0&&(n.push(""),n.push("Sources:"),a.forEach(s=>{s.trim()&&n.push(s)})),n.join(`
`)}return e}static formatYoutubeTranscription(e){let r;if(typeof e=="string")try{r=JSON.parse(e)}catch{return e}else if(typeof e=="object")r=e;else return String(e);if(r.success===!1)return`\u{1F4FA} YouTube Transcription Failed
${r.message}`;if(r.results&&Array.isArray(r.results)){let n=[`\u{1F4FA} YouTube Transcripts (${r.total_urls} video${r.total_urls>1?"s":""})`];n.push("");for(let o of r.results){if(o.success){n.push(`\u{1F4F9} Video: ${o.url}`),n.push("");let i=o.transcript.split(`
`),a=0;for(let s of i)if(s.trim()&&(s.match(/^\[(\d+:\d+)\]/)?(a>0&&n.push(""),n.push(`\u23F0 ${s}`)):n.push(` ${s.trim()}`),a++,a>30)){n.push(""),n.push("... (transcript truncated for display)");break}o.elapsed_time_ms&&(n.push(""),n.push(`Processing time: ${(o.elapsed_time_ms/1e3).toFixed(1)}s`))}else n.push(`\u274C Failed to transcribe: ${o.url}`),n.push(` ${o.message}`);n.push(""),n.push("---"),n.push("")}return n.join(`
`).trimEnd()}if(r.transcript){let n=["\u{1F4FA} YouTube Transcript"];n.push("");let o=r.transcript.split(`
`),i=0;for(let a of o)if(a.trim()&&(a.match(/^\[(\d+:\d+)\]/)?(i>0&&n.push(""),n.push(`\u23F0 ${a}`)):n.push(` ${a.trim()}`),i++,i>50)){n.push(""),n.push("... (transcript truncated for display)");break}return r.elapsed_time_ms&&(n.push(""),n.push(`Processing time: ${(r.elapsed_time_ms/1e3).toFixed(1)}s`)),n.join(`
`)}return typeof e=="object"?JSON.stringify(e,null,2):String(e)}static formatWriteToFile(e){let r=typeof e=="object"?e.result:e,n=String(r).toLowerCase();return n.includes("accepted")?"\u2705 File change: accepted":n.includes("rejected")?"\u274C File change: rejected":typeof e=="object"&&e.message?e.message:String(r)}static formatReplaceInFile(e){let r=0,n="";if(typeof e=="object")r=e.blocksApplied||0,n=e.result||"";else if(typeof e=="string"){let i=e.match(/Applied (\d+) SEARCH\/REPLACE block/);i&&(r=parseInt(i[1])),n=e}let o=String(n).toLowerCase();if(o.includes("accepted")){let i=r===1?"replacement":"replacements";return r>0?`\u2705 ${r} ${i} accepted`:"\u2705 File replacements: accepted"}else if(o.includes("rejected"))return r===0?"\u274C No replacements made":"\u274C File replacements: rejected";return typeof e=="object"&&e.message?e.message:String(n)}}});var ibe,sor=b(()=>{K6e();ibe=class{constructor(e,r){this.toolManager=e;this.writeToFileTool=r;this.buffer=""}findCompleteBlock(e){let r=/<writeToFile>[\s\S]*?<\/writeToFile>/,n=e.match(r);return!n||n.index===void 0?null:{block:n[0],endIdx:n.index+n[0].length}}async*processChunk(e){let r="";if(Array.isArray(e.content))for(let o of e.content)o.type==="text"&&o.text!=null&&(r+=o.text);else e.content!=null&&(r=e.content);r&&(this.buffer+=r),yield e;let n=this.findCompleteBlock(this.buffer);for(;n;){let{block:o,endIdx:i}=n,a=o.match(/<path>([\s\S]*?)<\/path>/),s=o.match(/<content>([\s\S]*?)<\/content>/),u=a?a[1].trim():void 0,l=s?s[1].trim():void 0;try{let c=await this.toolManager.callTool(this.writeToFileTool,{path:u,content:l}),d=qH.format("writeToFile",c);yield{...e,content:`
${d}
`}}catch(c){yield{...e,content:`
Error: ${c?.message||c}
`}}this.buffer=this.buffer.substring(i),n=this.findCompleteBlock(this.buffer)}}}});function G6e(t){let e=[];for(let r of t)if(r){if(typeof r._getType=="function"){let n=r._getType();n==="human"?e.push({role:"user",content:r.content}):n==="ai"&&e.push({role:"assistant",content:r.content})}else if(r.content!==void 0){let n=zqn(r);n&&e.push({role:n,content:r.content})}}return e}function zqn(t){return t.role==="human"||t.role==="user"||t.sender==="user"?"user":t.role==="ai"||t.role==="assistant"||t.sender==="AI"?"assistant":null}function abe(t,e){let r=G6e(t);for(let n of r)e.push({role:n.role,content:n.content})}function uor(t){return t.map(e=>{let r;return typeof e.content=="string"?r=e.content:Array.isArray(e.content)?r=e.content.filter(o=>o.type==="text").map(o=>o.text||"").join(" ")||"[Image content]":r=String(e.content||""),{role:e.role,content:r}})}var J6e=b(()=>{});function Z6e(t){if(!Array.isArray(t))return"";let e=t.filter(n=>n.includeInContext!==!1);return e.length===0?"No relevant documents found.":e.map((n,o)=>{let i=n.title||"Untitled",a=n.path||"",s=n.__sourceId||n.source_id||o+1,u=null;if(n.mtime){let l=new Date(n.mtime);isNaN(l.getTime())||(u=l.toISOString())}return`<document>
<id>${s}</id>
<title>${i}</title>${a&&a!==i?`
<path>${a}</path>`:""}${u?`
<modified>${u}</modified>`:""}
<content>
${n.content||""}
</content>
</document>`}).filter(n=>n.length>0).join(`
`)}function lor(t){try{let e=JSON.parse(t);return Array.isArray(e)?Z6e(e):"Invalid search results format."}catch(e){return Ft("Failed to format localSearch result string:",e),"Error processing search results."}}function cor(t){return Array.isArray(t)?t.map(e=>({title:e.title||e.path||"Untitled",path:e.path||e.title||"",score:e.rerank_score||e.score||0,explanation:e.explanation||null})):[]}function Uqn(t){if(typeof t=="number"){let e=new Date(t);return isNaN(e.getTime())?"":e.toISOString()}if(typeof t=="string"){let e=new Date(t);return isNaN(e.getTime())?"":e.toISOString()}return""}function qqn(t){if(!t)return"";let e=[];try{if(Array.isArray(t.lexicalMatches)&&t.lexicalMatches.length>0){let r=new Set,n=new Set;for(let a of t.lexicalMatches)a?.field&&r.add(String(a.field)),a?.query&&n.add(String(a.query));let o=Array.from(r).join("/"),i=Array.from(n).slice(0,3).join(", ");e.push(`Lexical(${o}): ${i}${n.size>3?", ...":""}`)}if(typeof t.semanticScore=="number"&&t.semanticScore>0&&e.push(`Semantic: ${(t.semanticScore*100).toFixed(1)}%`),t.folderBoost&&typeof t.folderBoost.boostFactor=="number"){let r=t.folderBoost,n=r.folder||"root";e.push(`Folder +${r.boostFactor.toFixed(2)} (${n})`)}if(t.graphConnections&&typeof t.graphConnections=="object"){let r=t.graphConnections,n=[];r.backlinks>0&&n.push(`${r.backlinks} backlinks`),r.coCitations>0&&n.push(`${r.coCitations} co-cites`),r.sharedTags>0&&n.push(`${r.sharedTags} tags`),typeof r.score=="number"?e.push(`Graph ${r.score.toFixed(1)}${n.length?` (${n.join(", ")})`:""}`):n.length&&e.push(`Graph (${n.join(", ")})`)}if(t.graphBoost&&typeof t.graphBoost.boostFactor=="number"&&!t.graphConnections){let r=t.graphBoost;e.push(`Graph +${r.boostFactor.toFixed(2)} (${r.connections} connections)`)}typeof t.baseScore=="number"&&typeof t.finalScore=="number"&&t.baseScore!==t.finalScore&&e.push(`Score: ${t.baseScore.toFixed(4)}\u2192${t.finalScore.toFixed(4)}`)}catch{}return e.join(" | ")}function dor(t){if(!Array.isArray(t)||t.length===0){B("Search Results: (none)");return}let e=0,r=t.map((u,l)=>{let c=Uqn(u.mtime),d=typeof u.rerank_score=="number"?u.rerank_score:u.score||0,f=(Number.isFinite(d)?d:0).toFixed(4),p=u.chunkId||u.path||"",m=qqn(u.explanation),h=u.includeInContext!==!1;return h&&e++,{idx:String(l+1),in:h?"Y":"",path:p,mtime:c,score:f,explanation:m}}),n=r.length;B(`Search Results (debug table): ${n} rows; in-context ${e}/${n}`),qet(r,["idx","in","path","mtime","score","explanation"]);let o=u=>String(u||"").replace(/\|/g,"\\|"),i="| # | IN | PATH | MTIME | SCORE | EXPLANATION |",a="| ---: | :-: | --- | --- | ---: | --- |",s=r.map(u=>`| ${u.idx} | ${u.in} | ${o(u.path)} | ${u.mtime||""} | ${u.score} | ${o(u.explanation)} |`);Uet(["",`Results: ${n} rows; in-context ${e}/${n}`,"",i,a,...s,""])}var por=b(()=>{$t()});var BO,sbe=b(()=>{gVe();er();Ize();jy();$t();fy();_t();CVe();C7();kt();obe();wG();y7();sor();J6e();por();S4();O7();BO=class extends JP{constructor(){super(...arguments);this.lastCitationSources=null}isYoutubeOnlyMessage(r){let n=r.trim(),o=n.includes("@youtube"),i=mCe(n),a=n.split(/\s+/).filter(s=>s!=="@youtube"&&s.length>0);return o&&i!==null&&a.length===1}async processImageUrls(r){let n=[],o=await wF.processUrlBatch(r,n,this.chainManager.app.vault);return wF.showFailedImagesNotice(n),o}async processChatInputImages(r){let n=[],o=await wF.processChatImageBatch(r,n,this.chainManager.app.vault);return wF.showFailedImagesNotice(n),o}extractNoteContent(r){let n=/<note_context>([\s\S]*?)<\/note_context>/g,o=/<active_note>([\s\S]*?)<\/active_note>/g,i=/<content>([\s\S]*?)<\/content>/g,a="",s;for(;(s=n.exec(r))!==null;){let u=s[1],l;for(;(l=i.exec(u))!==null;)a+=l[1]+`
`}for(;(s=o.exec(r))!==null;){let u=s[1],l;for(;(l=i.exec(u))!==null;)a+=l[1]+`
`}return a.trim()}async extractEmbeddedImages(r,n){let o=/!\[\[(.*?\.(png|jpg|jpeg|gif|webp|bmp|svg))\]\]/g,i=/!\[.*?\]\(([^)]+)\)/g,a=[],s=[...r.matchAll(o)];for(let l of s){let c=l[1];if(n){let d=app.metadataCache.getFirstLinkpathDest(c,n);d?a.push(d.path):(Ft(`Could not resolve embedded image: ${c} from source: ${n}`),a.push(c))}else a.push(c)}let u=[...r.matchAll(i)];for(let l of u){let c=l[1].trim();if(!c)continue;if(c.match(/^https?:\/\//)){a.push(c);continue}let d=c.replace(/^\.\//,"").replace(/^\//,"");if(n){let f=app.metadataCache.getFirstLinkpathDest(d,n);f?a.push(f.path):a.push(d)}else a.push(d)}return a}async buildMessageContent(r,n){let o=[],i=[],a=ne(),s=[];if(a.passMarkdownImages){let d;if(n.context?.notes&&n.context.notes.length>0)d=n.context.notes[0].path;else{let p=this.chainManager.app?.workspace.getActiveFile();p&&(d=p.path)}let f=this.extractNoteContent(r);if(f){let p=await this.extractEmbeddedImages(f,d);p.length>0&&s.push({urls:p,type:"embedded"})}}for(let d of s){let f=await this.processImageUrls(d.urls);i.push(...f.successfulImages),o.push(...f.failureDescriptions)}let u=n.content;if(u&&u.length>0){let d=await this.processChatInputImages(u);i.push(...d.successfulImages),o.push(...d.failureDescriptions)}let l=r;o.length>0&&(l=`${r}
Note:
${o.join(`
`)}
`);let c=[{type:"text",text:l}];return i.length>0&&c.push(...i),c}hasCapability(r,n){let o=r.modelName||r.model||"";return this.chainManager.chatModelManager.findModelByName(o)?.capabilities?.includes(n)??!1}isMultimodalModel(r){return this.hasCapability(r,"vision")}appendComposerInstructionsIfNeeded(r,n){if(!n.message||!n.message.includes("@composer"))return r;let o=`<OUTPUT_FORMAT>
${ntt}
</OUTPUT_FORMAT>`;return`${r}
${o}`}async streamMultimodalResponse(r,n,o,i){let u=(await this.chainManager.memoryManager.getMemory().loadMemoryVariables({})).history||[],l=[],c=await this.getSystemPrompt();u.length>0&&(c+=`
The following is the relevant conversation history. Use this context to maintain consistency in your responses:`);let d=this.chainManager.chatModelManager.getChatModel();c&&l.push({role:iI(d),content:`${c}
IMPORTANT: Maintain consistency with previous responses in the conversation. If you've provided information about a person or topic before, use that same information in follow-up questions.`}),abe(u,l);let f=this.chainManager.chatModelManager.getChatModel(),m=this.isMultimodalModel(f)?await this.buildMessageContent(r,n):r;l.push({role:"user",content:m});let h=m instanceof Array?m[0].text:m;B("Enhanced user message: ",h),B("Final request to AI",{messages:l.length});let y=new ibe($O,wye),g=new C_(i),_=await Od(()=>this.chainManager.chatModelManager.getChatModel().stream(l,{signal:o.signal}));for await(let w of _){if(o.signal.aborted){B("CopilotPlus multimodal stream iteration aborted",{reason:o.signal.reason});break}for await(let S of y.processChunk(w))g.processChunk(S)}return g.close()}async run(r,n,o,i,a){let{updateLoadingMessage:s}=a,u="",l=[],c="";if(!await pO({isCopilotPlus:!0}))return await this.handleError(new Error("Invalid license key"),i,o),"";let f=h=>{c=h,o(h)};try{if(this.isYoutubeOnlyMessage(r.message)){let L=mCe(r.message),H="Transcript not available. Only videos with the auto transcript option turned on are supported at the moment.";if(L)try{let K=await Zi.getInstance().youtube4llm(L);return K.response.transcript?this.handleResponse(K.response.transcript,r,n,i,o):this.handleResponse(H,r,n,i,o)}catch(K){return ie("Error processing YouTube video:",K),this.handleResponse(H,r,n,i,o)}}B("Step 1: Analyzing intent");let h,y=r.originalMessage||r.message;try{h=await o$.analyzeIntent(y)}catch(L){return this.handleResponse(Ket(L),r,n,i,o)}let g=r.message.split(" ").filter(L=>!zZ.includes(L.toLowerCase())).join(" ").trim(),{toolOutputs:_,sources:w}=await this.executeToolCalls(h,s);l=w;let C=_.find(L=>L.tool==="localSearch"&&L.output!=null)&&l.length>0,T=(await this.chainManager.memoryManager.getMemory().loadMemoryVariables({})).history||[],I=G6e(T),N=uor(I),M=g;N.length>0&&(B("Condensing question"),M=await gye(g,N),B("Condensed standalone question: ",M));let D=this.prepareEnhancedUserMessage(M,_),k=_.some(L=>L.tool!=="localSearch"&&L.output!=null);C&&!k&&(D=`Answer the question with as detailed as possible based only on the following context:
${D}`),D=this.appendComposerInstructionsIfNeeded(D,r),B("Invoking LLM with all tool results"),u=await this.streamMultimodalResponse(D,r,n,f)}catch(h){s?.(Dv.DEFAULT),h.name==="AbortError"||n.signal.aborted?B("CopilotPlus stream aborted by user",{reason:n.signal.reason}):await this.handleError(h,i,o)}if(n.signal.aborted&&n.signal.reason==="new-chat")return o(""),"";n.signal.aborted&&c&&(u=c);let p=ne(),m=this.lastCitationSources&&this.lastCitationSources.length>0?this.lastCitationSources:(l||[]).map(h=>({title:h.title,path:h.path}));return u=pye(u,m,p.enableInlineCitations),this.handleResponse(u,r,n,i,o,l)}getSources(r){return!r||!Array.isArray(r)?(Ft("No valid documents provided to getSources"),[]):this.sortUniqueDocsByScore(r)}sortUniqueDocsByScore(r){let n=new Map;for(let o of r){if(!o.title||!o?.score&&!o?.rerank_score){Ft("Invalid document structure:",o);continue}let i=o.path||o.title,a=n.get(i),s=o&&"rerank_score"in o,u=s?o.rerank_score:o.score;(!a||u>(a.score??0))&&n.set(i,{title:o.title,path:o.path||o.title,score:u,isReranked:s,explanation:o.explanation||null})}return Array.from(n.values()).sort((o,i)=>(i.score??0)-(o.score??0))}async executeToolCalls(r,n){let o=[],i=[];for(let a of r){B(`Step 2: Calling tool: ${a.tool.name}`),a.tool.name==="localSearch"?n?.(Dv.READING_FILES):a.tool.name==="webSearch"?n?.(Dv.SEARCHING_WEB):a.tool.name==="getFileTree"&&n?.(Dv.READING_FILE_TREE);let s=await $O.callTool(a.tool,a.args);if(a.tool.name==="localSearch"){let l={result:typeof s=="string"?s:JSON.stringify(s),success:s!=null},c=this.getTimeExpression(r),d=this.processLocalSearchResult(l,c);i.push(...d.sources),o.push({tool:a.tool.name,output:d.formattedForLLM})}else o.push({tool:a.tool.name,output:s})}return{toolOutputs:o,sources:S1(i)}}prepareEnhancedUserMessage(r,n){let o="",i=!1,a=n.find(s=>s.tool==="localSearch"&&s.output!=null);if(a&&typeof a.output=="string"&&/<document>/.test(a.output)&&(i=!0),n.length>0){let s=n.filter(u=>u.output!=null);s.length>0&&(o=(i&&s.length===1?"":`
# Additional context:
`)+s.map(l=>{let c=l.output;return typeof c!="string"&&(c=JSON.stringify(c)),l.tool==="localSearch"?c:`<${l.tool}>
${c}
</${l.tool}>`}).join(`
`))}return i&&n.filter(s=>s.output!=null).length===1?`${o}
Question: ${r}`:`${r}${o}`}getTimeExpression(r){let n=r.find(o=>o.tool.name==="getTimeRangeMs");return n?n.args.timeExpression:""}prepareLocalSearchResult(r,n){let o=r.filter(p=>p.includeInContext),i=o.reduce((p,m)=>p+(m.content?.length||0),0),a=o;if(i>vCe){let p=vCe/i;B("Truncating document contents to fit context length. Truncation ratio:",p),a=o.map(m=>({...m,content:m.content?.slice(0,Math.floor((m.content?.length||0)*p))||""}))}let s=a.map((p,m)=>({...p,__sourceId:m+1,content:mye(p.content||"")})),u=Z6e(s),l=s.slice(0,Math.min(20,s.length)).map(p=>({title:p.title||p.path||"Untitled",path:p.path||p.title||""})),c=hye(l);this.lastCitationSources=s.slice(0,Math.min(20,s.length)).map((p,m)=>({title:p.title||p.path||"Untitled",path:p.path||void 0}));let d=ne(),f=qer(d.enableInlineCitations,c);return n?`<localSearch timeRange="${n}">
${u}${f}
</localSearch>`:`<localSearch>
${u}${f}
</localSearch>`}processLocalSearchResult(r,n){let o=[],i;if(!r.success)return i=`<localSearch>
Search failed.
</localSearch>`,{formattedForLLM:i,sources:o};try{let a=JSON.parse(r.result),s=a&&typeof a=="object"&&a.type==="local_search"&&Array.isArray(a.documents)?a.documents:null;if(!Array.isArray(s))return i=`<localSearch>
Invalid search results format.
</localSearch>`,{formattedForLLM:i,sources:o};dor(s),o=cor(s),i=this.prepareLocalSearchResult(s,n||"")}catch(a){Ft("Failed to parse localSearch results:",a);let s=lor(r.result);i=n?`<localSearch timeRange="${n}">
${s}
</localSearch>`:`<localSearch>
${s}
</localSearch>`}return{formattedForLLM:i,sources:o}}async getSystemPrompt(){return Rf()}}});var UZ,hor=b(()=>{la();_t();wR();sbe();UZ=class extends BO{async getSystemPrompt(){let e=Rf(),r=Su();if(!r)return e;let n=await Wd.instance.getProjectContext(r.id);return e=`${e}
<project_system_prompt>
${r.systemPrompt}
</project_system_prompt>`,n&&(e=`${e}
<project_context>
${n}
</project_context>`),e}}});var zO,ube=b(()=>{zO=class t{constructor(){this.tools=new Map}static getInstance(){return t.instance||(t.instance=new t),t.instance}register(e){this.tools.set(e.metadata.id,e)}registerAll(e){e.forEach(r=>this.register(r))}getAllTools(){return Array.from(this.tools.values())}getEnabledTools(e,r){let n=[];for(let[o,i]of this.tools){let{metadata:a,tool:s}=i;if(a.isAlwaysEnabled){(!a.requiresVault||r)&&n.push(s);continue}e.has(o)&&(!a.requiresVault||r)&&n.push(s)}return n}getToolsByCategory(){let e=new Map;for(let r of this.tools.values()){let n=r.metadata.category;e.has(n)||e.set(n,[]),e.get(n).push(r)}return e}getConfigurableTools(){return Array.from(this.tools.values()).filter(e=>!e.metadata.isAlwaysEnabled)}getCopilotCommandMappings(){let e=new Map;for(let r of this.tools.values()){let n=r.metadata.copilotCommands;if(n)for(let o of n){let i=o.toLowerCase();e.has(i)||e.set(i,r)}}return e}getToolMetadata(e){return this.tools.get(e)?.metadata}clear(){this.tools.clear()}}});function Vqn(t){zO.getInstance().register({tool:xye(t.getRoot()),metadata:{id:"getFileTree",displayName:"File Tree",description:"Browse vault file structure",category:"file",isAlwaysEnabled:!0,requiresVault:!0,customPromptInstructions:`For getFileTree:
- Use to browse the vault's file structure
- No parameters needed
Example usage:
<use_tool>
<name>getFileTree</name>
</use_tool>`}})}function lbe(t){let e=zO.getInstance(),r=e.getToolMetadata("getFileTree")!==void 0,n=t!==void 0;(e.getAllTools().length===0||r!==n)&&(e.clear(),e.registerAll(Hqn),t&&Vqn(t))}var Hqn,Y6e=b(()=>{ube();RVe();V6e();W6e();CVe();PVe();Hqn=[{tool:E7,metadata:{id:"localSearch",displayName:"Vault Search",description:"Search through your vault notes",category:"search",copilotCommands:["@vault"],customPromptInstructions:`For localSearch (searching notes in the vault):
- You MUST always provide both "query" (string) and "salientTerms" (array of strings)
- salientTerms MUST be extracted from the user's original query - never invent new terms
- They are keywords used for BM25 full-text search to find notes containing those exact words
- Extract meaningful content words from the query (nouns, verbs, names, etc.)
- Exclude common words like "what", "I", "do", "the", "a", etc.
- Exclude time expressions like "last month", "yesterday", "last week"
- Preserve the original language - do NOT translate terms to English
Example usage:
<use_tool>
<name>localSearch</name>
<query>piano learning practice</query>
<salientTerms>["piano", "learning", "practice"]</salientTerms>
</use_tool>
For localSearch with time range (e.g., "what did I do last week"):
Step 1 - Get time range:
<use_tool>
<name>getTimeRangeMs</name>
<timeExpression>last week</timeExpression>
</use_tool>
Step 2 - Search with time range (after receiving time range result):
<use_tool>
<name>localSearch</name>
<query>what did I do</query>
<salientTerms>[]</salientTerms>
<timeRange>{"startTime": {...}, "endTime": {...}}</timeRange>
</use_tool>
For localSearch with meaningful terms (e.g., "python debugging notes from yesterday"):
Step 1 - Get time range:
<use_tool>
<name>getTimeRangeMs</name>
<timeExpression>yesterday</timeExpression>
</use_tool>
Step 2 - Search with time range:
<use_tool>
<name>localSearch</name>
<query>python debugging notes</query>
<salientTerms>["python", "debugging", "notes"]</salientTerms>
<timeRange>{"startTime": {...}, "endTime": {...}}</timeRange>
</use_tool>
For localSearch with non-English query (PRESERVE ORIGINAL LANGUAGE):
<use_tool>
<name>localSearch</name>
<query>\u94A2\u7434\u5B66\u4E60</query>
<salientTerms>["\u94A2\u7434", "\u5B66\u4E60"]</salientTerms>
</use_tool>`}},{tool:P7,metadata:{id:"webSearch",displayName:"Web Search",description:"Search the internet for information",category:"search",copilotCommands:["@websearch","@web"],customPromptInstructions:`For webSearch:
- Only use when the user explicitly requests web/internet search
- Always provide an empty chatHistory array
Example usage:
<use_tool>
<name>webSearch</name>
<query>piano learning techniques</query>
<chatHistory>[]</chatHistory>
</use_tool>`}},{tool:Qye,metadata:{id:"getCurrentTime",displayName:"Get Current Time",description:"Get the current time in any timezone",category:"time",isAlwaysEnabled:!0,customPromptInstructions:`For time queries (IMPORTANT: Always use UTC offsets, not timezone names):
Example 1 - "what time is it" (local time):
<use_tool>
<name>getCurrentTime</name>
</use_tool>
Example 2 - "what time is it in Tokyo" (UTC+9):
<use_tool>
<name>getCurrentTime</name>
<timezoneOffset>+9</timezoneOffset>
</use_tool>
Example 3 - "what time is it in New York" (UTC-5 or UTC-4 depending on DST):
<use_tool>
<name>getCurrentTime</name>
<timezoneOffset>-5</timezoneOffset>
</use_tool>`}},{tool:tbe,metadata:{id:"getTimeInfoByEpoch",displayName:"Get Time Info",description:"Convert epoch timestamp to human-readable format",category:"time",isAlwaysEnabled:!0}},{tool:ebe,metadata:{id:"getTimeRangeMs",displayName:"Get Time Range",description:"Convert time expressions to date ranges",category:"time",isAlwaysEnabled:!0,customPromptInstructions:`For time-based queries:
- Use this tool to convert time expressions like "last week", "yesterday", "last month" to proper time ranges
- This is typically the first step before using localSearch with a time range
Example:
<use_tool>
<name>getTimeRangeMs</name>
<timeExpression>last week</timeExpression>
</use_tool>`}},{tool:rbe,metadata:{id:"convertTimeBetweenTimezones",displayName:"Convert Timezones",description:"Convert time between different timezones",category:"time",isAlwaysEnabled:!0,customPromptInstructions:`For timezone conversions:
Example - "what time is 6pm PT in Tokyo" (PT is UTC-8 or UTC-7, Tokyo is UTC+9):
<use_tool>
<name>convertTimeBetweenTimezones</name>
<time>6pm</time>
<fromOffset>-8</fromOffset>
<toOffset>+9</toOffset>
</use_tool>`}},{tool:BZ,metadata:{id:"pomodoro",displayName:"Pomodoro Timer",description:"Manage time with Pomodoro technique",category:"time",copilotCommands:["@pomodoro"]}},{tool:wye,metadata:{id:"writeToFile",displayName:"Write to File",description:"Create or modify files in your vault",category:"file",requiresVault:!0,copilotCommands:["@composer"],customPromptInstructions:`For writeToFile:
- NEVER display the file content directly in your response
- Always pass the complete file content to the tool
- Include the full path to the file
- You MUST explicitly call writeToFile for any intent of updating or creating files
- Do not call writeToFile tool again if the result is not accepted
- Do not call writeToFile tool if no change needs to be made
Example usage:
<use_tool>
<name>writeToFile</name>
<path>path/to/note.md</path>
<content>FULL CONTENT OF THE NOTE</content>
</use_tool>`}},{tool:ctr,metadata:{id:"replaceInFile",displayName:"Replace in File",description:"Make targeted changes to existing files using SEARCH/REPLACE blocks",category:"file",requiresVault:!0,customPromptInstructions:`For replaceInFile:
- Remember: Small edits \u2192 replaceInFile, Major rewrites \u2192 writeToFile
- SEARCH text must match EXACTLY including all whitespace
Example usage:
<use_tool>
<name>replaceInFile</name>
<path>notes/meeting.md</path>
<diff>
------- SEARCH
## Attendees
- John Smith
- Jane Doe
=======
## Attendees
- John Smith
- Jane Doe
- Bob Johnson
+++++++ REPLACE
</diff>
</use_tool>`}},{tool:aor,metadata:{id:"youtubeTranscription",displayName:"YouTube Transcription",description:"Get transcripts from YouTube videos",category:"media",copilotCommands:["@youtube"],customPromptInstructions:`For youtubeTranscription:
- Use when user provides YouTube URLs
- No parameters needed - the tool will process URLs from the conversation
Example usage:
<use_tool>
<name>youtubeTranscription</name>
</use_tool>`}}]});function Wqn(){return 1e4}function Kqn(t,e){let r=e??Wqn();if(!t||t.length<=r)return t;let n=t.substring(0,r),o=t.length-r;return`${n}
... (truncated ${o.toLocaleString()} characters)`}function Gqn(t,e,r){let n=Kqn(e,r);return`Tool '${t}' result: ${n}`}function X6e(t,e=!1){return t.map(r=>e?Gqn(r.toolName,r.result):`Tool '${r.toolName}' result: ${r.result}`).join(`
`)}var gor=b(()=>{});function yor(t){let e=["find","search","look for","look up","my notes","in my vault","from my vault","check the web","search online","from the internet","current time","what time","timer","youtube","video","transcript"],r=t.toLowerCase();return e.some(n=>r.includes(n))}var r8e,i$,Q6e,e8e,t8e,qZ,bor=b(()=>{$t();r8e=50,i$=class{constructor(e){this.modelName=e}buildToolSpecificInstructions(e){let r=[];for(let o of e)o.customPromptInstructions&&r.push(o.customPromptInstructions);let n=this.buildCopilotCommandInstructions(e);return n&&r.push(n),r.length>0?r.join(`
`):""}buildCopilotCommandInstructions(e){let r=[];for(let n of e)if(!(!n.copilotCommands||n.copilotCommands.length===0))for(let o of n.copilotCommands)r.push(`- ${o}: call the tool named ${n.id}`);return r.length===0?null:["When the user explicitly includes a Copilot command alias (e.g., @vault) in their message, treat it as a direct request to call the mapped tool before proceeding.","Honor these aliases exactly (case-insensitive):",...r,"If the referenced tool is unavailable, explain that the command cannot be fulfilled instead of ignoring it."].join(`
`)}enhanceSystemPrompt(e,r,n,o){let i=o||[],a=this.buildToolSpecificInstructions(i);return`${e}
# Autonomous Agent Mode
You are now in autonomous agent mode. You can use tools to gather information and complete tasks step by step.
When you need to use a tool, format it EXACTLY like this:
<use_tool>
<name>tool_name_here</name>
<parameter_name>value</parameter_name>
<another_parameter>["array", "values"]</another_parameter>
</use_tool>
IMPORTANT: Use the EXACT parameter names as shown in the tool descriptions below. Do NOT use generic names like "param1" or "param".
Available tools:
${r}
# Tool Usage Guidelines
## Time-based Queries
When users ask about temporal periods (e.g., "what did I do last month", "show me notes from last week"), you MUST:
1. First call getTimeRangeMs to convert the time expression to a proper time range
2. Then use localSearch with the timeRange parameter from step 1
3. For salientTerms, ONLY use words that exist in the user's original query (excluding time expressions)
Example for "what did I do last month":
1. Call getTimeRangeMs with timeExpression: "last month"
2. Use localSearch with query matching the user's question
3. salientTerms: [] - empty because "what", "I", "do" are not meaningful search terms
Example for "meetings about project X last week":
1. Call getTimeRangeMs with timeExpression: "last week"
2. Use localSearch with query "meetings about project X"
3. salientTerms: ["meetings", "project", "X"] - these words exist in the original query
${a?a+`
`:""}## General Guidelines
- Think hard about whether a query could potentially be answered from personal knowledge or notes, if yes, call a vault search (localSearch) first
- Only use web search if: the query explicitly asks for web search, OR the query explicitly requires current/web information
- NEVER mention tool names like "localSearch", "webSearch", etc. in your responses. Use natural language like "searching your vault", "searching the web", etc.
You can use multiple tools in sequence. After each tool execution, you'll receive the results and can decide whether to use more tools or provide your final response.
Always explain your reasoning before using tools. Be conversational and clear about what you're doing.
When you've gathered enough information, provide your final response without any tool calls.
IMPORTANT: Do not include any code blocks (\`\`\`) or tool_code blocks in your responses. Only use the <use_tool> format for tool calls.
NOTE: Use individual XML parameter tags. For arrays, use JSON format like ["item1", "item2"].`}enhanceUserMessage(e,r){return e}needsSpecialHandling(){return!1}},Q6e=class extends i${isGPT5Model(){return this.modelName.includes("gpt-5")||this.modelName.includes("gpt5")}enhanceSystemPrompt(e,r,n,o){let i=super.enhanceSystemPrompt(e,r,n,o),a=n||[],s=a.includes("writeToFile")||a.includes("replaceInFile"),u="";return this.isGPT5Model()?u=`
GPT-5 SPECIFIC RULES:
- Use maximum 2 tool calls initially, then provide an answer
- Call each tool ONCE per unique query
- For optional parameters: OMIT them entirely if not needed (don't pass empty strings/null)
- For localSearch: OMIT timeRange if not doing time-based search
Example localSearch without time:
<use_tool>
<name>localSearch</name>
<query>piano notes</query>
<salientTerms>["piano", "notes"]</salientTerms>
</use_tool>`:u=`
CRITICAL FOR GPT MODELS: You MUST ALWAYS include XML tool calls in your response. Do not just describe what you plan to do - you MUST include the actual XML tool call blocks.`,s&&(u+=`
\u{1F6A8} FILE EDITING WITH COMPOSER TOOLS - GPT SPECIFIC EXAMPLES \u{1F6A8}
When user asks you to edit or modify a file, you MUST:
1. Determine if it's a small edit (use replaceInFile) or major rewrite (use writeToFile)
2. Include the tool call immediately in your response
EXAMPLE 1 - User says "fix the typo 'teh' to 'the' in my note":
\u2705 CORRECT RESPONSE:
"I'll fix the typo in your note.
<use_tool>
<name>replaceInFile</name>
<path>path/to/note.md</path>
<diff>
------- SEARCH
teh
=======
the
+++++++ REPLACE
</diff>
</use_tool>"
EXAMPLE 2 - User says "add item 4 to the list":
\u2705 CORRECT RESPONSE:
"I'll add item 4 to your list.
<use_tool>
<name>replaceInFile</name>
<path>path/to/file.md</path>
<diff>
------- SEARCH
- Item 1
- Item 2
- Item 3
=======
- Item 1
- Item 2
- Item 3
- Item 4
+++++++ REPLACE
</diff>
</use_tool>"
\u274C WRONG (DO NOT DO THIS):
"I'll help you add item 4 to the list. Let me update that for you."
[No tool call = FAILURE]
CRITICAL: The diff parameter MUST contain the SEARCH/REPLACE blocks wrapped in triple backticks EXACTLY as shown above.`),u+=`
FINAL REMINDER FOR GPT MODELS: If the user asks you to search, find, edit, or modify anything, you MUST include the appropriate <use_tool> XML block in your very next response. Do not wait for another turn.`,i+u}enhanceUserMessage(e,r){return r?this.getBaseEnhancement(e,r):e}getBaseEnhancement(e,r){if(!r)return e;let n=e.toLowerCase(),o=n.includes("find")||n.includes("search")||n.includes("my notes"),i=n.includes("edit")||n.includes("modify")||n.includes("update")||n.includes("change")||n.includes("fix")||n.includes("add")||n.includes("typo");return o?`${e}
REMINDER: Use the <use_tool> XML format to call the localSearch tool.`:i?`${e}
\u{1F6A8} GPT REMINDER: Use replaceInFile for small edits (with SEARCH/REPLACE blocks in diff parameter). The diff parameter MUST contain triple backticks around the SEARCH/REPLACE blocks. Check the examples in your system prompt.`:e}needsSpecialHandling(){return!0}},e8e=class extends i${isThinkingModel(){return this.modelName.includes("claude-3-7-sonnet")||this.modelName.includes("claude-sonnet-4")||this.modelName.includes("claude-3.7-sonnet")||this.modelName.includes("claude-4-sonnet")}isClaudeSonnet4(){return this.modelName.includes("claude-sonnet-4")||this.modelName.includes("claude-4-sonnet")||this.modelName.includes("claude-sonnet-4-20250514")}enhanceSystemPrompt(e,r,n,o){let i=super.enhanceSystemPrompt(e,r,n,o);if(this.isThinkingModel()){let a=`
IMPORTANT FOR CLAUDE THINKING MODELS:
- You are a thinking model with internal reasoning capability
- Your thinking process will be automatically wrapped in <think> tags - do not manually add thinking tags
- Place ALL tool calls AFTER your thinking is complete, in the main response body
- Tool calls must be in the main response body, NOT inside thinking sections
- Format tool calls exactly as shown in the examples above
- Do not provide final answers before using tools - use tools first, then provide your response based on the results
- If you need to use tools, include them immediately after your thinking, before any final response
CORRECT FLOW FOR THINKING MODELS:
1. Think through the problem (this happens automatically)
2. Use tools to gather information (place tool calls in main response)
3. Wait for tool results
4. Provide final response based on gathered information
INCORRECT: Providing a final answer before using tools
CORRECT: Using tools first, then providing answer based on results`;return this.isClaudeSonnet4()&&(a+=`
\u{1F6A8} CRITICAL INSTRUCTIONS FOR CLAUDE SONNET 4 - AUTONOMOUS AGENT MODE \u{1F6A8}
\u26A0\uFE0F WARNING: You have a specific tendency to write complete responses immediately after tool calls. This BREAKS the autonomous agent pattern!
\u{1F504} CORRECT AUTONOMOUS AGENT ITERATION PATTERN:
1. User asks question
2. Brief sentence about what you'll do (1 sentence max)
3. Use tools to gather information: <use_tool>...</use_tool>
4. \u270B STOP after tool calls - Do not write anything else
5. Wait for tool results (system provides them)
6. Evaluate results and either: Use more tools OR provide final answer
\u2705 IDEAL RESPONSE FLOW:
- Brief action statement (1 sentence)
- Tool calls
- STOP (wait for results)
- Brief transition statement (1 sentence)
- More tool calls OR final answer
\u{1F3AF} CORRECT FIRST RESPONSE PATTERN (when tools needed):
I'll search your vault for piano practice information.
<use_tool>
<name>localSearch</name>
<query>piano practice</query>
<salientTerms>["piano", "practice"]</salientTerms>
</use_tool>
\u{1F310} MULTILINGUAL EXAMPLE (PRESERVE ORIGINAL LANGUAGE):
<use_tool>
<name>localSearch</name>
<query>\u30D4\u30A2\u30CE\u306E\u7DF4\u7FD2\u65B9\u6CD5</query>
<salientTerms>["\u30D4\u30A2\u30CE", "\u7DF4\u7FD2", "\u65B9\u6CD5"]</salientTerms>
</use_tool>
<use_tool>
<name>webSearch</name>
<query>piano techniques</query>
<chatHistory>[]</chatHistory>
</use_tool>
[RESPONSE ENDS HERE - NO MORE TEXT]
\u{1F3AF} CORRECT FOLLOW-UP RESPONSE PATTERN:
Let me gather more specific information about practice schedules.
<use_tool>
<name>localSearch</name>
<query>practice schedule</query>
<salientTerms>["practice", "schedule"]</salientTerms>
</use_tool>
[RESPONSE ENDS HERE - NO MORE TEXT]
\u274C WRONG PATTERN (DO NOT DO THIS):
<use_tool>...</use_tool>
Based on the search results, here's a complete practice plan...
[This is FORBIDDEN - you haven't received results yet!]
\u{1F511} KEY UNDERSTANDING FOR CLAUDE 4:
- Brief 1-sentence explanations BEFORE tool calls are good
- Each response is ONE STEP in a multi-step process
- After tool calls, STOP and wait for the system to provide results
- Your thinking is automatically handled in <think> blocks
\u26A1 AUTONOMOUS AGENT RULES FOR CLAUDE 4:
1. If you need tools: Brief sentence + tool calls, then STOP
2. If you receive tool results: Evaluate if you need more tools
3. If you need more tools: Brief sentence + more tool calls, then STOP
4. If you have enough info: THEN provide your final response
REMEMBER: One brief sentence before tools is perfect. Nothing after tool calls.`),i+a}return i}needsSpecialHandling(){return this.isThinkingModel()}detectPrematureResponse(e){let r=e.indexOf("<use_tool>");if(r===-1)return{hasPremature:!1,type:null};let o=e.substring(0,r).trim().replace(/<think>[\s\S]*?<\/think>/g,"").trim();if(o.split(/[.!?]+/).filter(u=>u.trim().length>0).length>2||o.length>200)return{hasPremature:!0,type:"before"};let s=e.lastIndexOf("</use_tool>");return s!==-1&&e.substring(s+11).trim().replace(/<think>[\s\S]*?<\/think>/g,"").trim().length>100?{hasPremature:!0,type:"after"}:{hasPremature:!1,type:null}}sanitizeResponse(e,r){if(!this.isClaudeSonnet4()||r!==1)return e;let n=this.detectPrematureResponse(e);if(!n.hasPremature)return e;if(n.type==="after"){let o=e.lastIndexOf("</use_tool>");if(o!==-1){let i=e.substring(0,o+11),a=e.substring(o+11),s=/<think>[\s\S]*?<\/think>/g,u=a.match(s)||[];return i+(u.length>0?`
`+u.join(`
`):"")}}return e}shouldTruncateStreaming(e){if(!this.isClaudeSonnet4())return!1;let r=e.lastIndexOf("</use_tool>");return r===-1?!1:e.substring(r+11).trim().replace(/<think>[\s\S]*?<\/think>/g,"").trim().length>r8e}},t8e=class extends i${enhanceSystemPrompt(e,r,n,o){let i=super.enhanceSystemPrompt(e,r,n,o),u=`
\u{1F6A8} CRITICAL INSTRUCTIONS FOR GEMINI - AUTONOMOUS AGENT MODE \u{1F6A8}
You MUST use tools to complete tasks. DO NOT ask the user questions about how to proceed.
${(n||[]).includes("localSearch")?`
When the user mentions "my notes" or "my vault", use the localSearch tool.
\u274C WRONG:
"Let's start by searching your notes. What kind of information should I look for?"
\u2705 CORRECT:
<use_tool>
<name>localSearch</name>
<query>piano</query>
<salientTerms>["piano"]</salientTerms>
</use_tool>
`:""}
GEMINI SPECIFIC RULES:
1. When user mentions "my notes" about X \u2192 use localSearch with query "X"
2. DO NOT ask clarifying questions about search terms
3. DO NOT wait for permission to use tools
4. Use tools based on the user's request
PATTERN FOR MULTI-STEP REQUESTS:
User: "based on my project roadmap notes and create summary"
Your response:
<use_tool>
<name>localSearch</name>
<query>project roadmap</query>
<salientTerms>["project", "roadmap"]</salientTerms>
</use_tool>
Remember: The user has already told you what to do. Execute it NOW with the available tools.`;return i+u}enhanceUserMessage(e,r){return r?`${e}
REMINDER: Use the tools immediately. Do not ask questions. For "my notes", use localSearch.`:e}needsSpecialHandling(){return!0}},qZ=class{static createAdapter(e){let r=(e.modelName||e.model||"").toLowerCase();if(B(`Creating model adapter for: ${r}`),r.includes("gpt")){let n=new Q6e(r);return n.isGPT5Model()?B("Using GPTModelAdapter with GPT-5 specific enhancements"):B("Using GPTModelAdapter"),n}return r.includes("claude")?(B("Using ClaudeModelAdapter"),new e8e(r)):r.includes("gemini")||r.includes("google/gemini")?(B("Using GeminiModelAdapter"),new t8e(r)):r.includes("copilot-plus")?(B("Using BaseModelAdapter for Copilot Plus"),new i$(r)):(B("Using BaseModelAdapter (default)"),new i$(r))}}});function cbe(t){let e=[];try{let r=/<use_tool>([\s\S]*?)<\/use_tool>/g,n;for(;(n=r.exec(t))!==null;){let o=n[1],i=o.match(/<name>([\s\S]*?)<\/name>/);if(i){let a=i[1].trim();if(!a||a.length===0){Ft("Skipping tool call with empty name");continue}let s={},u=o.replace(/<name>[\s\S]*?<\/name>/,""),l=/<([^>]+)>([\s\S]*?)<\/\1>/g,c;for(;(c=l.exec(u))!==null;){let d=c[1].trim(),f=c[2].trim();d&&(s[d]=n8e(f,d))}e.push({name:a,args:s})}}}catch(r){return ie("Error parsing XML tool calls:",r),[]}return e}function n8e(t,e){if(!t)return e==="chatHistory"||e==="salientTerms"?[]:"";if(!/<[^>]+>/.test(t)){if(t.startsWith("[")&&t.endsWith("]")||t.startsWith("{")&&t.endsWith("}"))try{return JSON.parse(t)}catch{return t}return t}let n=t.match(/<item>([\s\S]*?)<\/item>/g);if(n)return n.map(s=>{let u=s.replace(/<\/?item>/g,"").trim();return n8e(u)});let o=/<([^>]+)>([\s\S]*?)<\/\1>/g,i=[],a;for(;(a=o.exec(t))!==null;){let s=a[1].trim(),u=a[2].trim();i.push([s,n8e(u)])}return i.length>0?Object.fromEntries(i):t}function _or(t){t=t.replace(/<use_tool>[\s\S]*?<\/use_tool>/g,"");let e=t.match(/<use_tool>([\s\S]*)/),n=(e?e[1]:t).match(/<name>([\s\S]*?)<\/name>/);return n&&n[1].trim()||null}function HZ(t){let e=t;return e=e.replace(/<use_tool>[\s\S]*?<\/use_tool>/g,""),e=e.replace(/<use_tool>([\s\S]*)$/g,""),e=e.replace(/```\w*\s*```/g,""),e=e.replace(/```tool_code[\s\S]*?```/g,""),e=e.replace(/```[\w]*[\s\n]*```/g,""),e=e.replace(/\n\s*\n\s*\n/g,`
`).trim(),e}var o8e=b(()=>{$t()});var VZ,vor=b(()=>{$t();fy();_t();Y6e();Kk();ube();kt();gor();sbe();J6e();bor();S4();x4();O7();o8e();VZ=class t extends BO{constructor(){super(...arguments);this.llmFormattedMessages=[]}getAvailableTools(){let r=ne(),n=zO.getInstance();n.getAllTools().length===0&&lbe(this.chainManager.app?.vault);let o=new Set(r.autonomousAgentEnabledToolIds||[]);return n.getEnabledTools(o,!!this.chainManager.app?.vault)}static generateToolDescriptions(r){return r.map(o=>{let i="",a=str(o.schema);return Object.keys(a).length>0&&(i=Object.entries(a).map(([s,u])=>`<${s}>${u}</${s}>`).join(`
`)),`<${o.name}>
<description>${o.description}</description>
<parameters>
${i}
</parameters>
</${o.name}>`}).join(`
`)}static generateSystemPrompt(r,n){let o=Rf(),i=t.generateToolDescriptions(r),a=r.map(l=>l.name),s=zO.getInstance(),u=r.map(l=>s.getToolMetadata(l.name)).filter(l=>l!==void 0);return n.enhanceSystemPrompt(o,i,a,u)}generateSystemPrompt(){let r=this.getAvailableTools(),n=this.chainManager.chatModelManager.getChatModel(),o=qZ.createAdapter(n);return t.generateSystemPrompt(r,o)}getTemporaryToolCallId(r,n){return`temporary-tool-call-id-${r}-${n}`}async run(r,n,o,i,a){let s="",u=[],l=[],c=[];if(this.llmFormattedMessages=[],!await pO({isAutonomousAgent:!0}))return await this.handleError(new Error("Invalid license key"),i,o),"";try{let y=(await this.chainManager.memoryManager.getMemory().loadMemoryVariables({})).history||[],g=this.generateSystemPrompt(),_=this.chainManager.chatModelManager.getChatModel(),w=qZ.createAdapter(_);g&&u.push({role:iI(_),content:g}),abe(y,u);let S=this.isMultimodalModel(_),C=yor(r.message),E=w.enhanceUserMessage(r.message,C),P=S?await this.buildMessageContent(E,r):E;u.push({role:"user",content:P});let T=r.originalMessage||r.message,I=ne().autonomousAgentMaxIterations,N=0;for(;N<I&&!n.signal.aborted;){N++,B(`=== Autonomous Agent Iteration ${N} ===`);let M=[],D=await this.streamResponse(u,n,U=>{let z=HZ(U),V=[];V.push(...l),z.trim()&&V.push(z);let q=cbe(U),W=[];q.length>0&&(W=q.map(pe=>pe.name));let J=this.getAvailableTools(),se=new Set(J.filter(pe=>pe.isBackground).map(pe=>pe.name)),be=_or(U);if(be){let pe=U.lastIndexOf(be);U.length-pe>r8e&&W.push(be)}W=W.filter(pe=>!se.has(pe));for(let pe=0;pe<W.length;pe++){let Me=W[pe],Ue=this.getTemporaryToolCallId(Me,pe);if(M.findIndex($r=>$r.includes(Ue))!==-1)continue;let pr=Gde(Ue,Me,Gk(Me),hH(Me),"",!0,"","");M.push(pr)}M.length>0&&V.push(M.join(`
`));let ce=V.join(`
`);o(ce)},w);if(!D)break;let k=cbe(D),L=w.detectPrematureResponse?.(D);if(L?.hasPremature&&N===1&&(L.type==="before"?(Ft("\u26A0\uFE0F Model provided premature response BEFORE tool calls!"),Ft("Sanitizing response to keep only tool calls for first iteration")):L.type==="after"&&(Ft("\u26A0\uFE0F Model provided hallucinated response AFTER tool calls!"),Ft("Truncating response at last tool call for first iteration"))),k.length===0){let U=HZ(D),z=[...l];U.trim()&&z.push(U),s=z.join(`
`),this.llmFormattedMessages.push(D);break}let H=D;w.sanitizeResponse&&L?.hasPremature&&(H=w.sanitizeResponse(D,N));let K=HZ(H);K.trim()&&l.push(K);let G=[],X=new Map;M.splice(k.length);for(let U=0;U<k.length;U++){let z=k[U];if(n.signal.aborted)break;AVe(z,N);let V=this.getAvailableTools(),W=V.find(be=>be.name===z.name)?.isBackground||!1,J;if(!W){let be=hH(z.name),ce=Gk(z.name),pe=ftr(z.name);J=`${z.name}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,X.set(U,J);let Me=Gde(J,z.name,ce,be,pe||"",!0,"",""),Ue=M.findIndex(pr=>pr.includes(this.getTemporaryToolCallId(z.name,U)));Ue!==-1?M[Ue]=Me:(M.push(Me),Ft("Created tool call marker for tool call that was not created during streaming",z.name));let Et=[...l,...M].join(`
`);o(Et)}let se=await TVe(z,V,T);if(z.name==="localSearch"){let be=this.processLocalSearchResult(se);c.push(...be.sources),se.result=be.formattedForLLM}if(G.push(se),J&&!W){let be=M.findIndex(pe=>pe.includes(J));be!==-1&&(M[be]=Lze(M[be],J,se.result));let ce=[...l,...M].join(`
`);o(ce)}IVe(z.name,se)}if(M.length>0){let U=M.join(`
`);l.push(U)}if(this.llmFormattedMessages.push(D),G.length>0){let U=X6e(G,!0);U&&this.llmFormattedMessages.push(U)}let{ensureEncodedToolCallMarkerResults:F}=await Promise.resolve().then(()=>(x4(),Jde)),Q=F(D);u.push({role:"assistant",content:Q});let ee=X6e(G,!1);u.push({role:"user",content:ee}),B("Tool results added to conversation")}if(N>=I&&!s){Ft(`Autonomous agent reached maximum iterations (${I}) without completing the task`);let M=`
I've reached the maximum number of iterations (${I}) for this task. I attempted to gather information using various tools but couldn't complete the analysis within the iteration limit. You may want to try a more specific question or break down your request into smaller parts.`;s=l.join(`
`)+M}}catch(m){if(m.name==="AbortError"||n.signal.aborted)B("Autonomous agent stream aborted by user",{reason:n.signal.reason});else{ie("Autonomous agent failed, falling back to regular Plus mode:",m);try{return await new BO(this.chainManager).run(r,n,o,i,a)}catch(h){return ie("Fallback to regular Plus mode also failed:",h),await this.handleError(h,i,o),""}}}let f=S1(c),p=this.llmFormattedMessages.join(`
`);return!s&&l.length>0&&(Ft("fullAIResponse was empty, using iteration history"),s=l.join(`
`)),await Promise.resolve().then(()=>(x4(),Jde)),this.handleResponse(s,r,n,i,o,f.length>0?f:void 0,p)}async streamResponse(r,n,o,i){let a=new C_(o,i),s=2,u=0;for(;u<=s;)try{let l=await Od(()=>this.chainManager.chatModelManager.getChatModel().stream(r,{signal:n.signal}));for await(let c of l){if(n.signal.aborted)break;a.processChunk(c)}return a.close()}catch(l){if(l.name==="AbortError"||n.signal.aborted)return a.close();if((l?.message?.includes("overloaded")||l?.message?.includes("Overloaded")||l?.error?.type==="overloaded_error")&&u<s){u++,B(`Retrying autonomous agent request (attempt ${u}/${s+1}) due to overloaded error`),await new Promise(d=>setTimeout(d,1e3*u));continue}throw l}return a.close()}}});var wor=b(()=>{wG();xHt();Ker();sbe();hor();vor();S4();o8e();O7()});var HH,xor,dbe,i8e,Sor=b(()=>{HH=class{},xor=(t,e)=>{if(e!==void 0)return t[e];let r=Object.keys(t);if(r.length===1)return t[r[0]]},dbe=(t,e)=>{let r=xor(t,e);if(!r){let n=Object.keys(t);throw new Error(`input values have ${n.length} keys, you must specify an input key or pass only 1 key as input`)}return r},i8e=(t,e)=>{let r=xor(t,e);if(!r&&r!==""){let n=Object.keys(t);throw new Error(`output values have ${n.length} keys, you must specify an output key or pass only 1 key as output`)}return r}});var WZ=b(()=>{Sor()});var a8e,VH,Cor=b(()=>{_j();Aj();a8e=class extends vm{addUserMessage(e){return this.addMessage(new eu(e))}addAIChatMessage(e){return this.addMessage(new Ln(e))}addAIMessage(e){return this.addMessage(new Ln(e))}async addMessages(e){for(let r of e)await this.addMessage(r)}clear(){throw new Error("Not implemented.")}},VH=class extends a8e{constructor(e){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","stores","message","in_memory"]}),Object.defineProperty(this,"messages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.messages=e??[]}async getMessages(){return this.messages}async addMessage(e){this.messages.push(e)}async clear(){this.messages=[]}}});var Oor=b(()=>{Cor()});var s8e=b(()=>{Oor()});var X_,W1=b(()=>{WZ();s8e();X_=class extends HH{constructor(e){super(),Object.defineProperty(this,"chatHistory",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnMessages",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.chatHistory=e?.chatHistory??new VH,this.returnMessages=e?.returnMessages??this.returnMessages,this.inputKey=e?.inputKey??this.inputKey,this.outputKey=e?.outputKey??this.outputKey}async saveContext(e,r){await this.chatHistory.addUserMessage(dbe(e,this.inputKey)),await this.chatHistory.addAIChatMessage(i8e(r,this.outputKey))}async clear(){await this.chatHistory.clear()}}});var KZ,Eor=b(()=>{Bs();W1();KZ=class extends X_{constructor(e){super({chatHistory:e?.chatHistory,returnMessages:e?.returnMessages??!1,inputKey:e?.inputKey,outputKey:e?.outputKey}),Object.defineProperty(this,"humanPrefix",{enumerable:!0,configurable:!0,writable:!0,value:"Human"}),Object.defineProperty(this,"aiPrefix",{enumerable:!0,configurable:!0,writable:!0,value:"AI"}),Object.defineProperty(this,"memoryKey",{enumerable:!0,configurable:!0,writable:!0,value:"history"}),this.humanPrefix=e?.humanPrefix??this.humanPrefix,this.aiPrefix=e?.aiPrefix??this.aiPrefix,this.memoryKey=e?.memoryKey??this.memoryKey}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(e){let r=await this.chatHistory.getMessages();return this.returnMessages?{[this.memoryKey]:r}:{[this.memoryKey]:Tp(r,this.humanPrefix,this.aiPrefix)}}}});var Por=b(()=>{WZ();Bs()});var Tor=b(()=>{KA()});var Aor=b(()=>{Qf();Tor();Im();ag()});var Ior=b(()=>{$b()});var u8e=b(()=>{ag();tI();Im();Aor();Ior()});var fbe=b(()=>{tI()});var l8e=b(()=>{Bs();u8e();fbe();W1()});var GZ,Mor=b(()=>{Bs();W1();GZ=class extends X_{constructor(e){super({returnMessages:e?.returnMessages??!1,chatHistory:e?.chatHistory,inputKey:e?.inputKey,outputKey:e?.outputKey}),Object.defineProperty(this,"humanPrefix",{enumerable:!0,configurable:!0,writable:!0,value:"Human"}),Object.defineProperty(this,"aiPrefix",{enumerable:!0,configurable:!0,writable:!0,value:"AI"}),Object.defineProperty(this,"memoryKey",{enumerable:!0,configurable:!0,writable:!0,value:"history"}),Object.defineProperty(this,"k",{enumerable:!0,configurable:!0,writable:!0,value:5}),this.humanPrefix=e?.humanPrefix??this.humanPrefix,this.aiPrefix=e?.aiPrefix??this.aiPrefix,this.memoryKey=e?.memoryKey??this.memoryKey,this.k=e?.k??this.k}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(e){let r=await this.chatHistory.getMessages();return this.returnMessages?{[this.memoryKey]:r.slice(-this.k*2)}:{[this.memoryKey]:Tp(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}}});var Ror=b(()=>{hG();WZ();BSe()});var Nor=b(()=>{_j()});var jor=b(()=>{Nor()});var Dor=b(()=>{jor()});var Lor=b(()=>{WZ();Bs();Dor();u8e();fbe();W1()});var For=b(()=>{W1()});var kor=b(()=>{Bs();l8e()});var $or=b(()=>{Bs();W1()});var Bor=b(()=>{Eor();Por();l8e();Mor();W1();s8e();Ror();Lor();fbe();For();kor();$or()});var c8e=b(()=>{Bor()});var JZ,zor=b(()=>{_t();c8e();JZ=class t{constructor(){this.initMemory(),oa(()=>{let e=this.memory?.chatHistory;this.initMemory(e)})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initMemory(e){let r=ne().contextTurns;this.memory=new GZ({k:r*2,memoryKey:"history",inputKey:"input",returnMessages:!0,chatHistory:e}),this.debug&&console.log("Memory initialized with context turns:",r)}getMemory(){return this.memory}async clearChatMemory(){this.debug&&console.log("Clearing chat memory"),await this.memory.clear()}async loadMemoryVariables(){let e=await this.memory.loadMemoryVariables({});return this.debug&&console.log("Loaded memory variables:",e),e}async saveContext(e,r){this.debug&&console.log("Saving to memory - Input:",e,"Output:",r),await this.memory.saveContext(e,r)}}});var ZZ,Uor=b(()=>{_t();tI();la();ZZ=class t{constructor(){this.initChatPrompt(),this.initQAPrompt(),oa(()=>{this.initChatPrompt(),this.initQAPrompt()}),gz(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initChatPrompt(){let e=Rf(),r=Su();r&&Wj()&&(e=r.systemPrompt);let n=this.escapeTemplateString(e);this.chatPrompt=Am.fromMessages([eI.fromTemplate(n),new Rv("history"),Nv.fromTemplate("{input}")])}initQAPrompt(){let e=`{system_message}
Answer the question with as detailed as possible based only on the following context:
{context}
Question: {question}
`;this.qaPrompt=Am.fromMessages([eI.fromTemplate(e)])}escapeTemplateString(e){return e.replace(/\{/g,"{{").replace(/\}/g,"}}")}getChatPrompt(){return this.chatPrompt}async getQAPrompt({question:e,context:r,systemMessage:n}){return await this.qaPrompt.format({question:e,context:r,system_message:n})}}});var pbe,YZ,qor=b(()=>{la();xu();er();wor();$t();_t();kt();tI();pbe=require("obsidian");dye();zor();Uor();YZ=class{constructor(e){this.retrievedDocuments=[];this.app=e,this.memoryManager=JZ.getInstance(),this.chatModelManager=x1.getInstance(),this.promptManager=ZZ.getInstance(),this.initialize(),oa(async()=>{await this.createChainWithNewModel()})}getRetrievedDocuments(){return this.retrievedDocuments}async initialize(){await this.createChainWithNewModel()}getChain(){return this.chain}getRetrievalChain(){return this.retrievalChain}validateChainType(e){if(e==null)throw new Error("No chain type set")}validateChatModel(){if(!this.chatModelManager.validateChatModel(this.chatModelManager.getChatModel())){let e="Chat model is not initialized properly, check your API key in Copilot setting and make sure you have API access.";throw new pbe.Notice(e),new Error(e)}}validateChainInitialization(){(!this.chain||!Jet(this.chain))&&(console.error("Chain is not initialized properly, re-initializing chain: ",ry()),this.createChainWithNewModel({},!1))}storeRetrieverDocuments(e){this.retrievedDocuments=e}async createChainWithNewModel(e={},r=!0){let n=ry(),o=Su();if(n==="project"&&!o)return;let i=n==="project"?o?.projectModelKey:Vee();if(!i)throw new pbe.Notice("No model key found"),new Error("No model key found");try{if(r){let a=Iee(i,ne().activeModels);if(a||(console.error("Resetting default model. No model configuration found for: ",i),a=jv[0],i=a.name+"|"+a.provider),n==="project"&&!a.projectEnabled){let u=ne().activeModels.find(l=>l.enabled&&l.projectEnabled);if(u)a=u,i=u.name+"|"+u.provider,new pbe.Notice(`Model ${a.name} is not available in project mode. Switching to ${u.name}.`);else throw new Error("No project-enabled models available. Please enable a model for project mode in settings.")}let s={...a,...o?.modelConfigs};await this.chatModelManager.setChatModel(s)}this.setChain(n,e),B(`Setting model to ${i}`)}catch(a){ie(`createChainWithNewModel failed: ${a}`),B(`modelKey: ${i}`)}}async setChain(e,r={}){if(!this.chatModelManager.validateChatModel(this.chatModelManager.getChatModel())){console.error("setChain failed: No chat model set.");return}this.validateChainType(e);let n=this.chatModelManager.getChatModel(),o=this.memoryManager.getMemory(),i=this.promptManager.getChatPrompt();switch(e){case"llm_chain":{this.chain=C8.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Hj("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let a=ne(),s=a.enableSemanticSearchV3?new(await Promise.resolve().then(()=>(CG(),Zde))).HybridRetriever({minSimilarityScore:.01,maxK:a.maxSourceChunks,salientTerms:[]}):new(await Promise.resolve().then(()=>(g7(),fye))).TieredLexicalRetriever(app,{minSimilarityScore:.01,maxK:a.maxSourceChunks,salientTerms:[],timeRange:void 0,textWeight:void 0,returnAll:!1,useRerankerThreshold:void 0});this.retrievalChain=C8.createConversationalRetrievalChain({llm:n,retriever:s,systemMessage:Rf()},this.storeRetrieverDocuments.bind(this),ne().debug),Hj("vault_qa"),ne().debug&&(console.log("New Vault QA chain with hybrid retriever created for entire vault"),console.log("Set chain:","vault_qa"));break}case"copilot_plus":{await this.initializeQAChain(r),this.chain=C8.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Hj("copilot_plus");break}case"project":{await this.initializeQAChain(r),this.chain=C8.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Hj("project");break}default:this.validateChainType(e);break}}getChainRunner(){let e=ry(),r=ne();switch(e){case"llm_chain":return new xG(this);case"vault_qa":return new b7(this);case"copilot_plus":return r.enableAutonomousAgent?new VZ(this):new BO(this);case"project":return new UZ(this);default:throw new Error(`Unsupported chain type: ${e}`)}}async initializeQAChain(e){e.refreshIndex&&ne().enableSemanticSearchV3&&await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().indexVaultToVectorStore(!1)}async runChain(e,r,n,o,i={}){let{ignoreSystemMessage:a=!1}=i;B(`Step 0: Initial user message:
`,e),this.validateChatModel(),this.validateChainInitialization();let s=this.chatModelManager.getChatModel();if(a||S8(s)){let l=Am.fromMessages([new Rv("history"),Nv.fromTemplate("{input}")]);S8(s)&&(l=Am.fromMessages([[So,Rf()||""],l])),this.createChainWithNewModel({prompt:l},!1)}return await this.getChainRunner().run(e,r,n,o,i)}async updateMemoryWithLoadedMessages(e){await this.memoryManager.clearChatMemory();for(let r=0;r<e.length;r+=2){let n=e[r],o=e[r+1];n&&o&&n.sender===So&&await this.memoryManager.getMemory().saveContext({input:n.message},{output:o.message})}}}});var mbe,Hor=b(()=>{la();$t();_t();kt();bG();mbe=class t{constructor(e){this.app=e}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}clearAllLoadStates(){ktt({success:[],failed:[],processingFiles:[],total:[]})}async executeWithProcessTracking(e,r,n){this.setFileOrUrlStartProcess(e);try{let o=await n();return this.setFileOrUrlProcessSuccessful(e),o}catch(o){let i=GP(o)?"Rate limit exceeded. (Rate limit: 50 files or 100MB per 3 hours, whichever is reached first)":Fn(o);throw this.setFileOrUrlProcessFailed(e,r,i),o}}setFileOrUrlStartProcess(e){Gi.set(M8,r=>{let n={...r};return n.failed.find(o=>o.path===e)&&(n.failed=n.failed.filter(o=>o.path!==e)),n.success.includes(e)&&(n.success=n.success.filter(o=>o!==e)),n.processingFiles.includes(e)||(n.processingFiles=[...n.processingFiles,e]),n.total.includes(e)||(n.total=[...n.total,e]),n})}setFileOrUrlProcessSuccessful(e){$v("processingFiles",r=>r.filter(n=>n!==e)),$v("success",r=>r.includes(e)?r:[...r,e])}setFileOrUrlProcessFailed(e,r,n){$v("processingFiles",o=>o.filter(i=>i!==e)),$v("failed",o=>{if(!o.find(a=>a.path===e)){let a={path:e,type:r,error:n,timestamp:Date.now()};return[...o,a]}return o})}preComputeAllItems(e,r){B(`[preComputeAllItems] Starting pre-computation for project: ${e.name}`);let n=[];n.push(...r.map(a=>a.path));let o=e.contextSource?.webUrls?.trim()||"";if(o){let a=o.split(`
`).filter(s=>s.trim());n.push(...a)}let i=e.contextSource?.youtubeUrls?.trim()||"";if(i){let a=i.split(`
`).filter(s=>s.trim());n.push(...a)}if(n.length>0){let a=[...new Set([...n])];$v("total",s=>a),B(`[preComputeAllItems] Project ${e.name}: Added ${n.length} items to tracking (${a.length} total unique items)`)}}markAllCachedItemsAsSuccess(e,r,n){B(`[markAllCachedItemsAsSuccess] Starting for project: ${e.name||"default"}`);let o=e.contextSource?.webUrls?.trim()||"";if(o){let s=o.split(`
`).filter(u=>u.trim()).filter(u=>r.webContexts[u]);s.forEach(u=>{this.markCachedItemAsSuccess(u)}),s.length>0&&B(`[markAllCachedItemsAsSuccess] Project ${e.name}: Marked ${s.length} cached Web URLs as successful`)}let i=e.contextSource?.youtubeUrls?.trim()||"";if(i){let s=i.split(`
`).filter(u=>u.trim()).filter(u=>r.youtubeContexts[u]);s.forEach(u=>{this.markCachedItemAsSuccess(u)}),s.length>0&&B(`[markAllCachedItemsAsSuccess] Project ${e.name}: Marked ${s.length} cached YouTube URLs as successful`)}if(r.fileContexts){let a=new Set(n.filter(u=>u.extension==="md").map(u=>u.path)),s=Object.keys(r.fileContexts).filter(u=>a.has(u));s.forEach(u=>{this.markCachedItemAsSuccess(u)}),s.length>0&&B(`[markAllCachedItemsAsSuccess] Project ${e.name}: Marked ${s.length} cached files that match current project patterns as successful.`)}}markCachedItemAsSuccess(e){$v("total",r=>r.includes(e)?r:[...r,e]),$v("success",r=>r.includes(e)?r:[...r,e])}makeItemFailed(e,r,n){$v("total",o=>o.includes(e)?o:[...o,e]),$v("failed",o=>{if(!o.find(a=>a.path===e)){let a={path:e,type:r,error:n,timestamp:Date.now()};return[...o,a]}return o})}}});var a$,Wd,wR=b(()=>{la();yG();xu();er();$t();Ude();Yp();_t();Kde();kt();bG();a$=require("obsidian");jy();qor();Hor();Wd=class t{constructor(e,r){this.app=e,this.plugin=r,this.currentProjectId=null,this.chainMangerInstance=new YZ(e),this.projectContextCache=S_.getInstance(),this.fileParserManager=new vR(Zi.getInstance(),this.app.vault,!0,null),this.loadTracker=mbe.getInstance(this.app),Rtt(async()=>{await this.getCurrentChainManager().createChainWithNewModel()}),Ntt(async()=>{if(Wj())return;let n=ne(),o=n.enableSemanticSearchV3&&n.indexVaultToVectorStore==="ON MODE SWITCH"&&(ry()==="vault_qa"||ry()==="copilot_plus");await this.getCurrentChainManager().createChainWithNewModel({refreshIndex:o})}),gz(async n=>{await this.switchProject(n)}),this.setupProjectListChangeMonitor()}setupProjectListChangeMonitor(){oa(async(e,r)=>{if(!e||!r)return;let n=e.projectList||[],o=r.projectList||[];for(let i of o){let a=n.find(s=>s.id===i.id);a&&JSON.stringify(a)!==JSON.stringify(i)&&(await this.compareAndUpdateCache(a,i),this.currentProjectId===i.id&&await Promise.all([this.loadProjectContext(i,!0),this.getCurrentChainManager().createChainWithNewModel()]))}})}static getInstance(e,r){return t.instance||(t.instance=new t(e,r)),t.instance}getCurrentChainManager(){return this.chainMangerInstance}getCurrentProjectId(){return this.currentProjectId}async switchProject(e){try{if(this.loadTracker.clearAllLoadStates(),kv(!0),B("Project loading started..."),!e){await this.saveCurrentProjectMessage(),this.currentProjectId=null,await this.loadNextProjectMessage(),this.refreshChatView();return}let r=e.id;if(this.currentProjectId===r)return;await this.saveCurrentProjectMessage(),this.currentProjectId=r,await this.loadNextProjectMessage(),await this.getCurrentChainManager().createChainWithNewModel(),this.fileParserManager=new vR(Zi.getInstance(),this.app.vault,!0,e),await this.loadProjectContext(e),this.refreshChatView(),B(`Switched to project: ${e.name}`)}catch(r){throw ie(`Failed to switch project: ${r}`),r}finally{kv(!1)}}async saveCurrentProjectMessage(){await this.plugin.autosaveCurrentChat()}async loadNextProjectMessage(){await this.plugin.chatUIState.handleProjectSwitch()}async loadProjectContext(e,r=!1){r&&(this.loadTracker.clearAllLoadStates(),kv(!0));try{if(!e.contextSource)return Ft(`[loadProjectContext] Project ${e.name}: No contextSource. Aborting.`),null;B(`[loadProjectContext] Starting for project: ${e.name}`);let n=await this.projectContextCache.getOrInitializeCache(e),o=this.getProjectAllFiles(e);this.loadTracker.preComputeAllItems(e,o),this.loadTracker.markAllCachedItemsAsSuccess(e,n,o);let[i]=await Promise.all([this.processMarkdownFiles(e,n,o),this.processWebUrls(e,n),this.processYoutubeUrls(e,n)]);return i.timestamp=Date.now(),await this.projectContextCache.setCacheSafely(e,i),await this.processNonMarkdownFiles(e,o),B(`[loadProjectContext] Completed for project: ${e.name}.`),i}catch(n){throw ie(`[loadProjectContext] Failed for project ${e.name}:`,n),n}finally{r&&kv(!1)}}async compareAndUpdateCache(e,r){try{if(!await this.projectContextCache.get(e))return!0;let o=e.contextSource?.inclusions||"",i=r.contextSource?.inclusions||"",a=e.contextSource?.exclusions||"",s=r.contextSource?.exclusions||"";(o!==i||a!==s)&&(await this.projectContextCache.invalidateMarkdownContext(r),B(`Markdown configuration changed for project ${r.name}, marking for reload`));let u=e.contextSource?.webUrls||"",l=r.contextSource?.webUrls||"";if(u!==l){let f=u.split(`
`).filter(m=>m.trim()),p=l.split(`
`).filter(m=>m.trim());await this.projectContextCache.removeWebUrls(r,f.filter(m=>!p.includes(m)))}let c=e.contextSource?.youtubeUrls||"",d=r.contextSource?.youtubeUrls||"";if(c!==d){let f=c.split(`
`).filter(m=>m.trim()),p=d.split(`
`).filter(m=>m.trim());await this.projectContextCache.removeYoutubeUrls(r,f.filter(m=>!p.includes(m)))}}catch(n){ie(`Error comparing project configurations: ${n}`)}}refreshChatView(){let e=this.app.workspace.getLeavesOfType(js)[0]?.view;e&&e.updateView()}async getProjectContext(e){let r=ne().projectList.find(o=>o.id===e);if(!r)return Ft(`[getProjectContext] Project not found for ID: ${e}`),null;B(`[getProjectContext] Getting context for project: ${r.name} (ID: ${e})`);let n=this.projectContextCache.getSync(r);if(!n||n.markdownNeedsReload){n?B(`[getProjectContext] Project ${r.name}: Markdown needs reload. Triggering full load.`):B(`[getProjectContext] Project ${r.name}: Memory cache miss. Triggering full load.`);let o=await this.loadProjectContext(r,!0);if(!o)return ie(`[getProjectContext] Project ${r.name}: loadProjectContext returned null.`),null;n=o}else B(`[getProjectContext] Project ${r.name}: Memory cache hit and markdown OK. Using existing context.`);return this.formatProjectContextWithFiles(n,r)}async formatProjectContextWithFiles(e,r){let n=[];if(e.markdownContext&&n.push(`## Markdown Files
${e.markdownContext}`),Object.keys(e.webContexts).length>0&&n.push(`## Web Content
${Object.values(e.webContexts).join(`
`)}`),Object.keys(e.youtubeContexts).length>0&&n.push(`## YouTube Content
${Object.values(e.youtubeContexts).join(`
`)}`),Object.keys(e.fileContexts).length>0){let o=Object.entries(e.fileContexts).filter(([i])=>i.split(".").pop()?.toLowerCase()!=="md");if(o.length>0){let i=o.map(async([s,u])=>{let l=s.split("/"),c=l[l.length-1],d=c.split(".").pop()||"",f=await this.projectContextCache.getOrReuseFileContext(r,s)||"[Content not available]";return`[[${c}]]
path: ${s}
type: ${d}
modified: ${new Date(u.timestamp).toISOString()}
${f}`}),a=await Promise.all(i);a.length>0&&n.push(`## Other Files
${a.join(`
`)}`)}}return`
# Project Context
The following information is the relevant context for this project. Use this information to inform your responses when appropriate:
<ProjectContext>
${n.join(`
`)}
</ProjectContext>
`}formatProjectContext(e){let r=[];if(e.markdownContext&&r.push(`## Markdown Files
${e.markdownContext}`),Object.keys(e.webContexts).length>0&&r.push(`## Web Content
${Object.values(e.webContexts).join(`
`)}`),Object.keys(e.youtubeContexts).length>0&&r.push(`## YouTube Content
${Object.values(e.youtubeContexts).join(`
`)}`),Object.keys(e.fileContexts).length>0){let n="";for(let[o,i]of Object.entries(e.fileContexts)){let a=o.split("/"),s=a[a.length-1],u=s.split(".").pop()||"";n+=`[[${s}]]
path: ${o}
type: ${u}
modified: ${new Date(i.timestamp).toISOString()}
`}n&&r.push(`## Other Files
${n}`)}return`
# Project Context
The following information is the relevant context for this project. Use this information to inform your responses when appropriate:
<ProjectContext>
${r.join(`
`)}
</ProjectContext>
`}async processMarkdownFiles(e,r,n){if(B(`[processMarkdownFiles] Starting for project: ${e.name}`),r.markdownNeedsReload||!r.markdownContext||!r.markdownContext.trim()){B(`[processMarkdownFiles] Project ${e.name}: Processing markdown content.`);let o=await this.processMarkdownFileContext(n);this.projectContextCache.updateProjectMarkdownFilesFromPatterns(e,r,n),r.markdownContext=o,r.markdownNeedsReload=!1,B(`[processMarkdownFiles] Project ${e.name}: Markdown content updated.`)}else B(`[processMarkdownFiles] Project ${e.name}: Markdown content already up-to-date.`);return B(`[processMarkdownFiles] Completed for project: ${e.name}. Total fileContexts: ${Object.keys(r.fileContexts||{}).length}`),r}async processMarkdownFileContext(e){let r=e.filter(o=>o.extension==="md");B(`Found ${r.length} markdown files to process for project context`);let n=await Promise.all(r.map(async o=>{let i="",a="";try{let[s,u]=await this.loadTracker.executeWithProcessTracking(o.path,"md",async()=>Promise.all([this.app.vault.adapter.stat(o.path),this.app.vault.read(o)]));a=`[[${o.basename}]]
path: ${o.path}
type: ${o.extension}
created: ${s?new Date(s.ctime).toISOString():"unknown"}
modified: ${s?new Date(s.mtime).toISOString():"unknown"}`,i=u,B(`Completed processing markdown file: ${o.path}`)}catch(s){ie(`Error processing file ${o.path}: ${s}`),i=`[Error: ${Fn(s)}]`}return`${a}
${i}`}));return B("All markdown files processed for project context"),n.join(`
`)}async processWebUrls(e,r){B(`[processWebUrls] Starting for project: ${e.name}`);let n=e.contextSource?.webUrls?.trim()||"";if(!n)return Object.keys(r.webContexts).length>0&&(B(`[processWebUrls] Project ${e.name}: Clearing all Web contexts as none are configured.`),r.webContexts={}),r;let o=n.split(`
`).filter(c=>c.trim());B(`[processWebUrls] Project ${e.name}: Found ${o.length} URLs in config.`);let i=Object.keys(r.webContexts),a=o.filter(c=>!r.webContexts[c]);a.length>0&&B(`[processWebUrls] Project ${e.name}: Fetching content for ${a.length} new/updated Web URLs.`);let s=i.filter(c=>!o.includes(c));if(s.length>0){B(`[processWebUrls] Project ${e.name}: Removing ${s.length} obsolete Web URL contexts.`);for(let c of s)delete r.webContexts[c]}let u=a.map(async c=>{let d=await this.processWebUrlContext(c);return d&&B(`[processWebUrls] Project ${e.name}: Successfully fetched content for URL: ${c.substring(0,50)}...`),{url:c,context:d}});return(await Promise.all(u)).forEach(c=>{c&&c.context?r.webContexts[c.url]=c.context:c&&!c.context&&Ft(`[processWebUrls] Project ${e.name}: Fetched empty content for Web URL: ${c.url}`)}),B(`[processWebUrls] Completed for project: ${e.name}. Total Web contexts: ${Object.keys(r.webContexts).length}`),r}async processYoutubeUrls(e,r){B(`[processYoutubeUrls] Starting for project: ${e.name}`);let n=e.contextSource?.youtubeUrls?.trim()||"";if(!n)return Object.keys(r.youtubeContexts).length>0&&(B(`[processYoutubeUrls] Project ${e.name}: Clearing all YouTube contexts as none are configured.`),r.youtubeContexts={}),r;let o=n.split(`
`).filter(c=>c.trim());B(`[processYoutubeUrls] Project ${e.name}: Found ${o.length} YouTube URLs in config.`);let i=Object.keys(r.youtubeContexts),a=o.filter(c=>!r.youtubeContexts[c]);a.length>0&&B(`[processYoutubeUrls] Project ${e.name}: Fetching transcripts for ${a.length} new/updated YouTube URLs.`);let s=i.filter(c=>!o.includes(c));if(s.length>0){B(`[processYoutubeUrls] Project ${e.name}: Removing ${s.length} obsolete YouTube URL contexts.`);for(let c of s)delete r.youtubeContexts[c]}let u=a.map(async c=>{let d=await this.processYoutubeUrlContext(c);return d&&B(`[processYoutubeUrls] Project ${e.name}: Successfully fetched transcript for YouTube URL: ${c.substring(0,50)}...`),{url:c,context:d}});return(await Promise.all(u)).forEach(c=>{c&&c.context?r.youtubeContexts[c.url]=c.context:c&&!c.context&&Ft(`[processYoutubeUrls] Project ${e.name}: Fetched empty transcript for YouTube URL: ${c.url}`)}),B(`[processYoutubeUrls] Completed for project: ${e.name}. Total YouTube contexts: ${Object.keys(r.youtubeContexts).length}`),r}async processWebUrlContext(e){if(!e?.trim())return"";try{let r=_R.getInstance(),{urlContext:n}=await this.loadTracker.executeWithProcessTracking(e,"web",async()=>{let o=await r.processUrls(e);if(o.processedErrorUrls[e])throw new Error(o.processedErrorUrls[e]);return o});return n||""}catch(r){return ie(`Failed to process web URL: ${r}`),""}}async processYoutubeUrlContext(e){if(!e?.trim())return"";try{let r=await this.loadTracker.executeWithProcessTracking(e,"youtube",async()=>Zi.getInstance().youtube4llm(e));return r.response.transcript?`
YouTube transcript from ${e}:
${r.response.transcript}`:""}catch(r){return ie(`Failed to process YouTube URL ${e}: ${r}`),new a$.Notice(`Failed to process YouTube URL ${e}: ${Fn(r)}`),""}}async processNonMarkdownFiles(e,r){let n=r.filter(i=>i.extension!=="md");if(B(`[loadProjectContext] Project ${e.name}: Checking for non-markdown processing: ${n.length} files .`),n.length<=0)return;this.fileParserManager=new vR(Zi.getInstance(),this.app.vault,!0,e);let o=0;for(let i of n){let a=i.path;if(this.fileParserManager.supportsExtension(i.extension))try{await this.loadTracker.executeWithProcessTracking(a,"nonMd",async()=>{await this.projectContextCache.getOrReuseFileContext(e,a)||(B(`[loadProjectContext] Project ${e.name}: Parsing/caching new/updated file: ${a}`),await this.fileParserManager.parseFile(i,this.app.vault)),o++})}catch(s){if(ie(`[loadProjectContext] Project ${e.name}: Error parsing file ${a}:`,s),GP(s))throw s}}o>0&&B(`[loadProjectContext] Project ${e.name}: Processed and cached ${o} non-markdown files.`)}async retryFailedItem(e){try{if(!this.currentProjectId){Ft("[retryFailedItem] No current project, aborting retry");return}let r=ne().projectList.find(n=>n.id===this.currentProjectId);if(!r){ie(`[retryFailedItem] Current project not found: ${this.currentProjectId}`);return}switch(B(`[retryFailedItem] Starting retry for ${e.type} item: ${e.path}`),e.type){case"web":await this.retryWebUrl(r,e.path);break;case"youtube":await this.retryYoutubeUrl(r,e.path);break;case"md":await this.retryMarkdownFile(r,e.path);break;case"nonMd":await this.retryNonMarkdownFile(r,e.path);break;default:Ft(`[retryFailedItem] Unknown item type: ${e.type}`);return}B(`[retryFailedItem] Successfully retried ${e.type} item: ${e.path}`),new a$.Notice(`Retry successful: ${e.path}`)}catch(r){ie(`[retryFailedItem] Failed to retry ${e.type} item ${e.path}:`,r),new a$.Notice(`Retry failed: ${Fn(r)}`)}}async retryWebUrl(e,r){let n=await this.processWebUrlContext(r);if(!n){Ft(`[retryWebUrl] Project ${e.name}: Fetched empty content for Web URL: ${r}`);return}B(`[retryWebUrl] Project ${e.name}: Successfully fetched content for URL: ${r.substring(0,50)}...`),await this.projectContextCache.updateWebUrl(e,r,n)}async retryYoutubeUrl(e,r){let n=await this.processYoutubeUrlContext(r);if(!n){Ft(`[retryYoutubeUrl] Project ${e.name}: Fetched empty transcript for YouTube URL: ${r}`);return}B(`[retryYoutubeUrl] Project ${e.name}: Successfully fetched transcript for YouTube URL: ${r.substring(0,50)}...`),await this.projectContextCache.updateYoutubeUrl(e,r,n)}async retryMarkdownFile(e,r){let n=this.app.vault.getAbstractFileByPath(r);if(!(n instanceof a$.TFile)||n.extension!=="md")throw new Error(`File not found or not a markdown file: ${r}`);try{await this.loadTracker.executeWithProcessTracking(n.path,"md",async()=>{}),B(`[retryMarkdownFile] Successfully reprocessed markdown file: ${r}`),await this.projectContextCache.invalidateMarkdownContext(e)}catch(o){throw ie(`[retryMarkdownFile] Error processing file ${r}: ${o}`),o}}async retryNonMarkdownFile(e,r){let n=this.app.vault.getAbstractFileByPath(r);if(!(n instanceof a$.TFile)||n.extension==="md")throw new Error(`File not found or is a markdown file: ${r}`);if(!this.fileParserManager.supportsExtension(n.extension))throw new Error(`Unsupported file extension: ${n.extension}`);try{await this.loadTracker.executeWithProcessTracking(r,"nonMd",async()=>this.fileParserManager.parseFile(n,this.app.vault)),B(`[retryNonMarkdownFile] Successfully reprocessed non-markdown file: ${r}`)}catch(o){throw ie(`[retryNonMarkdownFile] Error processing file ${r}: ${o}`),o}}getProjectAllFiles(e){let{inclusions:r,exclusions:n}=mu({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0});return this.app.vault.getFiles().filter(o=>Ma(o,r,n,!0))}onunload(){this.projectContextCache.cleanup()}}});var Vor={};as(Vor,{AutocompleteCache:()=>XZ});var XZ,d8e=b(()=>{$t();XZ=class t{constructor(){this.cache=new Map,this.maxSize=200,this.ttlMs=10*60*1e3}static getInstance(){return t.instance||(t.instance=new t),t.instance}get(e){let r=this.cache.get(e);if(r){if(Date.now()-r.timestamp>this.ttlMs){this.cache.delete(e);return}return r.response}}set(e,r){if(this.cache.size>=this.maxSize){let n=this.cache.keys().next().value;this.cache.delete(n)}this.cache.set(e,{response:r,timestamp:Date.now()}),B(`[AutocompleteCache] Cached response for key: ${e.slice(0,50)}...`)}clear(){this.cache.clear(),B("[AutocompleteCache] Cleared autocomplete cache")}generateSentenceKey(e,r,n){let o={prefix:e.slice(-100),noteContext:r.slice(-200),relevantNotes:n.slice(0,100)};return`sentence:${JSON.stringify(o)}`}generateWordKey(e,r,n){let o={contextPrefix:e.slice(-50),contextSuffix:r.slice(0,50),words:n.slice(0,5)};return`word:${JSON.stringify(o)}`}getStats(){return{size:this.cache.size,maxSize:this.maxSize,ttlMs:this.ttlMs}}}});var Jlr=x((E8i,Glr)=>{"use strict";var BVn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Glr.exports=BVn});var Qlr=x((P8i,Xlr)=>{"use strict";var zVn=Jlr();function Zlr(){}function Ylr(){}Ylr.resetWarningCache=Zlr;Xlr.exports=function(){function t(n,o,i,a,s,u){if(u!==zVn){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}t.isRequired=t;function e(){return t}var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Ylr,resetWarningCache:Zlr};return r.PropTypes=r,r}});var tcr=x((I8i,ecr)=>{ecr.exports=Qlr()();var T8i,A8i});var scr=x(cWe=>{"use strict";cWe.__esModule=!0;cWe.default=function(t,e){if(t&&e){var r=Array.isArray(e)?e:e.split(",");if(r.length===0)return!0;var n=t.name||"",o=(t.type||"").toLowerCase(),i=o.replace(/\/.*$/,"");return r.some(function(a){var s=a.trim().toLowerCase();return s.charAt(0)==="."?n.toLowerCase().endsWith(s):s.endsWith("/*")?i===s.replace(/\/.*$/,""):o===s})}return!0}});var RJn={};as(RJn,{default:()=>pwe});module.exports=jc(RJn);jy();wR();la();er();$t();_t();d8e();er();jy();$t();_t();var cb=require("@codemirror/view"),aA=require("@codemirror/state");function Wor(t,e,r=void 0){let n={force:()=>{}},o=null;async function*i(...a){o&&clearTimeout(o);let s=null;try{await new Promise(u=>{s=o=setTimeout(()=>u(),e),n.force=()=>{o&&clearTimeout(o),u()}})}catch{if(r!==void 0)throw r}for await(let u of t(...a)){if(s!==o)break;yield u}}return{debounced:i,force:()=>n.force()}}var Xqn=Object.defineProperty,Qqn=(t,e,r)=>e in t?Xqn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,WH=(t,e,r)=>(Qqn(t,typeof e!="symbol"?e+"":e,r),r),hbe=aA.StateField.define({create(){return{suggestion:null}},update(t,e){let r=e.effects.find(n=>n.is(g8e));return e.state.doc&&r&&(r.value.doc==null||e.state.doc==r.value.doc)?{suggestion:r.value.suggestion}:{suggestion:null}}}),g8e=aA.StateEffect.define();function e2n(t,e){let r=t.state.selection.main.head,n=[],o=cb.Decoration.widget({widget:new f8e(e),side:1});return n.push(o.range(r)),cb.Decoration.set(n)}var f8e=class extends cb.WidgetType{constructor(e){super(),WH(this,"suggestion"),this.suggestion=e}toDOM(){let e=document.createElement("span");return e.style.opacity="0.4",e.className="cm-inline-suggestion",e.textContent=this.suggestion,e}},p8e=t=>{let e=0;return cb.ViewPlugin.fromClass(class{async update(r){let n=r.state.doc;if(!r.docChanged)return;let o=++e;for await(let i of t(r.state)){if(o!=e)return;r.view.dispatch({effects:g8e.of({suggestion:i,doc:n})})}}})},m8e=class{constructor(){WH(this,"decorations"),this.decorations=cb.Decoration.none}update(e){var r;let n=(r=e.state.field(hbe))==null?void 0:r.suggestion;if(!n){this.decorations=cb.Decoration.none;return}this.decorations=e2n(e.view,n.display_suggestion)}},Kor=cb.ViewPlugin.fromClass(m8e,{decorations:t=>t.decorations}),h8e=class{constructor(e,r){WH(this,"suggestFn"),WH(this,"keymap"),WH(this,"completionId"),WH(this,"run",n=>{var o,i;let a=(o=n.state.field(hbe))==null?void 0:o.suggestion;return a?(n.dispatch({...t2n(n.state,a.complete_suggestion,n.state.selection.main.head,n.state.selection.main.head)}),(i=a.accept_hook)==null||i.call(a),(async()=>{if(this.suggestFn==null)return;let s=++this.completionId;for await(let u of this.suggestFn(n.state)){if(s!=this.completionId)return;n.dispatch({effects:g8e.of({suggestion:{complete_suggestion:u.complete_suggestion,display_suggestion:u.display_suggestion,accept_hook:u.accept_hook},doc:null})})}})(),!0):!1}),this.suggestFn=e,this.keymap=aA.Prec.highest(cb.keymap.of([{key:r,run:n=>this.run(n)}])),this.completionId=0}};function t2n(t,e,r,n){return{...t.changeByRange(o=>{if(o==t.selection.main)return{changes:{from:r,to:n,insert:e},range:aA.EditorSelection.cursor(r+e.length)};let i=n-r;return!o.empty||i&&t.sliceDoc(o.from-i,o.from)!=t.sliceDoc(r,n)?{range:o}:{changes:{from:o.from-i,to:o.from,insert:e},range:aA.EditorSelection.cursor(o.from-i+e.length)}}),userEvent:"input.complete"}}function Gor(t){return typeof t=="string"?{complete_suggestion:t,display_suggestion:t}:t}function r2n(t){return async function*(e){let r=await t(e);if(typeof r=="string"||"complete_suggestion"in r){yield Gor(r);return}for await(let n of r)yield Gor(n)}}function gbe(t){let{delay:e=500,accept_shortcut:r="Tab"}=t,n=r2n(t.fetchFn),{debounced:o,force:i}=Wor(n,e);return{extension:r?[hbe,p8e(o),Kor,new h8e(t.continue_suggesting?n:null,r).keymap]:[hbe,p8e(o),Kor],force_fetch:i}}var w8e=require("obsidian");var y8e=class{process(e){let{prefix:r,suffix:n}=e,{completion:o}=e;return o=this.removeWordOverlapPrefix(r,o),o=this.removeWordOverlapSuffix(o,n),o=this.removeCharacterOverlapPrefix(r,o),o=this.removeCharacterOverlapSuffix(o,n),o.startsWith(" ")&&this.endsWithMarker(r)&&(o=o.trimStart()),o}removeWordOverlapPrefix(e,r){let n=r.trimStart(),o=this.getPotentialPrefixSegments(e);for(let i of o)if(n.startsWith(i))return n.substring(i.length);return r}removeWordOverlapSuffix(e,r){let n=r.trimStart(),o=this.getPotentialCompletionSegments(e);for(let i of o)if(n.startsWith(i)&&e.endsWith(i))return e.substring(0,e.length-i.length);return e}removeCharacterOverlapPrefix(e,r){let n=e.length-1,o=0,i=0;for(;o<r.length&&n>=0&&r[o]===e[n]&&this.isWhiteSpaceOrCommonMarker(r[o]);)i++,n--,o++;return i>0?r.substring(i):r}removeCharacterOverlapSuffix(e,r){let n=0,o=e.length-1,i=0;for(;n<r.length&&o>=0&&e[o]===r[n]&&this.isWhiteSpaceOrCommonMarker(e[o]);)i++,n++,o--;return i>0?e.substring(0,e.length-i):e}getPotentialPrefixSegments(e){let r=[],n=this.startLocationOfEachWordOrMarker(e);for(let o=n.length-1;o>=0;o--)r.push(e.substring(n[o]));return e.length>0&&(r.length===0||r[r.length-1]!==e)&&r.push(e),e.length>1&&(r.length===0||r[r.length-1]!==e.slice(-1))&&r.push(e.slice(-1)),e.length>2&&(r.length===0||r[r.length-1]!==e.slice(-2))&&r.push(e.slice(-2)),[...new Set(r)].sort((o,i)=>i.length-o.length)}getPotentialCompletionSegments(e){let r=[],n=this.startLocationOfEachWordOrMarker(e);for(let o=0;o<n.length;o++)for(let i=o;i<n.length;i++){let a=i+1<n.length?n[i+1]:e.length;r.push(e.substring(n[o],a))}return e.length>0&&(r.length===0||r[r.length-1]!==e)&&r.push(e),[...new Set(r)].sort((o,i)=>i.length-o.length)}startLocationOfEachWordOrMarker(e){let r=[];if(e.length===0)return r;this.isWhiteSpaceChar(e[0])||r.push(0);for(let n=1;n<e.length;n++){let o=this.isWhiteSpaceChar(e[n-1]),i=this.isWhiteSpaceChar(e[n]),a=this.isCommonMarker(e[n-1]),s=this.isCommonMarker(e[n]);o&&!i||a&&!s&&!i?r.push(n):(!a&&s||o&&s)&&(r.includes(n)||r.push(n))}return r}isWhiteSpaceChar(e){return e!==void 0&&/\s/.test(e)}isCommonMarker(e){return e!==void 0&&/[-*>#$]/.test(e)}isWhiteSpaceOrCommonMarker(e){return this.isWhiteSpaceChar(e)||this.isCommonMarker(e)}endsWithMarker(e){if(e.length===0)return!1;if(this.isCommonMarker(e[e.length-1]))return!0;let r=e.length>=2?e.slice(-2):"",n=e.length>=3?e.slice(-3):"";return!!(r==="##"||r.match(/^#{1,6} $/)||r==="--"||n==="-->"||e.includes("## Heading"))}},b8e=class{process(e){let{prefix:r,suffix:n,completion:o,context:i}=e,a=o;return r.endsWith(" ")&&a.startsWith(" ")&&(a=a.trimStart()),n.startsWith(" ")&&a.endsWith(" ")&&(a=a.trimEnd()),(i==="UnorderedList"||i==="NumberedList"||i==="TaskList")&&r.endsWith(`
`)&&a.startsWith(`
`)&&(a=a.substring(1)),a}},_8e=class{process(e){let{completion:r,context:n}=e;if(n==="CodeBlock"){let o=r;return o=o.replace(/```[a-zA-Z]*[ \t]*\n?/g,""),o=o.replace(/\n?```[ \t]*\n?/g,""),o.endsWith(`
`)&&(o=o.slice(0,-1)),o}return r}},ybe=class{constructor(){this.processors=[];this.processors.push(new _8e),this.processors.push(new y8e),this.processors.push(new b8e)}process(e,r,n,o){let a={prefix:e,suffix:r,completion:n,context:o};for(let s of this.processors)a.completion=s.process(a);return a.completion}};O8();var Jor=require("obsidian");function Zor(t,e=20){let r=app.metadataCache.getFileCache(t),n=[];if(r?.links)for(let o of r.links){let i=app.metadataCache.getFirstLinkpathDest(o.link,t.path);if(i&&(n.push(i),n.length>=e))break}if(r?.embeds&&n.length<e)for(let o of r.embeds){let i=app.metadataCache.getFirstLinkpathDest(o.link,t.path);if(i&&(n.push(i),n.length>=e))break}return[...new Set(n)]}function Yor(t,e=20){let r=[],n=app.metadataCache.getBacklinksForFile(t);if(n?.data)for(let[o]of n.data){let i=app.vault.getAbstractFileByPath(o);if(i instanceof Jor.TFile&&(r.push(i),r.length>=e))break}return r}Lde();_t();var v8e=require("obsidian"),n2n=.4,o2n=20,Xor=.7,bbe=.3;async function i2n(t,e){let r=ne().debug,n=await WP.getDocsByPath(e,t);if(!n)return r&&console.log("No hits found for note:",t),[];let o=[];for(let i of n){if(!i?.document?.embedding){r&&console.log("No embedding found for note:",t);continue}o.push(i.document.embedding)}return o}function a2n(t){if(t.length===0)return[];let e=t[0].length,r=Array(e).fill(0);for(let n of t)for(let o=0;o<e;o++)r[o]+=n[o];for(let n=0;n<e;n++)r[n]/=t.length;return r}function s2n(t,e){let r=new Map;for(let n of t){let o=r.get(n.document.path);o?n.score>o&&r.set(n.document.path,n.score):r.set(n.document.path,n.score)}return r.delete(e),r}async function u2n({db:t,filePath:e}){let r=ne().debug,n=await i2n(e,t),o=a2n(n);if(o.length===0)return r&&console.log("No embeddings found for note:",e),new Map;let i=await WP.getDocsByEmbedding(t,o,{limit:o2n,similarity:n2n});return s2n(i,e)}function l2n(t){let e=new Map,n=Zor(t).map(a=>a.path);for(let a of n)e.set(a,{links:!0,backlinks:!1});let i=Yor(t).map(a=>a.path);for(let a of i)e.has(a)?e.set(a,{links:!0,backlinks:!0}):e.set(a,{links:!1,backlinks:!0});return e}function c2n(t,e){let r=new Map,n=Xor+bbe;for(let[o,i]of t)r.set(o,i*Xor/n);for(let[o,i]of e){let a=0;i.links&&i.backlinks?a=bbe:(i.links||i.backlinks)&&(a=bbe*.8),r.set(o,(r.get(o)??0)+a)}return r}async function vbe({db:t,filePath:e}){let r=app.vault.getAbstractFileByPath(e);if(!(r instanceof v8e.TFile))return[];let n=await u2n({db:t,filePath:e}),o=l2n(r),i=c2n(n,o);return Array.from(i.entries()).sort((s,u)=>{let l=s[0],c=u[0],d=_be(n.get(l)??0),f=_be(n.get(c)??0);return d!==f?f-d:u[1]-s[1]}).map(([s,u])=>{let l=app.vault.getAbstractFileByPath(s);return!(l instanceof v8e.TFile)||l.extension!=="md"?null:{document:{path:s,title:l.basename},metadata:{score:u,similarityScore:n.get(s),hasOutgoingLinks:o.get(s)?.links??!1,hasBacklinks:o.get(s)?.backlinks??!1}}}).filter(s=>s!==null)}function _be(t){return t>.7?3:t>.55?2:1}var Qor=require("obsidian"),d2n={cjk:[[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983]],japanese:[[12352,12447],[12448,12543]],korean:[[44032,55215],[4352,4607]],other:[[3584,3711],[1536,1791],[2304,2431],[2432,2559],[2688,2815],[2944,3071]]};function f2n(t,e){let r=t.codePointAt(0);return r?e.some(([n,o])=>r>=n&&r<=o):!1}function eir(t){let e=t.replace(/[\p{Emoji}\p{Symbol}\p{Punctuation}]/gu,"");if(!e)return!1;for(let r of e)if(Object.values(d2n).some(n=>f2n(r,n)))return!0;return!1}function tir(t,e){let r="",n="",o=Math.max(0,e.line-5);for(let u=o;u<e.line;u++)r+=t.getLine(u)+`
`;let i=t.getLine(e.line);r+=i.slice(0,e.ch),(e.ch===0||e.ch===i.length&&i.trim()==="")&&(r+=`
`);let a=Math.max(0,e.line-50);for(let u=a;u<e.line;u++)n+=t.getLine(u)+`
`;n+=i.slice(0,e.ch)+"{{CURSOR}}"+i.slice(e.ch)+`
`;let s=Math.min(t.lineCount()-1,e.line+50);for(let u=e.line+1;u<=s;u++)n+=t.getLine(u)+`
`;return{prefix:r,noteContext:n}}var K1=class K1{constructor(){this.currentNotePath=null;this.cachedNotes=null;this.cachedNoteTitles=[]}static getInstance(){return K1.instance||(K1.instance=new K1),K1.instance}getRelevantNoteTitles(){return this.cachedNoteTitles}async getRelevantNotes(e){if(!e)return this.currentNotePath=null,this.cachedNotes=null,this.cachedNoteTitles=[],"";if(this.currentNotePath===e.path&&this.cachedNotes!==null)return this.cachedNotes;let r=[];try{let a=await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().getDb();a&&(r=await vbe({db:a,filePath:e.path}))}catch(i){console.warn("Failed to fetch relevant notes for autocomplete:",i)}let n=r.slice(0,K1.MAX_RELEVANT_NOTES);this.cachedNoteTitles=n.map(i=>i.document.title);let o=await Promise.all(n.map(async i=>{let a=app.vault.getAbstractFileByPath(i.document.path);if(!(a instanceof Qor.TFile))return"";let s=await app.vault.cachedRead(a);if(!s)return"";let u=s.length>3e3?s.slice(0,3e3)+"...":s;return`[[${i.document.title}]]:
${u}`}));return this.currentNotePath=e.path,this.cachedNotes=o.join(`
`),this.cachedNotes}clearCache(){this.currentNotePath=null,this.cachedNotes=null,this.cachedNoteTitles=[]}};K1.MAX_RELEVANT_NOTES=3;var wbe=K1;var s$=class{constructor(){this.MIN_WORD_LENGTH=4;this.STOP_WORDS=new Set(["a","ain","all","am","an","and","any","are","as","at","be","but","by","can","d","did","do","don","few","for","had","has","he","her","him","his","how","i","if","in","is","isn","it","its","ll","m","ma","me","my","no","nor","not","now","o","of","off","on","or","our","out","own","re","s","she","so","t","the","to","too","up","ve","was","we","who","why","won","y","you"])}extractWords(e){return(this.preprocessText(e).match(/\b[a-zA-Z]+(?:'[a-zA-Z]+)?\b/g)||[]).filter(o=>this.isValidWord(o))}isWordCharacter(e){return/[a-zA-Z']/.test(e)}isValidWord(e){return!(e.length<this.MIN_WORD_LENGTH||!/^[a-zA-Z]+(?:'[a-zA-Z]+)?$/.test(e)||this.STOP_WORDS.has(e.toLowerCase())||e===e.toUpperCase()&&e.length>4)}getLanguage(){return"en"}preprocessText(e){return e.replace(/```[\s\S]*?```/g," ").replace(/`[^`]+`/g," ").replace(/\[\[([^\]]+)\]\]/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/<[^>]+>/g," ").replace(/^#+\s+/gm,"").replace(/[*_]{1,2}([^*_]+)[*_]{1,2}/g,"$1").replace(/^\s*[-*+]\s+/gm,"").replace(/^\s*\d+\.\s+/gm,"").replace(/\s+/g," ").trim()}};var QZ=class{constructor(e=5e4){this.wordCount=0;this.root=this.createNode(),this.maxSize=e}createNode(){return{children:new Map,isEndOfWord:!1,wordEntry:void 0}}addWord(e,r){if(!e||e.length<4||this.wordCount>=this.maxSize&&!this.hasWord(e))return;let n=this.root;for(let o of e)n.children.has(o)||n.children.set(o,this.createNode()),n=n.children.get(o);n.isEndOfWord?n.wordEntry&&(n.wordEntry.frequency++,n.wordEntry.lastSeen=Date.now(),r&&!n.wordEntry.contexts.includes(r)&&(n.wordEntry.contexts.push(r),n.wordEntry.contexts.length>10&&(n.wordEntry.contexts=n.wordEntry.contexts.slice(-10)))):(n.isEndOfWord=!0,n.wordEntry={word:e,frequency:1,contexts:r?[r]:[],lastSeen:Date.now()},this.wordCount++)}hasWord(e){let r=this.findNode(e);return r!==null&&r.isEndOfWord}getWordEntry(e){let r=this.findNode(e);return r&&r.isEndOfWord&&r.wordEntry?r.wordEntry:null}findNode(e){let r=this.root;for(let n of e){if(!r.children.has(n))return null;r=r.children.get(n)}return r}getSuggestions(e,r=10){if(!e)return[];let n=[],o=this.generatePrefixVariants(e);for(let a of o){let s=this.findNode(a);if(s&&(this.collectWords(s,a,n,r,e),n.length>=r))break}let i=this.deduplicateSuggestions(n);return i.sort((a,s)=>s.score-a.score),i.slice(0,r)}generatePrefixVariants(e){let r=new Set;return r.add(e),r.add(e.toLowerCase()),e.length>0&&r.add(e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()),r.add(e.toUpperCase()),Array.from(r)}deduplicateSuggestions(e){let r=new Map;for(let n of e){let o=n.word,i=r.get(o);(!i||n.score>i.score)&&r.set(o,n)}return Array.from(r.values())}collectWords(e,r,n,o,i){if(!(n.length>=o)){if(e.isEndOfWord&&e.wordEntry){let a=this.calculateScore(e.wordEntry)+this.getCaseMatchBonus(r,i);n.push({word:r,score:a,source:"vault"})}for(let[a,s]of e.children)this.collectWords(s,r+a,n,o,i)}}getCaseMatchBonus(e,r){if(e.length<r.length)return 0;let n=e.substring(0,r.length);return n===r?2:this.hasSameCasePattern(n,r)?1.5:1}hasSameCasePattern(e,r){if(e.length<r.length)return!1;for(let n=0;n<r.length;n++){let o=e[n],i=r[n],a=o===o.toUpperCase(),s=i===i.toUpperCase();if(a!==s)return!1}return!0}calculateScore(e){let r=Math.log(e.frequency+1)*10,n=Math.max(0,(Date.now()-e.lastSeen)/(1e3*60*60*24)),o=Math.max(0,10-n);return r+o}getStats(){let e=0,r=0,n=(o,i=0)=>{e++,r=Math.max(r,i);for(let a of o.children.values())n(a,i+1)};return n(this.root),{wordCount:this.wordCount,nodeCount:e,maxDepth:r}}clear(){this.root=this.createNode(),this.wordCount=0}getAllWords(){let e=[],r=n=>{n.isEndOfWord&&n.wordEntry&&e.push(n.wordEntry);for(let o of n.children.values())r(o)};return r(this.root),e}addWords(e,r){for(let n of e)this.addWord(n,r)}pruneByFrequency(e=2){let r=0,n=o=>{let i=[];for(let[a,s]of o.children)n(s)&&i.push(a);for(let a of i)o.children.delete(a);return o.isEndOfWord&&o.wordEntry&&o.wordEntry.frequency<e&&(o.isEndOfWord=!1,o.wordEntry=void 0,this.wordCount--,r++),o.children.size===0&&!o.isEndOfWord};return n(this.root),r}};$t();var rir=require("obsidian");var eY=class{constructor(e,r,n,o){this.isScanning=!1;this.vault=e,this.settings=r,this.performance=n,this.tokenizer=o||new s$}async scanVault(e){let r=Date.now(),n=[],o=new Map;try{let i=this.vault.getMarkdownFiles(),a=0;for(let l of i)try{e&&e({currentFile:l.path,processedFiles:a,totalFiles:i.length,foundWords:o.size});try{let d=await this.vault.adapter.stat(l.path);if(d&&d.size>this.performance.maxFileSize){n.push(`Skipped large file: ${l.path}`);continue}}catch{}let c=await this.vault.read(l);await this.processFile(l.path,c,o),a++,a%this.performance.batchSize===0&&await new Promise(d=>setTimeout(d,1))}catch(c){let d=`Error processing file ${l.path}: ${c}`;ie(d),n.push(d)}(this.settings.includeFileNames||this.settings.includeFolderNames)&&this.processFileAndFolderNames(o);let s=Date.now()-r;return{wordCount:o.size,fileCount:a,errors:n,scanTimeMs:s,wordMap:o}}catch(i){throw ie("[Word Completion] Vault scan failed:",i),i}}async scanFile(e){if(e.stat.size>this.performance.maxFileSize)return[];if(e.extension!=="md")return[];try{let r=await this.vault.read(e);return this.extractWordsFromText(r)}catch(r){return ie(`[Word Completion] Error reading file ${e.path}:`,r),[]}}extractWordsFromText(e){return!e||e.trim().length===0?[]:this.tokenizer.extractWords(e).filter(n=>{if(n.length<this.settings.minWordLength)return!1;for(let o of this.settings.excludePatterns)try{if(new RegExp(o,"i").test(n))return!1}catch(i){ie(`[Word Completion] Invalid exclude pattern: ${o}`,i)}return!0})}extractPathWords(){let e=new Set,r=n=>{let o=n.split("/").filter(Boolean);for(let i of o)i.replace(/\.[^.]+$/,"").split(/[^a-zA-Z]+/).filter(u=>u.length>=this.settings.minWordLength).filter(u=>this.tokenizer.isValidWord(u)).forEach(u=>e.add(u.toLowerCase()))};if(this.settings.includeFileNames&&this.vault.getMarkdownFiles().forEach(n=>{r(n.path)}),this.settings.includeFolderNames){let n=o=>{r(o.path),o.children.forEach(i=>{i instanceof rir.TFolder&&n(i)})};n(this.vault.getRoot())}return Array.from(e)}getFilesToScan(){return this.vault.getMarkdownFiles().filter(e=>!(e.stat.size>this.performance.maxFileSize))}isScanningScanVault(){return this.isScanning}getEstimatedScanTime(){let r=this.getFilesToScan().reduce((o,i)=>o+i.stat.size,0);return Math.max(1,r/(1024*1024))*1e3}setTokenizer(e){this.tokenizer=e}updateSettings(e){this.settings=e}updatePerformance(e){this.performance=e}async processFile(e,r,n){let o=this.extractWordsFromText(r);for(let i of o){n.has(i)||n.set(i,{frequency:0,contexts:new Set});let a=n.get(i);a.frequency++,a.contexts.add(e)}}processFileAndFolderNames(e){let r=this.extractPathWords();for(let n of r)e.has(n)||e.set(n,{frequency:0,contexts:new Set}),e.get(n).frequency++,e.get(n).contexts.add("filename")}};$t();var Q_=class Q_{constructor(e){this.isInitialized=!1;this.lastScanTime=0;this.vault=e,this.settings={...Q_.DEFAULT_SETTINGS},this.performance={...Q_.DEFAULT_PERFORMANCE},this.tokenizer=new s$,this.trie=new QZ(this.performance.maxTrieSize),this.scanner=new eY(this.vault,this.settings,this.performance,this.tokenizer)}static getInstance(e){return Q_.instance||(Q_.instance=new Q_(e)),Q_.instance}async initialize(e){if(this.isInitialized)return{wordCount:this.trie.getStats().wordCount,fileCount:0,errors:[],scanTimeMs:0};try{await new Promise(o=>setTimeout(o,100)),this.vault.getAllLoadedFiles().length===0&&await new Promise(o=>setTimeout(o,500));let n=await this.scanner.scanVault(e);return await this.populateTrieFromScanResult(n),this.isInitialized=!0,this.lastScanTime=Date.now(),n}catch(r){throw ie("[Word Completion] Initialization failed:",r),r}}getSuggestions(e){if(!this.isInitialized||!this.settings.enabled)return[];if(!e||e.length<this.settings.minPrefixLength)return[];if(!this.tokenizer.isWordCharacter(e[e.length-1]))return[];try{let r=this.settings.caseSensitive?e:e.toLowerCase();return this.trie.getSuggestions(r,this.settings.maxSuggestions).filter(i=>i.word.toLowerCase()!==e.toLowerCase())}catch(r){return ie("[Word Completion] Error getting suggestions:",r),[]}}shouldTriggerCompletion(e,r){if(!this.isInitialized||!this.settings.enabled)return!1;let n=e.substring(0,r),o=this.getCurrentWord(n);if(!o||o.length<this.settings.minPrefixLength)return!1;if(r>0){let s=e[r-1];if(/\s/.test(s))return!1}return this.getSuggestions(o).length>0}getCurrentWord(e){let r=e.length;for(let n=e.length-1;n>=0;n--){let o=e[n];if(!this.tokenizer.isWordCharacter(o)){r=n+1;break}n===0&&(r=0)}return e.substring(r).trim()}addWord(e,r){if(!(!this.isInitialized||!e||e.length<this.settings.minWordLength)&&this.tokenizer.isValidWord(e)){let n=this.settings.caseSensitive?e:e.toLowerCase();this.trie.addWord(n,r)}}getStats(){return{isInitialized:this.isInitialized,trieStats:this.trie.getStats(),lastScanTime:this.lastScanTime,settings:{...this.settings}}}updateSettings(e){this.settings={...this.settings,...e},this.scanner.updateSettings(this.settings)}updatePerformance(e){this.performance={...this.performance,...e},this.scanner.updatePerformance(this.performance)}reset(){this.trie.clear(),this.isInitialized=!1,this.lastScanTime=0}async rescan(e){return this.reset(),await this.initialize(e)}needsRescan(){return!1}getTokenizer(){return this.tokenizer}setTokenizer(e){this.tokenizer=e,this.scanner.setTokenizer(e)}async populateTrieFromScanResult(e){let r=e.wordMap;if(r)for(let[n,o]of r){let i=this.settings.caseSensitive?n:n.toLowerCase();for(let a=0;a<o.frequency;a++)this.trie.addWord(i,Array.from(o.contexts)[0]||"vault")}}destroy(){this.reset(),Q_.instance=null}};Q_.DEFAULT_SETTINGS={enabled:!0,minPrefixLength:2,maxSuggestions:20,includeVaultWords:!0,includeFileNames:!0,includeFolderNames:!0,caseSensitive:!1,minWordLength:4,excludePatterns:[]},Q_.DEFAULT_PERFORMANCE={maxTrieSize:5e4,maxFileSize:1024*1024,batchSize:100};var u$=Q_;$t();var p2n=require("obsidian");var xbe=class t{constructor(e){this.options=e;this.isActive=!1;this.activeRequests=new Map;this.lastRequestTime=0;this.minRequestInterval=100;this.lastCursorPosition=null;this.cacheEnabled=!0;this.handleSettingsChange=(e,r)=>{if(e.autocompleteAcceptKey!==r.autocompleteAcceptKey){let n=this.validateAcceptKey(r.autocompleteAcceptKey);this.acceptKey=n,this.setupGlobalKeyHandler()}e.enableWordCompletion!==r.enableWordCompletion&&(r.enableWordCompletion&&this.initializeWordCompletion(),this.recreateExtension())};this.cache=XZ.getInstance(),this.client=Zi.getInstance(),this.postProcessor=new ybe,this.wordCompletionManager=u$.getInstance(app.vault);let r=ne().autocompleteAcceptKey||Xg.KEYBIND;this.acceptKey=this.validateAcceptKey(r),this.recreateExtension(),this.setupGlobalKeyHandler(),this.unsubscribeFromSettings=oa(this.handleSettingsChange),this.initializeWordCompletion()}validateAcceptKey(e){return["Tab","Space","ArrowRight"].includes(e)?e:"Tab"}async initializeWordCompletion(){if(ne().enableWordCompletion)try{await this.wordCompletionManager.initialize()}catch(r){ie("[Copilot Autocomplete] Failed to initialize word completion:",r)}}recreateExtension(){let{extension:e,force_fetch:r}=gbe({fetchFn:()=>this.handleUnifiedCompletion(),delay:this.options.delay,continue_suggesting:!1,accept_shortcut:null});this.extension=e,this.forceFetch=r,this.updateActiveEditors()}setupGlobalKeyHandler(){this.globalKeyListener&&document.removeEventListener("keydown",this.globalKeyListener,!0),this.globalKeyListener=e=>{if(!this.isActive)return;let r={Tab:["Tab"],Space:[" ","Space"],ArrowRight:["ArrowRight","Right"]},n=app.workspace.getActiveViewOfType(w8e.MarkdownView);if(!n?.editor)return;let o=n.editor.cm;if(!o)return;let i=this.hasActiveCompletion(o),a;for(let[s,u]of Object.entries(r))if(u.includes(e.key)){a=s;break}if(a===this.acceptKey&&i){let u=o.dom.querySelector(".cm-inline-suggestion")?.textContent||"";if(u){e.preventDefault(),e.stopPropagation();let l=o.state.selection.main.head,c=a==="Space"?" ":"";o.dispatch({changes:[{from:l,to:l,insert:u+c}],selection:{anchor:l+u.length+c.length}}),this.forceFetch();return}}if(e.key==="Tab"&&this.acceptKey!=="Tab"&&i){e.preventDefault(),e.stopPropagation();let s=o.state.selection.main.head;o.dispatch({changes:[{from:s,to:s,insert:" "}],selection:{anchor:s+1}})}},document.addEventListener("keydown",this.globalKeyListener,!0)}updateActiveEditors(){let e=app.workspace.getLeavesOfType("markdown");for(let r of e){let n=r.view;if(!n?.editor)continue;let o=n.editor.cm;if(o)try{o.dispatch({})}catch(i){ie(`[Copilot Autocomplete] Error updating editor: ${i}`)}}}hasActiveCompletion(e){let r=[".cm-inline-suggestion",".cm-ghost-text"];for(let n of r)if(Array.from(e.dom.querySelectorAll(n)).length>0)return!0;return!1}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}setActive(e){this.isActive=e}getExtension(){return this.extension}destroy(){this.globalKeyListener&&document.removeEventListener("keydown",this.globalKeyListener,!0),this.unsubscribeFromSettings&&this.unsubscribeFromSettings(),this.wordCompletionManager&&this.wordCompletionManager.destroy(),this.activeRequests.clear(),this.cache.clear()}shouldContinueSuggesting(e,r){if(e.endsWith("[[")||/\[\[[^\]]*$/.test(e)||r&&!r.startsWith(`
`))return!1;let o=e.split(`
`),i=o[o.length-1];if(/^#{1,6}(\s*)$/.test(i))return!1;let a=e.trim().split(/\s+/).filter(u=>u.replace(/[\p{Emoji}\p{Symbol}\p{Punctuation}]/gu,"").length>0),s=a[a.length-1]||"";return eir(s)?!0:e.endsWith(" ")}async*handleUnifiedCompletion(){if(!this.isActive)return;let e=app.workspace.getActiveViewOfType(w8e.MarkdownView);if(!e)return;await new Promise(c=>setTimeout(c,10));let r=e.editor,n=r.getCursor(),{prefix:o,noteContext:i}=tir(r,n),a=r.getLine(n.line).substring(n.ch)||"";if(this.lastCursorPosition){let c=Math.abs(n.line-this.lastCursorPosition.line),d=Math.abs(n.ch-this.lastCursorPosition.ch);(c>0||d>5)&&this.clearActiveRequests()}this.lastCursorPosition={line:n.line,ch:n.ch};let s=Date.now();if(s-this.lastRequestTime<this.minRequestInterval)return;let u=ne();if(this.shouldUseWordCompletion(o,u)){let c=this.getCurrentWordFromPrefix(o);if(!c||c.length<2)return;let d=`word:${c}:${o.slice(-50)}`;if(this.activeRequests.has(d))return;let f=this.wordCompletionManager.getSuggestions(c);if(f.length===0)return;let p=f.some(y=>y.word===c),m=f.some(y=>y.word.length-c.length>=2);if(p&&!m)return;let h=p?f.filter(y=>y.word!==c):f;if(h.length===0)return;try{let y=h.map(P=>P.word),g=o.slice(-1e3),_=a.slice(0,500),w,S,C;if(this.cacheEnabled&&(S=this.cache.generateWordKey(g,_,y),C=this.cache.get(S)),C)w=C;else{let P=this.client.wordcomplete(g,_,y);this.activeRequests.set(d,P),this.lastRequestTime=s,w=await P,this.cacheEnabled&&S&&this.cache.set(S,w),this.activeRequests.delete(d)}let E=w.response.selected_word;if(E&&E!==c){let P=this.generateCaseMatchedCompletion(E,c);P&&(yield{display_suggestion:P,complete_suggestion:P})}}catch(y){this.activeRequests.delete(d),ie("[Copilot Autocomplete] Error with LLM word selection, falling back to trie:",y);let g=h[0],_=this.generateCaseMatchedCompletion(g.word,c);_&&(yield{display_suggestion:_,complete_suggestion:_})}}else{if(!u.enableAutocomplete||!this.shouldContinueSuggesting(o,a))return;let c=o.slice(-this.options.maxContextLength);if(c.length<this.options.minTriggerLength)return;let d=`sentence:${c.slice(-100)}`;if(this.activeRequests.has(d))return;try{let f=u.allowAdditionalContext,p="";f&&(p=await wbe.getInstance().getRelevantNotes(e.file));let m=e.file?.basename||"",h=m?`[[${m}]]:
${c}`:c,y,g,_;if(this.cacheEnabled&&(g=this.cache.generateSentenceKey(h,i,p),_=this.cache.get(g)),_)y=_;else{let C=this.client.autocomplete(h,i,p);this.activeRequests.set(d,C),this.lastRequestTime=s,y=await C,this.cacheEnabled&&g&&this.cache.set(g,y),this.activeRequests.delete(d)}let w=y.response.completion,S=this.detectContext(o);w=this.postProcessor.process(c,a,w,S),yield{display_suggestion:w,complete_suggestion:w}}catch(f){this.activeRequests.delete(d),ie("[Copilot Autocomplete] Error fetching autocomplete suggestions:",f)}}}shouldUseWordCompletion(e,r){if(!r.enableWordCompletion||e.endsWith("[[")||/\[\[[^\]]*$/.test(e))return!1;let o=e.trim(),i=o[o.length-1];if(i&&/[a-zA-Z']/.test(i)){let a=this.getCurrentWordFromPrefix(e);if(a&&a.length>=2){let s=this.wordCompletionManager.getSuggestions(a);if(s.length===0)return!1;let u=s.some(c=>c.word===a),l=s.some(c=>c.word.length-a.length>=2);return!(u&&!l)}}return!1}getCurrentWordFromPrefix(e){let r=e.length;for(let o=e.length-1;o>=0;o--){let i=e[o];if(!/[a-zA-Z']/.test(i)){r=o+1;break}o===0&&(r=0)}let n=e.substring(r);return n.length>=2?n:null}generateCaseMatchedCompletion(e,r){if(e.length<=r.length)return"";let n=e.substring(r.length),o=r===r.toUpperCase(),i=r===r.toLowerCase(),a=r.length>0&&r[0]===r[0].toUpperCase()&&r.slice(1)===r.slice(1).toLowerCase();return o?n.toUpperCase():i||a?n.toLowerCase():n}detectContext(e){let r=e.split(`
`).pop()||"";if(/^\s*[-*+]\s/.test(r))return"UnorderedList";if(/^\s*\d+\.\s/.test(r))return"NumberedList";if(/^\s*[-*+]\s\[[ x]\]\s/.test(r))return"TaskList";if(e.includes("```")&&(e.split("```").length-1)%2===1)return"CodeBlock"}triggerCompletion(){this.isActive&&(this.clearActiveRequests(),this.forceFetch())}clearActiveRequests(){this.activeRequests.size>0&&this.activeRequests.clear()}getWordCompletionManager(){return this.wordCompletionManager}setCacheEnabled(e){this.cacheEnabled=e,e||this.cache.clear()}getCacheEnabled(){return this.cacheEnabled}};var Sbe=class t{constructor(e){this.plugin=e;let r=ne();this.cmIntegration=xbe.getInstance({delay:Xg.DELAY_MS,minTriggerLength:Xg.MIN_TRIGGER_LENGTH,maxContextLength:Xg.MAX_CONTEXT_LENGTH}),this.unsubscribeSettings=oa((o,i)=>{let a=(o.enableAutocomplete||o.enableWordCompletion)&&o.isPlusUser===!0,s=(i.enableAutocomplete||i.enableWordCompletion)&&i.isPlusUser===!0;a!==s&&this.cmIntegration.setActive(s)});let n=(r.enableAutocomplete||r.enableWordCompletion)&&r.isPlusUser===!0;this.cmIntegration.setActive(n),this.registerExtension()}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}registerExtension(){try{this.plugin.registerEditorExtension([this.cmIntegration.getExtension()])}catch(e){ie("[Copilot Autocomplete] Failed to register CodeMirror extension:",e)}}destroy(){this.unsubscribeSettings(),this.cmIntegration.setActive(!1),this.cmIntegration.destroy()}};er();kt();ZN();function nir(t){let e=t.split(`
`),r=[],n="",o="",i="";for(let a of e)a.startsWith("**user**:")||a.startsWith("**ai**:")?(n&&o&&r.push({id:mm(),sender:n===So?So:Yg,message:o.trim(),isVisible:!0,timestamp:i?cCe(i):null}),n=a.startsWith("**user**:")?So:Yg,o=a.substring(a.indexOf(":")+1).trim(),i=""):a.startsWith("[Timestamp:")?i=a.substring(11,a.length-1).trim():o+=`
`+a;return n&&o&&r.push({id:mm(),sender:n===So?So:Yg,message:o.trim(),isVisible:!0,timestamp:i?cCe(i):null}),r}async function oir(t,e){await e.clearChatMemory();for(let r=0;r<t.length-1;r++){let n=t[r];if(n.sender===So){let o=t[r+1];o?.sender===Yg&&await e.getMemory().saveContext({input:n.message},{output:o.message})}}}la();ez();Eze();yG();xu();$t();var Dir=require("obsidian");Un();var Cbe=j(Z());dn();var gi=Cbe.forwardRef(({className:t,type:e,...r},n)=>Cbe.createElement("input",{type:e,className:he("!tw-h-9 !tw-min-w-[50px] !tw-rounded-md !tw-border tw-border-solid tw-border-border !tw-bg-transparent !tw-px-3 !tw-py-1 !tw-text-sm !tw-transition-colors md:!tw-text-base","focus-visible:!tw-shadow-sm focus-visible:!tw-outline-none focus-visible:!tw-ring-1 focus-visible:!tw-ring-ring","placeholder:tw-text-sm","tw-flex tw-w-full tw-shadow-sm placeholder:tw-text-muted disabled:tw-cursor-not-allowed disabled:tw-opacity-50",t),ref:n,...r}));gi.displayName="Input";var Obe=j(Z());var cir=j(Z(),1);var air=j(Z(),1),sir=j(qa(),1);var nf=j(Z(),1);var iir=j(Z(),1);function m2n(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function l$(...t){return e=>t.forEach(r=>m2n(r,e))}function Ws(...t){return iir.useCallback(l$(...t),t)}var KH=j(at(),1),S8e=nf.forwardRef((t,e)=>{let{children:r,...n}=t,o=nf.Children.toArray(r),i=o.find(g2n);if(i){let a=i.props.children,s=o.map(u=>u===i?nf.Children.count(a)>1?nf.Children.only(null):nf.isValidElement(a)?a.props.children:null:u);return(0,KH.jsx)(x8e,{...n,ref:e,children:nf.isValidElement(a)?nf.cloneElement(a,void 0,s):null})}return(0,KH.jsx)(x8e,{...n,ref:e,children:r})});S8e.displayName="Slot";var x8e=nf.forwardRef((t,e)=>{let{children:r,...n}=t;if(nf.isValidElement(r)){let o=b2n(r);return nf.cloneElement(r,{...y2n(n,r.props),ref:e?l$(e,o):o})}return nf.Children.count(r)>1?nf.Children.only(null):null});x8e.displayName="SlotClone";var h2n=({children:t})=>(0,KH.jsx)(KH.Fragment,{children:t});function g2n(t){return nf.isValidElement(t)&&t.type===h2n}function y2n(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function b2n(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var uir=j(at(),1),_2n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],qi=_2n.reduce((t,e)=>{let r=air.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?S8e:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,uir.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function lir(t,e){t&&sir.flushSync(()=>t.dispatchEvent(e))}var dir=j(at(),1),v2n="Label",fir=cir.forwardRef((t,e)=>(0,dir.jsx)(qi.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));fir.displayName=v2n;var C8e=fir;hre();dn();var x2n=Kz("tw-text-sm tw-font-medium tw-leading-none peer-disabled:tw-cursor-not-allowed peer-disabled:tw-opacity-70"),om=Obe.forwardRef(({className:t,...e},r)=>Obe.createElement(C8e,{ref:r,className:he(x2n(),t),...e}));om.displayName=C8e.displayName;var ZH=j(Z());var Eg=j(Z(),1);var mir=j(Z(),1);function pir(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function O8e(...t){return e=>{let r=!1,n=t.map(o=>{let i=pir(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():pir(t[o],null)}}}}function hir(...t){return mir.useCallback(O8e(...t),t)}var db=j(Z(),1),E8e=j(at(),1);function gir(t,e){let r=db.createContext(e),n=i=>{let{children:a,...s}=i,u=db.useMemo(()=>s,Object.values(s));return(0,E8e.jsx)(r.Provider,{value:u,children:a})};n.displayName=t+"Provider";function o(i){let a=db.useContext(r);if(a)return a;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[n,o]}function ts(t,e=[]){let r=[];function n(i,a){let s=db.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=db.useMemo(()=>m,Object.values(m));return(0,E8e.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=db.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>db.createContext(a));return function(s){let u=s?.[t]||i;return db.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,S2n(o,...e)]}function S2n(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return db.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}function P8e(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var G1=j(Z(),1);var GH=j(Z(),1);function un(t){let e=GH.useRef(t);return GH.useEffect(()=>{e.current=t}),GH.useMemo(()=>(...r)=>e.current?.(...r),[])}function im({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=C2n({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,s=un(r),u=G1.useCallback(l=>{if(i){let d=typeof l=="function"?l(t):l;d!==t&&s(d)}else o(l)},[i,t,o,s]);return[a,u]}function C2n({defaultProp:t,onChange:e}){let r=G1.useState(t),[n]=r,o=G1.useRef(n),i=un(e);return G1.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var Ebe=j(Z(),1);function Pbe(t){let e=Ebe.useRef({value:t,previous:t});return Ebe.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var bir=j(Z(),1);var yir=j(Z(),1),vo=globalThis?.document?yir.useLayoutEffect:()=>{};function J1(t){let[e,r]=bir.useState(void 0);return vo(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});let n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;let i=o[0],a,s;if("borderBoxSize"in i){let u=i.borderBoxSize,l=Array.isArray(u)?u[0]:u;a=l.inlineSize,s=l.blockSize}else a=t.offsetWidth,s=t.offsetHeight;r({width:a,height:s})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}var _h=j(Z(),1);var vir=j(Z(),1);function _ir(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function O2n(...t){return e=>{let r=!1,n=t.map(o=>{let i=_ir(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():_ir(t[o],null)}}}}function wir(...t){return vir.useCallback(O2n(...t),t)}var xir=j(Z(),1);function E2n(t,e){return xir.useReducer((r,n)=>e[r][n]??r,t)}var of=t=>{let{present:e,children:r}=t,n=P2n(e),o=typeof r=="function"?r({present:n.isPresent}):_h.Children.only(r),i=wir(n.ref,T2n(o));return typeof r=="function"||n.isPresent?_h.cloneElement(o,{ref:i}):null};of.displayName="Presence";function P2n(t){let[e,r]=_h.useState(),n=_h.useRef({}),o=_h.useRef(t),i=_h.useRef("none"),a=t?"mounted":"unmounted",[s,u]=E2n(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _h.useEffect(()=>{let l=Tbe(n.current);i.current=s==="mounted"?l:"none"},[s]),vo(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Tbe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),vo(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Tbe(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=Tbe(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{c.clearTimeout(l),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:_h.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function Tbe(t){return t?.animationName||"none"}function T2n(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Sir=j(Z(),1),N2n=j(qa(),1);var af=j(Z(),1);var JH=j(at(),1),A8e=af.forwardRef((t,e)=>{let{children:r,...n}=t,o=af.Children.toArray(r),i=o.find(I2n);if(i){let a=i.props.children,s=o.map(u=>u===i?af.Children.count(a)>1?af.Children.only(null):af.isValidElement(a)?a.props.children:null:u);return(0,JH.jsx)(T8e,{...n,ref:e,children:af.isValidElement(a)?af.cloneElement(a,void 0,s):null})}return(0,JH.jsx)(T8e,{...n,ref:e,children:r})});A8e.displayName="Slot";var T8e=af.forwardRef((t,e)=>{let{children:r,...n}=t;if(af.isValidElement(r)){let o=R2n(r);return af.cloneElement(r,{...M2n(n,r.props),ref:e?O8e(e,o):o})}return af.Children.count(r)>1?af.Children.only(null):null});T8e.displayName="SlotClone";var A2n=({children:t})=>(0,JH.jsx)(JH.Fragment,{children:t});function I2n(t){return af.isValidElement(t)&&t.type===A2n}function M2n(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function R2n(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Cir=j(at(),1),j2n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],I8e=j2n.reduce((t,e)=>{let r=Sir.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?A8e:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Cir.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var Y1=j(at(),1),M8e="Checkbox",[D2n,wqi]=ts(M8e),[L2n,F2n]=D2n(M8e),Oir=Eg.forwardRef((t,e)=>{let{__scopeCheckbox:r,name:n,checked:o,defaultChecked:i,required:a,disabled:s,value:u="on",onCheckedChange:l,form:c,...d}=t,[f,p]=Eg.useState(null),m=hir(e,S=>p(S)),h=Eg.useRef(!1),y=f?c||!!f.closest("form"):!0,[g=!1,_]=im({prop:o,defaultProp:i,onChange:l}),w=Eg.useRef(g);return Eg.useEffect(()=>{let S=f?.form;if(S){let C=()=>_(w.current);return S.addEventListener("reset",C),()=>S.removeEventListener("reset",C)}},[f,_]),(0,Y1.jsxs)(L2n,{scope:r,state:g,disabled:s,children:[(0,Y1.jsx)(I8e.button,{type:"button",role:"checkbox","aria-checked":Z1(g)?"mixed":g,"aria-required":a,"data-state":Tir(g),"data-disabled":s?"":void 0,disabled:s,value:u,...d,ref:m,onKeyDown:P8e(t.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:P8e(t.onClick,S=>{_(C=>Z1(C)?!0:!C),y&&(h.current=S.isPropagationStopped(),h.current||S.stopPropagation())})}),y&&(0,Y1.jsx)(k2n,{control:f,bubbles:!h.current,name:n,value:u,checked:g,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"},defaultChecked:Z1(i)?!1:i})]})});Oir.displayName=M8e;var Eir="CheckboxIndicator",Pir=Eg.forwardRef((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=F2n(Eir,r);return(0,Y1.jsx)(of,{present:n||Z1(i.state)||i.state===!0,children:(0,Y1.jsx)(I8e.span,{"data-state":Tir(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});Pir.displayName=Eir;var k2n=t=>{let{control:e,checked:r,bubbles:n=!0,defaultChecked:o,...i}=t,a=Eg.useRef(null),s=Pbe(r),u=J1(e);Eg.useEffect(()=>{let c=a.current,d=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(d,"checked").set;if(s!==r&&p){let m=new Event("click",{bubbles:n});c.indeterminate=Z1(r),p.call(c,Z1(r)?!1:r),c.dispatchEvent(m)}},[s,r,n]);let l=Eg.useRef(Z1(r)?!1:r);return(0,Y1.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??l.current,...i,tabIndex:-1,ref:a,style:{...t.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Z1(t){return t==="indeterminate"}function Tir(t){return Z1(t)?"indeterminate":t?"checked":"unchecked"}var R8e=Oir,Air=Pir;_n();dn();var hu=ZH.forwardRef(({className:t,...e},r)=>ZH.createElement(R8e,{ref:r,className:he("tw-border-solid !tw-bg-transparent tw-p-0 !tw-shadow tw-transition-colors","hover:!tw-bg-interactive-accent hover:!tw-text-on-accent data-[state=checked]:!tw-bg-interactive-accent data-[state=checked]:!tw-text-on-accent","tw-peer tw-size-4 tw-shrink-0 tw-rounded-sm tw-border tw-border-interactive-accent focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring disabled:tw-cursor-not-allowed disabled:tw-opacity-50",t),...e},ZH.createElement(Air,{className:he("tw-flex tw-items-center tw-justify-center tw-text-current")},ZH.createElement(ds,{className:"tw-size-4"}))));hu.displayName=R8e.displayName;var fb=j(Z());dn();var ev=fb.forwardRef(({className:t,value:e,...r},n)=>{let o=fb.useRef(null),i=fb.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);fb.useLayoutEffect(()=>{i()},[e,i]),fb.useEffect(()=>(i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)),[i]);let a=s=>{o.current=s,typeof n=="function"?n(s):n&&(n.current=s)};return fb.createElement("textarea",{className:he("tw-min-w-fit tw-resize-y tw-overflow-auto tw-border-solid","tw-flex tw-max-h-[300px] tw-min-h-[60px] tw-w-full tw-rounded-md tw-border tw-bg-transparent tw-px-3 tw-py-2 tw-text-base tw-shadow-sm placeholder:tw-text-muted focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring disabled:tw-cursor-not-allowed disabled:tw-opacity-50 md:tw-text-sm",t),value:e,ref:a,onChange:s=>{i(),r.onChange?.(s)},onInput:i,onCompositionEnd:i,onPaste:()=>{setTimeout(i,0)},...r})});ev.displayName="Textarea";var yi=j(Z()),Lir=j(Bc());_t();var UO=j(Z());kt();_n();er();var N8e=({capabilities:t=[],iconSize:e=16})=>UO.default.createElement(UO.default.Fragment,null,t.sort((r,n)=>r.localeCompare(n)).map((r,n)=>{switch(r){case"reasoning":return UO.default.createElement(JE,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});case"vision":return UO.default.createElement(GE,{key:n,className:"tw-text-model-capabilities-green",style:{width:e,height:e}});case"websearch":return UO.default.createElement(Zb,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});default:return null}})),j8e=({model:t,iconSize:e=14})=>{let r=t.displayName||t.name;return UO.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-1"},UO.default.createElement("span",{className:"tw-truncate tw-text-sm hover:tw-text-normal"},r),t.capabilities&&t.capabilities.length>0&&UO.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-0.5"},UO.default.createElement(N8e,{capabilities:t.capabilities,iconSize:e})))},Abe=t=>{let e=t.displayName||t.name,r=`(${jp(t.provider)})`;return`${e} ${r}`},YH=t=>{let e=t.displayName||t.name,r=`(${jp(t.provider,t)})`,n=t.capabilities?.map(o=>{switch(o){case"reasoning":return"Reasoning";case"vision":return"Vision";case"websearch":return"Websearch";default:return""}}).join("|")||"";return`${e} ${r} ${n}`};dn();_n();$t();var qO=j(Z());function Iir(){return qO.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},qO.default.createElement("li",null,qO.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{}")," represents the selected text."),qO.default.createElement("li",null,qO.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," represents a note."),qO.default.createElement("li",null,qO.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),qO.default.createElement("li",null,qO.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{#tag1, #tag2}")," represents ALL notes with ANY of the specified tags in their property (an OR operation)."))}var D8e="{copilot-selection}";var XH="copilotquickcommand",HO={title:"",content:"",showInContextMenu:!0,showInSlashMenu:!0,order:0,modelKey:"",lastUsedMs:0},sA="copilot-command-context-menu-enabled",uA="copilot-command-slash-enabled",VO="copilot-command-context-menu-order",lA="copilot-command-model-key",cA="copilot-command-last-used",Mir=[{title:"Fix grammar and spelling",content:"Fix the grammar and spelling of {}. Preserve all formatting, line breaks, and special characters. Do not add or remove any content. Return only the corrected text.",showInContextMenu:!0,showInSlashMenu:!0,order:1e3,modelKey:"",lastUsedMs:0},{title:"Translate to Chinese",content:`Translate {} into Chinese:
1. Preserve the meaning and tone
2. Maintain appropriate cultural context
3. Keep formatting and structure
Return only the translated text.`,showInContextMenu:!0,showInSlashMenu:!0,order:1010,modelKey:"",lastUsedMs:0},{title:"Summarize",content:"Create a bullet-point summary of {}. Each bullet point should capture a key point. Return only the bullet-point summary.",showInContextMenu:!0,showInSlashMenu:!0,order:1020,modelKey:"",lastUsedMs:0},{title:"Simplify",content:"Simplify {} to a 6th-grade reading level (ages 11-12). Use simple sentences, common words, and clear explanations. Maintain the original key concepts. Return only the simplified text.",showInContextMenu:!0,showInSlashMenu:!0,order:1030,modelKey:"",lastUsedMs:0},{title:"Explain like I am 5",content:`Explain {} in simple terms that a 5-year-old would understand:
1. Use basic vocabulary
2. Include simple analogies
3. Break down complex concepts
Return only the simplified explanation.`,showInContextMenu:!0,showInSlashMenu:!0,order:1040,modelKey:"",lastUsedMs:0},{title:"Emojify",content:`Add relevant emojis to enhance {}. Follow these rules:
1. Insert emojis at natural breaks in the text
2. Never place two emojis next to each other
3. Keep all original text unchanged
4. Choose emojis that match the context and tone
Return only the emojified text.`,showInContextMenu:!0,showInSlashMenu:!0,order:1050,modelKey:"",lastUsedMs:0},{title:"Make shorter",content:`Reduce {} to half its length while preserving these elements:
1. Main ideas and key points
2. Essential details
3. Original tone and style
Return only the shortened text.`,showInContextMenu:!0,showInSlashMenu:!0,order:1060,modelKey:"",lastUsedMs:0},{title:"Make longer",content:`Expand {} to twice its length by:
1. Adding relevant details and examples
2. Elaborating on key points
3. Maintaining the original tone and style
Return only the expanded text.`,showInContextMenu:!0,showInSlashMenu:!0,order:1070,modelKey:"",lastUsedMs:0},{title:"Generate table of contents",content:"Generate a hierarchical table of contents for {}. Use appropriate heading levels (H1, H2, H3, etc.). Include page numbers if present. Return only the table of contents.",showInContextMenu:!1,showInSlashMenu:!1,order:1080,modelKey:"",lastUsedMs:0},{title:"Generate glossary",content:'Create a glossary of important terms, concepts, and phrases from {}. Format each entry as "Term: Definition". Sort entries alphabetically. Return only the glossary.',showInContextMenu:!1,showInSlashMenu:!1,order:1090,modelKey:"",lastUsedMs:0},{title:"Remove URLs",content:"Remove all URLs from {}. Preserve all other content and formatting. URLs may be in various formats (http, https, www). Return only the text with URLs removed.",showInContextMenu:!1,showInSlashMenu:!1,order:1100,modelKey:"",lastUsedMs:0},{title:"Rewrite as tweet",content:`Rewrite {} as a single tweet with these requirements:
1. Maximum 280 characters
2. Use concise, impactful language
3. Maintain the core message
Return only the tweet text.`,showInContextMenu:!1,showInSlashMenu:!1,order:1110,modelKey:"",lastUsedMs:0},{title:"Rewrite as tweet thread",content:`Convert {} into a Twitter thread following these rules:
1. Each tweet must be under 240 characters
2. Start with "THREAD START" on its own line
3. Separate tweets with "
---
"
4. End with "THREAD END" on its own line
5. Make content engaging and clear
Return only the formatted thread.`,showInContextMenu:!1,showInSlashMenu:!1,order:1120,modelKey:"",lastUsedMs:0}];var QH=require("obsidian");_t();b8();b8();var c$=YB(),d$=Lh([]),L8e=new Set;function f$(t){L8e.add(t)}function p$(t){L8e.delete(t)}function tY(t){return L8e.has(t)}function rY(t){let e=c$.get(d$);c$.set(d$,e.filter(r=>r.title!==t))}function m$(t,e){let r=c$.get(d$),n;(e?r.findIndex(i=>i.title===e):-1)!==-1?n=r.map(i=>i.title===e?t:i):n=[...r,t],c$.set(d$,n)}function Ibe(t){c$.set(d$,t)}function Rir(){return y8(d$,{store:c$})}function cp(){return c$.get(d$)}O8();kt();er();function Mbe(t,e,r){let n=t.trim();return r&&n===r?null:n?/[#<>:"/\\|?*[\]^\x00-\x1F]/g.test(n)?'Command name contains invalid characters. Avoid using: < > : " / \\ | ? * [ ] ^':e.some(i=>i.title.toLowerCase()===n.toLowerCase())?"A command with this name already exists":null:"Command name cannot be empty"}function eV(t){return encodeURIComponent(t.toLowerCase())}function X1(){return(0,QH.normalizePath)(ne().customPromptsFolder)}function tV(t){return`${X1()}/${t}.md`}function rV(t){if(!(t instanceof QH.TFile)||t.extension!=="md")return!1;let e=X1();return!(!t.path.startsWith(e+"/")||t.path.slice(e.length+1).includes("/"))}function B2n(t){if(t.startsWith("---")){let e=t.indexOf("---",3);if(e!==-1)return t.slice(e+3).trimStart()}return t}function Nir(t){return app.metadataCache.getFileCache(t)?.frontmatter?.[VO]!=null}async function nY(t){let e=await app.vault.read(t),r=B2n(e),n=app.metadataCache.getFileCache(t),o=n?.frontmatter?.[sA]??HO.showInContextMenu,i=n?.frontmatter?.[uA]??HO.showInSlashMenu,a=n?.frontmatter?.[cA]??HO.lastUsedMs,s=n?.frontmatter?.[VO]??HO.order,u=n?.frontmatter?.[lA]??HO.modelKey;return{title:t.basename,modelKey:u,content:r,showInContextMenu:o,showInSlashMenu:i,order:s,lastUsedMs:a}}async function Rbe(){let t=app.vault.getFiles().filter(r=>rV(r)),e=await Promise.all(t.map(nY));return Ibe(e),e}function oY(t){return[...t].sort((e,r)=>e.order===r.order?e.title.localeCompare(r.title):e.order-r.order)}function z2n(t){return[...t].sort((e,r)=>e.lastUsedMs===r.lastUsedMs?e.title.localeCompare(r.title):r.lastUsedMs-e.lastUsedMs)}function U2n(t){return[...t].sort((e,r)=>e.title.localeCompare(r.title))}function Nbe(t){switch(ne().promptSortStrategy){case"timestamp":return z2n(t);case"alphabetical":return U2n(t);case"manual":return oY(t);default:return t}}async function F8e(t,e,r=!1){let o=(await k8e(t,e,app.vault,app.workspace.getActiveFile())).processedPrompt;if(o.includes(`{${Rm}}`)||r)return o;let i=o.indexOf(D8e);return i===-1&&e.trim()?o+`
<`+Rm+">"+e+"</"+Rm+">":o.slice(0,i)+e+o.slice(i+D8e.length)}var q2n=/\{(?!copilot-selection\})([^}]+)\}/g;async function H2n(t,e,r){let n=new Map,o=new Set,i;for(;(i=q2n.exec(t))!==null;){let a=i[1].trim(),s={content:"",files:[]};if(a.toLowerCase()==="activenote")if(r){let u=await nz(r,e);u&&(s.content=`<${$j}>
## ${Tee(r)}
${u}
</${$j}>`,s.files.push(r))}else new QH.Notice("No active note found.");else if(a.startsWith("#")){let u=a.slice(1).split(",").map(d=>d.trim()),l=await Get(e,u),c=[];for(let d of l){let f=await nz(d,e);f&&(c.push(`<${$j}>
## ${Tee(d)}
${f}
</${$j}>`),s.files.push(d))}s.content=c.join(`
`)}else{let u=Yet(a),l=await lCe(e,u),c=[];for(let d of l){let f=await nz(d,e);f&&(c.push(`<${$j}>
## ${Tee(d)}
${f}
</${$j}>`),s.files.push(d))}s.content=c.join(`
`)}s.content?(n.set(a,s.content),s.files.forEach(u=>o.add(u))):a.toLowerCase()!=="activenote"&&(a.startsWith('"')||console.warn(`No notes found for variable: ${a}`))}return{variablesMap:n,includedFiles:o}}async function k8e(t,e,r,n){let o=ne(),i=new Set;if(!o.enableCustomPromptTemplating)return t.includes("{}")&&!e&&n&&i.add(n),{processedPrompt:t+`
`,includedFiles:Array.from(i)};let{variablesMap:a,includedFiles:s}=await H2n(t,r,n);s.forEach(f=>i.add(f));let u=t,l="",c=null;u.includes("{}")&&(u=u.replace(/\{\}/g,`{${Rm}}`),e?l+=`<${Rm}>
${e}
</${Rm}>`:n?(c=await nz(n,r),l+=`<${Rm} type="active_note">
${c||""}
</${Rm}>`,i.add(n)):l+=`<${Rm}>
(No selected text or active note available)
</${Rm}>`);for(let[f,p]of a.entries())f.toLowerCase()==="activenote"&&c!==null||(l?l+=`
<${P8} name="${f}">
${p}
</${P8}>`:l+=`<${P8} name="${f}">
${p}
</${P8}>`);let d=Zg(u,r);for(let f of d)if(!i.has(f)){let p=await nz(f,r);if(p){let m=await r.adapter.stat(f.path),h=m?new Date(m.ctime).toISOString():"Unknown",y=m?new Date(m.mtime).toISOString():"Unknown",g=`<${E8}>
<title>${f.basename}</title>
<path>${f.path}</path>
<ctime>${h}</ctime>
<mtime>${y}</mtime>
<content>
${p}
</content>
</${E8}>`;l&&(l+=`
`),l+=`${g}`,i.add(f)}}return{processedPrompt:l?`${u}
${l}`:`${u}
`,includedFiles:Array.from(i)}}function jir(t,e){let n=`${t} (copy)`,o=1;for(;e.some(i=>i.title.toLowerCase()===n.toLowerCase());)o++,n=`${t} (copy ${o})`;return n}function jbe(){let e=cp().reduce((r,n)=>r>n.order?r:n.order,0);return e===Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+10}async function $8e(t,e){try{f$(t.path),await app.fileManager.processFrontMatter(t,r=>{r[sA]==null&&(r[sA]=e.showInContextMenu),r[uA]==null&&(r[uA]=e.showInSlashMenu),r[VO]==null&&(r[VO]=e.order),r[lA]==null&&(r[lA]=e.modelKey),r[cA]==null&&(r[cA]=e.lastUsedMs)})}finally{p$(t.path)}}function Dbe(t){let e=t.getCursor("from"),r=t.getCursor("to"),o=t.getValue().split(`
`),i=!1,a=[],s=0,u=0,l=0;for(;l<o.length;)if(o[l].trim()===`\`\`\`${XH}`){i=!0;let c=l;for(l++;l<o.length&&o[l].trim()!=="```";)l++;l++;let d=l-c;c<=e.line&&(s+=d),c<=r.line&&(u+=d)}else a.push(o[l]),l++;if(i){t.setValue(a.join(`
`));let c=Math.max(0,e.line-s),d=Math.max(0,r.line-u);t.setSelection({line:c,ch:e.ch},{line:d,ch:r.ch})}return i}function V2n({commands:t,command:e,onConfirm:r,onCancel:n}){let i=an().activeModels.filter(f=>f.enabled).map(f=>({label:Abe(f),value:Qr(f)})),[a,s]=(0,yi.useState)(e),[u,l]=(0,yi.useState)({}),c=(f,p)=>{s(m=>({...m,[f]:p})),l(m=>({...m,[f]:void 0}))},d=()=>{let f={},p=Mbe(a.title,t,e.title);if(p&&(f.title=p),a.content.trim()||(f.content="Prompt is required"),Object.keys(f).length>0){l(f);return}r(a)};return yi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},yi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},yi.default.createElement(om,{htmlFor:"title"},"Name"),yi.default.createElement(gi,{id:"title",value:a.title,onChange:f=>c("title",f.target.value),placeholder:"Enter command name"}),u.title&&yi.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.title)),yi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},yi.default.createElement(om,{htmlFor:"content"},"Prompt"),yi.default.createElement(Iir,null),yi.default.createElement(ev,{id:"content",value:a.content,onChange:f=>c("content",f.target.value),placeholder:"Enter command prompt",className:"tw-min-h-[200px]"}),u.content&&yi.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.content)),yi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},yi.default.createElement(om,{htmlFor:"modelKey"},"Model (Optional)"),yi.default.createElement("div",{className:"tw-group tw-relative tw-w-full"},yi.default.createElement("select",{value:a.modelKey,onChange:f=>{let p=f.target.value;if(!p){c("modelKey","");return}if(!i.find(h=>h.value===p)){ie(`Model ${p} not found`),c("modelKey","");return}c("modelKey",f.target.value)},className:he("tw-w-full tw-appearance-none","tw-flex tw-h-9 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-dropdown tw-px-3 tw-py-1 tw-pr-8","tw-text-sm !tw-shadow tw-transition-colors","focus:tw-outline-none focus:tw-ring-1 focus:tw-ring-ring","disabled:tw-cursor-not-allowed disabled:tw-opacity-50","hover:tw-bg-interactive-hover hover:tw-text-normal")},yi.default.createElement("option",{value:""},"Inherit from chat model"),i.map(f=>yi.default.createElement("option",{key:f.value,value:f.value.toString()},f.label))),yi.default.createElement("div",{className:he("tw-pointer-events-none tw-absolute tw-inset-y-0 tw-right-0 tw-flex tw-items-center tw-pr-2","tw-transition-colors group-hover:[&>svg]:tw-text-normal")},yi.default.createElement($i,{className:"tw-size-4"})))),yi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},yi.default.createElement(hu,{id:"showInContextMenu",checked:a.showInContextMenu,onCheckedChange:f=>c("showInContextMenu",f)}),yi.default.createElement(om,{htmlFor:"showInContextMenu"},"Show in context menu")),yi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},yi.default.createElement(hu,{id:"showInSlashMenu",checked:a.showInSlashMenu,onCheckedChange:f=>c("showInSlashMenu",f)}),yi.default.createElement(om,{htmlFor:"showInSlashMenu"},"Show in slash menu")),yi.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},yi.default.createElement(me,{variant:"secondary",onClick:n},"Cancel"),yi.default.createElement(me,{variant:"default",onClick:d},"Save")))}var Q1=class extends Dir.Modal{constructor(r,n,o,i){super(r);this.commands=n;this.command=o;this.onUpdate=i;this.setTitle("Edit Command")}onOpen(){let{contentEl:r}=this;this.root=(0,Lir.createRoot)(r);let n=o=>{this.onUpdate(o),this.close()};this.root.render(yi.default.createElement(V2n,{commands:this.commands,command:this.command,onConfirm:n,onCancel:()=>this.close()}))}onClose(){this.root.unmount()}};var iY=require("obsidian");IE();kt();var Ac=class t{static getInstance(){return t.instance||(t.instance=new t),t.instance}async createCommand(e,r={}){let n={skipStoreUpdate:!1,autoOrder:!0,...r},o=tV(e.title);try{f$(o);let i=e.order;n.autoOrder&&(i=jbe()),e={...e,order:i};let a=X1();await Mm(a);let s=app.vault.getAbstractFileByPath(o);!s||!(s instanceof iY.TFile)?s=await app.vault.create(o,e.content):await app.vault.modify(s,e.content),await app.fileManager.processFrontMatter(s,u=>{u[sA]=e.showInContextMenu,u[uA]=e.showInSlashMenu,u[VO]=e.order,u[lA]=e.modelKey,u[cA]=e.lastUsedMs}),n.skipStoreUpdate||m$(e,e.title)}finally{p$(o)}}async recordUsage(e){this.updateCommand({...e,lastUsedMs:Date.now()},e.title)}async updateCommand(e,r,n=!1){let o=tV(e.title),i=tV(r),a=e.title!==r;try{f$(o),a&&f$(i),n||m$(e,r);let s=app.vault.getAbstractFileByPath(o);if(a){if(app.vault.getAbstractFileByPath(o))throw new en("Error saving custom prompt. Please check if the title already exists.");let l=app.vault.getAbstractFileByPath(i);l instanceof iY.TFile&&(await app.vault.rename(l,o),s=app.vault.getAbstractFileByPath(o))}s||(await this.createCommand(e,{skipStoreUpdate:n,autoOrder:!0}),s=app.vault.getAbstractFileByPath(tV(e.title))),s instanceof iY.TFile&&(await app.vault.modify(s,e.content),await app.fileManager.processFrontMatter(s,u=>{u[sA]=e.showInContextMenu,u[uA]=e.showInSlashMenu,u[VO]=e.order,u[lA]=e.modelKey,u[cA]=e.lastUsedMs}))}finally{p$(o),a&&p$(i)}}async updateCommands(e){Ibe(e),await Promise.all(e.map(r=>this.updateCommand(r,r.title,!0)))}async reorderCommands(e){let r=[...e];for(let n=0;n<r.length;n++)r[n]={...r[n],order:n*10};await this.updateCommands(r)}async deleteCommand(e){let r=tV(e.title);try{f$(r),rY(e.title);let n=app.vault.getAbstractFileByPath(r);n instanceof iY.TFile&&await app.vault.delete(n)}finally{p$(r)}}};var Fbe=require("obsidian");la();Un();dye();$t();kt();tI();Im();c8e();_n();var tv=require("obsidian"),Mt=j(Z()),Fir=j(Bc());_t();function W2n(t,e){let[r]=(0,Mt.useState)(new KZ({returnMessages:!0,memoryKey:"history"})),[n,o]=(0,Mt.useState)(null);return(0,Mt.useEffect)(()=>{async function i(){let a=await x1.getInstance().createModelInstance(t),u=Am.fromMessages([eI.fromTemplate(e||"You are a helpful assistant. You'll help the user with their content editing needs."),new Rv("history"),Nv.fromTemplate("{input}")]),l=Fi.from([{input:c=>c.input,memory:()=>r.loadMemoryVariables({})},{input:c=>c.input,history:c=>c.memory.history},u,a]);o(l)}i()},[t,r,e]),{chatChain:n,chatMemory:r}}function K2n({originalText:t,command:e,onInsert:r,onReplace:n,systemPrompt:o}){let[i,a]=(0,Mt.useState)(null),[s,u]=(0,Mt.useState)(null),[l,c]=(0,Mt.useState)(""),d=(0,Mt.useRef)(null),f=(0,Mt.useRef)(null),[p,m]=(0,Mt.useState)(!0),[h]=lI(),y=an(),g=(0,Mt.useMemo)(()=>Iee(e.modelKey||h,y.activeModels),[e.modelKey,h,y.activeModels]),{chatChain:_,chatMemory:w}=W2n(g,o),S=e.title,C=(0,Mt.useCallback)(async(M,D)=>{if(!_)return console.error("Chat chain not initialized"),new tv.Notice("Chat engine not ready. Please try again."),m(!1),null;try{a(null),u(null),m(!0);let k="",H=await _.bind({signal:D.signal}).stream({input:M});for await(let K of H){if(D.signal.aborted)break;let G=typeof K.content=="string"?K.content:"";k+=G,a(k)}if(!D.signal.aborted){let K=k.trim();return u(K),m(!1),await w.saveContext({input:M},{output:K}),K}return null}catch(k){return ie("Error generating response:",k),m(!1),null}},[_,w]);(0,Mt.useEffect)(()=>{let M=new AbortController;E.current=M;async function D(){if(_)try{let k=await F8e(e.content,t);await C(k,M)}catch(k){ie("Error in initial response:",k),m(!1)}}return D(),()=>{M.abort()}},[e.content,t,_,C]);let E=(0,Mt.useRef)(null),P=async()=>{if(!l.trim()||!_){_||new tv.Notice("Chat engine not ready. Please try again.");return}let M=new AbortController;E.current=M;let D=await F8e(l,t,!0);try{await C(D,M)&&c("")}finally{M.signal.aborted&&(m(!1),u(i??"")),E.current=null}},T=()=>{E.current&&(E.current.abort(),E.current=null,m(!1))},I=M=>{M.nativeEvent.isComposing||(!p&&s&&!N&&(M.key==="Enter"&&(tv.Platform.isMacOS?M.metaKey:M.ctrlKey)&&!M.shiftKey&&(M.preventDefault(),n(s)),M.key==="Enter"&&(tv.Platform.isMacOS?M.metaKey:M.ctrlKey)&&M.shiftKey&&(M.preventDefault(),r(s))),N&&M.key==="Enter"&&!M.shiftKey&&!M.metaKey&&!M.ctrlKey&&(M.preventDefault(),P()))};(0,Mt.useEffect)(()=>{if(d.current&&i&&p){let M=d.current;M.scrollTop=M.scrollHeight}},[i,p]);let N=!p&&l.trim().length>0;return Mt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4",onKeyDown:I},Mt.default.createElement("div",{className:"tw-max-h-60 tw-overflow-y-auto tw-whitespace-pre-wrap tw-text-muted"},t),Mt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},S&&Mt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-font-bold tw-text-normal"},Mt.default.createElement(dy,{className:"tw-size-4"}),S)),Mt.default.createElement("div",{className:"tw-group tw-relative"},Mt.default.createElement("textarea",{ref:d,className:"tw-peer tw-h-60 tw-w-full tw-text-text",value:s??i??"loading...",disabled:s==null,onChange:M=>u(M.target.value)}),s&&Mt.default.createElement("button",{className:"tw-absolute tw-right-2 tw-top-2 tw-opacity-0 tw-transition-opacity group-hover:tw-opacity-100 peer-focus-visible:!tw-opacity-0",onClick:()=>{navigator.clipboard.writeText(s),new tv.Notice("Copied to clipboard")}},Mt.default.createElement(Bm,{className:"tw-size-4 hover:tw-text-accent"}))),!p&&s&&Mt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Mt.default.createElement("textarea",{autoFocus:!0,ref:f,className:"tw-h-20 tw-w-full tw-text-text",placeholder:"Enter follow-up instructions...",value:l,onChange:M=>c(M.target.value)})),Mt.default.createElement("div",{className:"tw-flex tw-justify-between tw-gap-2"},Mt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs tw-font-bold tw-text-faint"},Mt.default.createElement(T5,{className:"tw-size-4"}),Abe(g)),Mt.default.createElement("div",{className:"tw-flex tw-gap-2"},p?Mt.default.createElement(me,{size:"sm",variant:"secondary",onClick:T},"Stop"):N?Mt.default.createElement(me,{size:"sm",onClick:P,className:"tw-flex tw-items-center tw-gap-1"},Mt.default.createElement("span",null,"Submit"),Mt.default.createElement(Jb,{className:"tw-size-3"})):Mt.default.createElement(Mt.default.Fragment,null,Mt.default.createElement(me,{size:"sm",onClick:()=>r(s??""),className:"tw-flex tw-items-center tw-gap-1"},Mt.default.createElement("span",null,"Insert"),Mt.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs"},tv.Platform.isMacOS?Mt.default.createElement(Mt.default.Fragment,null,Mt.default.createElement(FI,{className:"tw-size-3"}),Mt.default.createElement(Zz,{className:"tw-size-3"}),Mt.default.createElement(Jb,{className:"tw-size-3"})):Mt.default.createElement(Mt.default.Fragment,null,Mt.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),Mt.default.createElement(Zz,{className:"tw-size-3"}),Mt.default.createElement(Jb,{className:"tw-size-3"})))),Mt.default.createElement(me,{size:"sm",onClick:()=>n(s??""),className:"tw-flex tw-items-center tw-gap-1"},Mt.default.createElement("span",null,"Replace"),Mt.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs"},tv.Platform.isMacOS?Mt.default.createElement(Mt.default.Fragment,null,Mt.default.createElement(FI,{className:"tw-size-3"}),Mt.default.createElement(Jb,{className:"tw-size-3"})):Mt.default.createElement(Mt.default.Fragment,null,Mt.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),Mt.default.createElement(Jb,{className:"tw-size-3"}))))))))}var eN=class extends tv.Modal{constructor(r,n){super(r);this.configs=n}onOpen(){let{contentEl:r}=this;this.root=(0,Fir.createRoot)(r);let{selectedText:n,command:o,systemPrompt:i}=this.configs,a=u=>{x8(u),this.close()},s=u=>{x8(u,!0),this.close()};this.root.render(Mt.default.createElement(K2n,{originalText:n,command:o,onInsert:a,onReplace:s,systemPrompt:i}))}onClose(){this.root.unmount()}};var Lbe=class extends Fbe.FuzzySuggestModal{constructor(e){super(e),this.setPlaceholder("Select a custom command to apply...");let r=cp();this.commands=Nbe(r)}onOpen(){super.onOpen(),this.commands.length===0&&this.setInstructions([{command:"",purpose:"No custom commands found. Create some custom commands first in the settings."}])}getItems(){return this.commands}getItemText(e){return e.title}onChooseItem(e,r){let n=this.app.workspace.getActiveViewOfType(Fbe.MarkdownView);if(!n||!n.editor){this.openCommandModal(e,"");return}let o=n.editor.getSelection();this.openCommandModal(e,o)}openCommandModal(e,r){Ac.getInstance().recordUsage(e),new eN(this.app,{selectedText:r,command:e}).open()}};Yp();_t();kt();var Ti=require("obsidian");ZN();er();function dp(t,e,r){t.addCommand({id:e,name:Dee[e],callback:r})}function kir(t,e,r){t.addCommand({id:e,name:Dee[e],editorCallback:r})}function G2n(t,e,r){t.addCommand({id:e,name:Dee[e],checkCallback:r})}function B8e(t,e,r){kir(t,zr.COUNT_WORD_AND_TOKENS_SELECTION,async n=>{let o=await n.getSelection(),i=o.split(" ").length,a=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(o);new Ti.Notice(`Selected text contains ${i} words and ${a} tokens.`)}),dp(t,zr.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let n=await yze(t.app),o=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(n);new Ti.Notice(`Total tokens in your vault: ${o}`)}catch(n){ie("Error counting tokens: ",n),new Ti.Notice("An error occurred while counting tokens.")}}),dp(t,zr.TOGGLE_COPILOT_CHAT_WINDOW,()=>{t.toggleView()}),dp(t,zr.OPEN_COPILOT_CHAT_WINDOW,()=>{t.activateView()}),dp(t,zr.NEW_CHAT,()=>{t.newChat()}),G2n(t,zr.TRIGGER_QUICK_COMMAND,n=>{let o=t.app.workspace.getActiveViewOfType(Ti.MarkdownView);if(n)return!!(!gCe()&&o&&o.editor);if(gCe())return new Ti.Notice("Quick command is not available in source mode."),!1;if(!o||!o.editor)return new Ti.Notice("No active editor found."),!1;let i=o.editor;if(!i.getSelection().trim())return new Ti.Notice("Please select some text first. Selected text is required for quick commands."),!1;Dbe(i);let u=i.getCursor("from").line,l=`\`\`\`${XH}
\`\`\`
`;return i.replaceRange(l,{line:u,ch:0}),!0}),dp(t,zr.CLEAR_LOCAL_COPILOT_INDEX,async()=>{try{await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().clearIndex(),new Ti.Notice("Cleared local Copilot semantic index.")}catch(n){ie("Error clearing semantic index:",n),new Ti.Notice("Failed to clear semantic index.")}}),dp(t,zr.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let o=await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().garbageCollectVectorStore();new Ti.Notice(`Garbage collection completed. Removed ${o} stale documents.`)}catch(n){ie("Error during garbage collection:",n),new Ti.Notice("Failed to garbage collect semantic index.")}}),dp(t,zr.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let{getSettings:n}=await Promise.resolve().then(()=>(_t(),_8));if(n().enableSemanticSearchV3){let a=await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().indexVaultToVectorStore(!1);new Ti.Notice(`Semantic search index refreshed with ${a} documents.`)}else new Ti.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(n){ie("Error building index:",n),new Ti.Notice("An error occurred while building the index.")}}),dp(t,zr.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let{getSettings:n}=await Promise.resolve().then(()=>(_t(),_8));if(n().enableSemanticSearchV3){let a=await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().indexVaultToVectorStore(!0);new Ti.Notice(`Semantic search index rebuilt with ${a} documents.`)}else new Ti.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(n){ie("Error rebuilding index:",n),new Ti.Notice("An error occurred while rebuilding the index.")}}),dp(t,zr.LOAD_COPILOT_CHAT_CONVERSATION,()=>{t.loadCopilotChatHistory()}),dp(t,zr.LIST_INDEXED_FILES,async()=>{try{let o=await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().getIndexedFiles(),{getMatchingPatterns:i,shouldIndexFile:a}=await Promise.resolve().then(()=>(Yp(),H3t)),{inclusions:s,exclusions:u}=i(),l=t.app.vault.getMarkdownFiles(),c=new Set,d=new Set,f=new Set,p=new Set(o);for(let S of l){if(!a(S,s,u)){f.add(S.path);continue}let C=await t.app.vault.cachedRead(S);!C||C.trim().length===0?c.add(S.path):p.has(S.path)||d.add(S.path)}let m=["# Copilot Files Status",`- Indexed files: ${p.size}`,`- Unindexed files: ${d.size}`,`- Empty files: ${c.size}`,`- Excluded files: ${f.size}`,"","## Indexed Files",...p.size>0?Array.from(p).sort().map(S=>`- [[${S}]]`):["No indexed files found."],"","## Unindexed Files",...d.size>0?Array.from(d).sort().map(S=>`- [[${S}]]`):["No unindexed files found."],"","## Empty Files",...c.size>0?Array.from(c).sort().map(S=>`- [[${S}]]`):["No empty files found."],"","## Excluded Files (based on settings)",...f.size>0?Array.from(f).sort().map(S=>`- [[${S}]]`):["No excluded files."]].join(`
`),h=`Copilot-Indexed-Files-${new Date().toLocaleDateString().replace(/\//g,"-")}.md`,y="copilot",g=`${y}/${h}`;await Mm(y);let _=t.app.vault.getAbstractFileByPath(g);_?await t.app.vault.modify(_,m):await t.app.vault.create(g,m);let w=t.app.vault.getAbstractFileByPath(g);w&&(await t.app.workspace.getLeaf().openFile(w),new Ti.Notice(`Listed ${p.size} indexed files`))}catch(n){ie("Error listing indexed files:",n),new Ti.Notice("Failed to list indexed files.")}}),dp(t,zr.CLEAR_COPILOT_CACHE,async()=>{try{await t.fileParserManager.clearPDFCache(),await S_.getInstance().clearAllCache(),await v4.getInstance().clear();let{AutocompleteCache:o}=await Promise.resolve().then(()=>(d8e(),Vor));o.getInstance().clear(),new Ti.Notice("All Copilot caches cleared successfully")}catch(n){ie("Error clearing Copilot caches:",n),new Ti.Notice("Failed to clear Copilot caches")}}),dp(t,zr.OPEN_LOG_FILE,async()=>{try{await Nf.openLogFile()}catch(n){ie("Error creating Copilot log file:",n),new Ti.Notice("Failed to create Copilot log file.")}}),dp(t,zr.CLEAR_LOG_FILE,async()=>{try{await Nf.clear(),new Ti.Notice("Copilot log cleared.")}catch(n){ie("Error clearing Copilot log file:",n),new Ti.Notice("Failed to clear Copilot log file.")}}),dp(t,zr.TOGGLE_AUTOCOMPLETE,()=>{let o=!ne().enableAutocomplete;Xe("enableAutocomplete",o),new Ti.Notice(`Copilot autocomplete ${o?"enabled":"disabled"}`)}),kir(t,zr.ADD_SELECTION_TO_CHAT_CONTEXT,async n=>{let o=ry();if(o!=="copilot_plus"&&o!=="project"){new Ti.Notice("Selected text context is only available in Copilot Plus and Project modes");return}let i=n.getSelection();if(!i){new Ti.Notice("No text selected");return}let a=t.app.workspace.getActiveFile();if(!a){new Ti.Notice("No active file");return}let s=n.listSelections()[0];if(!s){new Ti.Notice("Could not determine selection range");return}let u=s.anchor.line+1,l=s.head.line+1,c={id:mm(),content:i,noteTitle:a.basename,notePath:a.path,startLine:Math.min(u,l),endLine:Math.max(u,l)};jtt(c),t.activateView()}),dp(t,zr.ADD_CUSTOM_COMMAND,async()=>{let n=cp(),o={...HO};new Q1(t.app,n,o,async a=>{await Ac.getInstance().createCommand(a)}).open()}),dp(t,zr.APPLY_CUSTOM_COMMAND,()=>{new Lbe(t.app).open()})}la();xu();xu();la();function kbe(){let[t]=Dp(),[e]=Wee(),[r]=Kee();return(()=>{if(t!=="project")return"initial";let{total:o,success:i,failed:a,processingFiles:s}=r;return e||s.length>0?"loading":a.length>0?"error":o.length>0&&i.length===o.length?"success":"initial"})()}$t();la();yG();xu();Un();var $ir=require("obsidian"),h$=j(Z()),Bir=j(Bc());function J2n({content:t,onConfirm:e,onCancel:r,confirmButtonText:n,cancelButtonText:o}){return h$.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-5"},h$.default.createElement("div",{className:"tw-whitespace-pre-wrap"},t),h$.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},o&&h$.default.createElement(me,{variant:"secondary",onClick:r},o),n&&h$.default.createElement(me,{variant:"default",onClick:e},n)))}var Yl=class extends $ir.Modal{constructor(r,n,o,i,a="Continue",s="Cancel"){super(r);this.onConfirm=n;this.content=o;this.confirmButtonText=a;this.cancelButtonText=s;this.setTitle(i)}onOpen(){let{contentEl:r}=this;this.root=(0,Bir.createRoot)(r);let n=()=>{this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(h$.default.createElement(J2n,{content:this.content,onConfirm:n,onCancel:o,confirmButtonText:this.confirmButtonText,cancelButtonText:this.cancelButtonText}))}onClose(){this.root.unmount()}};Un();var ua=j(Z());var Ic=j(Z(),1);function aY(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Z2n=j(Z(),1);function zir(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function $be(...t){return e=>{let r=!1,n=t.map(o=>{let i=zir(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():zir(t[o],null)}}}}var Uir=j(Z(),1),t4n=j(qa(),1);var sf=j(Z(),1);var nV=j(at(),1),U8e=sf.forwardRef((t,e)=>{let{children:r,...n}=t,o=sf.Children.toArray(r),i=o.find(X2n);if(i){let a=i.props.children,s=o.map(u=>u===i?sf.Children.count(a)>1?sf.Children.only(null):sf.isValidElement(a)?a.props.children:null:u);return(0,nV.jsx)(z8e,{...n,ref:e,children:sf.isValidElement(a)?sf.cloneElement(a,void 0,s):null})}return(0,nV.jsx)(z8e,{...n,ref:e,children:r})});U8e.displayName="Slot";var z8e=sf.forwardRef((t,e)=>{let{children:r,...n}=t;if(sf.isValidElement(r)){let o=e4n(r);return sf.cloneElement(r,{...Q2n(n,r.props),ref:e?$be(e,o):o})}return sf.Children.count(r)>1?sf.Children.only(null):null});z8e.displayName="SlotClone";var Y2n=({children:t})=>(0,nV.jsx)(nV.Fragment,{children:t});function X2n(t){return sf.isValidElement(t)&&t.type===Y2n}function Q2n(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function e4n(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var qir=j(at(),1),r4n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Hir=r4n.reduce((t,e)=>{let r=Uir.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?U8e:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,qir.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var Yt=j(Z(),1);function ga(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var rN=j(Z(),1);var Wir=j(Z(),1);function Vir(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function sY(...t){return e=>{let r=!1,n=t.map(o=>{let i=Vir(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():Vir(t[o],null)}}}}function uf(...t){return Wir.useCallback(sY(...t),t)}var lf=j(Z(),1);var oV=j(at(),1),tN=lf.forwardRef((t,e)=>{let{children:r,...n}=t,o=lf.Children.toArray(r),i=o.find(o4n);if(i){let a=i.props.children,s=o.map(u=>u===i?lf.Children.count(a)>1?lf.Children.only(null):lf.isValidElement(a)?a.props.children:null:u);return(0,oV.jsx)(q8e,{...n,ref:e,children:lf.isValidElement(a)?lf.cloneElement(a,void 0,s):null})}return(0,oV.jsx)(q8e,{...n,ref:e,children:r})});tN.displayName="Slot";var q8e=lf.forwardRef((t,e)=>{let{children:r,...n}=t;if(lf.isValidElement(r)){let o=a4n(r);return lf.cloneElement(r,{...i4n(n,r.props),ref:e?sY(e,o):o})}return lf.Children.count(r)>1?lf.Children.only(null):null});q8e.displayName="SlotClone";var n4n=({children:t})=>(0,oV.jsx)(oV.Fragment,{children:t});function o4n(t){return lf.isValidElement(t)&&t.type===n4n}function i4n(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function a4n(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Bbe=j(at(),1);function Kir(t){let e=t+"CollectionProvider",[r,n]=ts(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,y=rN.default.useRef(null),g=rN.default.useRef(new Map).current;return(0,Bbe.jsx)(o,{scope:m,itemMap:g,collectionRef:y,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=rN.default.forwardRef((p,m)=>{let{scope:h,children:y}=p,g=i(s,h),_=uf(m,g.collectionRef);return(0,Bbe.jsx)(tN,{ref:_,children:y})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=rN.default.forwardRef((p,m)=>{let{scope:h,children:y,...g}=p,_=rN.default.useRef(null),w=uf(m,_),S=i(l,h);return rN.default.useEffect(()=>(S.itemMap.set(_,{ref:_,...g}),()=>void S.itemMap.delete(_))),(0,Bbe.jsx)(tN,{[c]:"",ref:w,children:y})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return rN.default.useCallback(()=>{let y=m.collectionRef.current;if(!y)return[];let g=Array.from(y.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((S,C)=>g.indexOf(S.ref.current)-g.indexOf(C.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var zbe=j(Z(),1),s4n=j(at(),1),u4n=zbe.createContext(void 0);function iV(t){let e=zbe.useContext(u4n);return t||e||"ltr"}var Os=j(Z(),1);var Gir=j(Z(),1),Jir=j(qa(),1);var Zir=j(at(),1),l4n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],dd=l4n.reduce((t,e)=>{let r=Gir.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?tN:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Zir.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Ube(t,e){t&&Jir.flushSync(()=>t.dispatchEvent(e))}var Yir=j(Z(),1);function nN(t,e=globalThis?.document){let r=un(t);Yir.useEffect(()=>{let n=o=>{o.key==="Escape"&&r(o)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var V8e=j(at(),1),c4n="DismissableLayer",H8e="dismissableLayer.update",d4n="dismissableLayer.pointerDownOutside",f4n="dismissableLayer.focusOutside",Xir,ear=Os.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),W8e=Os.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Os.useContext(ear),[c,d]=Os.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Os.useState({}),m=uf(e,P=>d(P)),h=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(y),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=g,C=h4n(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=g4n(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return nN(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Os.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Xir=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),Qir(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Xir)}},[c,f,r,l]),Os.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),Qir())},[c,l]),Os.useEffect(()=>{let P=()=>p({});return document.addEventListener(H8e,P),()=>document.removeEventListener(H8e,P)},[]),(0,V8e.jsx)(dd.div,{...u,ref:m,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:ga(t.onFocusCapture,E.onFocusCapture),onBlurCapture:ga(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:ga(t.onPointerDownCapture,C.onPointerDownCapture)})});W8e.displayName=c4n;var p4n="DismissableLayerBranch",m4n=Os.forwardRef((t,e)=>{let r=Os.useContext(ear),n=Os.useRef(null),o=uf(e,n);return Os.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,V8e.jsx)(dd.div,{...t,ref:o})});m4n.displayName=p4n;function h4n(t,e=globalThis?.document){let r=un(t),n=Os.useRef(!1),o=Os.useRef(()=>{});return Os.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){tar(d4n,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function g4n(t,e=globalThis?.document){let r=un(t),n=Os.useRef(!1);return Os.useEffect(()=>{let o=i=>{i.target&&!n.current&&tar(f4n,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Qir(){let t=new CustomEvent(H8e);document.dispatchEvent(t)}function tar(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?Ube(o,i):o.dispatchEvent(i)}var nar=j(Z(),1),K8e=0;function oN(){nar.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??rar()),document.body.insertAdjacentElement("beforeend",t[1]??rar()),K8e++,()=>{K8e===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),K8e--}},[])}function rar(){let t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var pb=j(Z(),1);var uar=j(at(),1),G8e="focusScope.autoFocusOnMount",J8e="focusScope.autoFocusOnUnmount",oar={bubbles:!1,cancelable:!0},y4n="FocusScope",Z8e=pb.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=pb.useState(null),l=un(o),c=un(i),d=pb.useRef(null),f=uf(e,h=>u(h)),p=pb.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;pb.useEffect(()=>{if(n){let _=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:iN(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||iN(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let T of E)T.removedNodes.length>0&&iN(s)};var h=_,y=w,g=S;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(S);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),pb.useEffect(()=>{if(s){aar.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(G8e,oar);s.addEventListener(G8e,l),s.dispatchEvent(g),g.defaultPrevented||(b4n(S4n(lar(s)),{select:!0}),document.activeElement===h&&iN(s))}return()=>{s.removeEventListener(G8e,l),setTimeout(()=>{let g=new CustomEvent(J8e,oar);s.addEventListener(J8e,c),s.dispatchEvent(g),g.defaultPrevented||iN(h??document.body,{select:!0}),s.removeEventListener(J8e,c),aar.remove(p)},0)}}},[s,l,c,p]);let m=pb.useCallback(h=>{if(!r&&!n||p.paused)return;let y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(y&&g){let _=h.currentTarget,[w,S]=_4n(_);w&&S?!h.shiftKey&&g===S?(h.preventDefault(),r&&iN(w,{select:!0})):h.shiftKey&&g===w&&(h.preventDefault(),r&&iN(S,{select:!0})):g===_&&h.preventDefault()}},[r,n,p.paused]);return(0,uar.jsx)(dd.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});Z8e.displayName=y4n;function b4n(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(iN(n,{select:e}),document.activeElement!==r)return}function _4n(t){let e=lar(t),r=iar(e,t),n=iar(e.reverse(),t);return[r,n]}function lar(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{let o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function iar(t,e){for(let r of t)if(!v4n(r,{upTo:e}))return r}function v4n(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function w4n(t){return t instanceof HTMLInputElement&&"select"in t}function iN(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&w4n(t)&&e&&t.select()}}var aar=x4n();function x4n(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=sar(t,e),t.unshift(e)},remove(e){t=sar(t,e),t[0]?.resume()}}}function sar(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function S4n(t){return t.filter(e=>e.tagName!=="A")}var qbe=j(Z(),1);var C4n=qbe.useId||(()=>{}),O4n=0;function Xl(t){let[e,r]=qbe.useState(C4n());return vo(()=>{t||r(n=>n??String(O4n++))},[t]),t||(e?`radix-${e}`:"")}var Pg=j(Z(),1);var car=["top","right","bottom","left"];var WO=Math.min,am=Math.max,lY=Math.round,cY=Math.floor,rv=t=>({x:t,y:t}),E4n={left:"right",right:"left",bottom:"top",top:"bottom"},P4n={start:"end",end:"start"};function Vbe(t,e,r){return am(t,WO(e,r))}function KO(t,e){return typeof t=="function"?t(e):t}function GO(t){return t.split("-")[0]}function g$(t){return t.split("-")[1]}function Wbe(t){return t==="x"?"y":"x"}function Kbe(t){return t==="y"?"height":"width"}function dA(t){return["top","bottom"].includes(GO(t))?"y":"x"}function Gbe(t){return Wbe(dA(t))}function dar(t,e,r){r===void 0&&(r=!1);let n=g$(t),o=Gbe(t),i=Kbe(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=uY(a)),[a,uY(a)]}function far(t){let e=uY(t);return[Hbe(t),e,Hbe(e)]}function Hbe(t){return t.replace(/start|end/g,e=>P4n[e])}function T4n(t,e,r){let n=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(t){case"top":case"bottom":return r?e?o:n:e?n:o;case"left":case"right":return e?i:a;default:return[]}}function par(t,e,r,n){let o=g$(t),i=T4n(GO(t),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),e&&(i=i.concat(i.map(Hbe)))),i}function uY(t){return t.replace(/left|right|bottom|top/g,e=>E4n[e])}function A4n(t){return{top:0,right:0,bottom:0,left:0,...t}}function Y8e(t){return typeof t!="number"?A4n(t):{top:t,right:t,bottom:t,left:t}}function y$(t){let{x:e,y:r,width:n,height:o}=t;return{width:n,height:o,top:r,left:e,right:e+n,bottom:r+o,x:e,y:r}}function mar(t,e,r){let{reference:n,floating:o}=t,i=dA(e),a=Gbe(e),s=Kbe(a),u=GO(e),l=i==="y",c=n.x+n.width/2-o.width/2,d=n.y+n.height/2-o.height/2,f=n[s]/2-o[s]/2,p;switch(u){case"top":p={x:c,y:n.y-o.height};break;case"bottom":p={x:c,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:d};break;case"left":p={x:n.x-o.width,y:d};break;default:p={x:n.x,y:n.y}}switch(g$(e)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var yar=async(t,e,r)=>{let{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:a}=r,s=i.filter(Boolean),u=await(a.isRTL==null?void 0:a.isRTL(e)),l=await a.getElementRects({reference:t,floating:e,strategy:o}),{x:c,y:d}=mar(l,n,u),f=n,p={},m=0;for(let h=0;h<s.length;h++){let{name:y,fn:g}=s[h],{x:_,y:w,data:S,reset:C}=await g({x:c,y:d,initialPlacement:n,placement:f,strategy:o,middlewareData:p,rects:l,platform:a,elements:{reference:t,floating:e}});c=_??c,d=w??d,p={...p,[y]:{...p[y],...S}},C&&m<=50&&(m++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(l=C.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:o}):C.rects),{x:c,y:d}=mar(l,f,u)),h=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}};async function aV(t,e){var r;e===void 0&&(e={});let{x:n,y:o,platform:i,rects:a,elements:s,strategy:u}=t,{boundary:l="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=KO(e,t),m=Y8e(p),y=s[f?d==="floating"?"reference":"floating":d],g=y$(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(y)))==null||r?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:l,rootBoundary:c,strategy:u})),_=d==="floating"?{x:n,y:o,width:a.floating.width,height:a.floating.height}:a.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),S=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},C=y$(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:_,offsetParent:w,strategy:u}):_);return{top:(g.top-C.top+m.top)/S.y,bottom:(C.bottom-g.bottom+m.bottom)/S.y,left:(g.left-C.left+m.left)/S.x,right:(C.right-g.right+m.right)/S.x}}var bar=t=>({name:"arrow",options:t,async fn(e){let{x:r,y:n,placement:o,rects:i,platform:a,elements:s,middlewareData:u}=e,{element:l,padding:c=0}=KO(t,e)||{};if(l==null)return{};let d=Y8e(c),f={x:r,y:n},p=Gbe(o),m=Kbe(p),h=await a.getDimensions(l),y=p==="y",g=y?"top":"left",_=y?"bottom":"right",w=y?"clientHeight":"clientWidth",S=i.reference[m]+i.reference[p]-f[p]-i.floating[m],C=f[p]-i.reference[p],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l)),P=E?E[w]:0;(!P||!await(a.isElement==null?void 0:a.isElement(E)))&&(P=s.floating[w]||i.floating[m]);let T=S/2-C/2,I=P/2-h[m]/2-1,N=WO(d[g],I),M=WO(d[_],I),D=N,k=P-h[m]-M,L=P/2-h[m]/2+T,H=Vbe(D,L,k),K=!u.arrow&&g$(o)!=null&&L!==H&&i.reference[m]/2-(L<D?N:M)-h[m]/2<0,G=K?L<D?L-D:L-k:0;return{[p]:f[p]+G,data:{[p]:H,centerOffset:L-H-G,...K&&{alignmentOffset:G}},reset:K}}});var _ar=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,n;let{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:u,elements:l}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...y}=KO(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};let g=GO(o),_=dA(s),w=GO(s)===s,S=await(u.isRTL==null?void 0:u.isRTL(l.floating)),C=f||(w||!h?[uY(s)]:far(s)),E=m!=="none";!f&&E&&C.push(...par(s,h,m,S));let P=[s,...C],T=await aV(e,y),I=[],N=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&I.push(T[g]),d){let L=dar(o,a,S);I.push(T[L[0]],T[L[1]])}if(N=[...N,{placement:o,overflows:I}],!I.every(L=>L<=0)){var M,D;let L=(((M=i.flip)==null?void 0:M.index)||0)+1,H=P[L];if(H)return{data:{index:L,overflows:N},reset:{placement:H}};let K=(D=N.filter(G=>G.overflows[0]<=0).sort((G,X)=>G.overflows[1]-X.overflows[1])[0])==null?void 0:D.placement;if(!K)switch(p){case"bestFit":{var k;let G=(k=N.filter(X=>{if(E){let F=dA(X.placement);return F===_||F==="y"}return!0}).map(X=>[X.placement,X.overflows.filter(F=>F>0).reduce((F,Q)=>F+Q,0)]).sort((X,F)=>X[1]-F[1])[0])==null?void 0:k[0];G&&(K=G);break}case"initialPlacement":K=s;break}if(o!==K)return{reset:{placement:K}}}return{}}}};function har(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function gar(t){return car.some(e=>t[e]>=0)}var war=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:r}=e,{strategy:n="referenceHidden",...o}=KO(t,e);switch(n){case"referenceHidden":{let i=await aV(e,{...o,elementContext:"reference"}),a=har(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:gar(a)}}}case"escaped":{let i=await aV(e,{...o,altBoundary:!0}),a=har(i,r.floating);return{data:{escapedOffsets:a,escaped:gar(a)}}}default:return{}}}}};async function I4n(t,e){let{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=GO(r),s=g$(r),u=dA(r)==="y",l=["left","top"].includes(a)?-1:1,c=i&&u?-1:1,d=KO(e,t),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m=="number"&&(p=s==="end"?m*-1:m),u?{x:p*c,y:f*l}:{x:f*l,y:p*c}}var xar=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;let{x:o,y:i,placement:a,middlewareData:s}=e,u=await I4n(e,t);return a===((r=s.offset)==null?void 0:r.placement)&&(n=s.arrow)!=null&&n.alignmentOffset?{}:{x:o+u.x,y:i+u.y,data:{...u,placement:a}}}}},Sar=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:r,y:n,placement:o}=e,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:y=>{let{x:g,y:_}=y;return{x:g,y:_}}},...u}=KO(t,e),l={x:r,y:n},c=await aV(e,u),d=dA(GO(o)),f=Wbe(d),p=l[f],m=l[d];if(i){let y=f==="y"?"top":"left",g=f==="y"?"bottom":"right",_=p+c[y],w=p-c[g];p=Vbe(_,p,w)}if(a){let y=d==="y"?"top":"left",g=d==="y"?"bottom":"right",_=m+c[y],w=m-c[g];m=Vbe(_,m,w)}let h=s.fn({...e,[f]:p,[d]:m});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:i,[d]:a}}}}}},Car=function(t){return t===void 0&&(t={}),{options:t,fn(e){let{x:r,y:n,placement:o,rects:i,middlewareData:a}=e,{offset:s=0,mainAxis:u=!0,crossAxis:l=!0}=KO(t,e),c={x:r,y:n},d=dA(o),f=Wbe(d),p=c[f],m=c[d],h=KO(s,e),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){let w=f==="y"?"height":"width",S=i.reference[f]-i.floating[w]+y.mainAxis,C=i.reference[f]+i.reference[w]-y.mainAxis;p<S?p=S:p>C&&(p=C)}if(l){var g,_;let w=f==="y"?"width":"height",S=["top","left"].includes(GO(o)),C=i.reference[d]-i.floating[w]+(S&&((g=a.offset)==null?void 0:g[d])||0)+(S?0:y.crossAxis),E=i.reference[d]+i.reference[w]+(S?0:((_=a.offset)==null?void 0:_[d])||0)-(S?y.crossAxis:0);m<C?m=C:m>E&&(m=E)}return{[f]:p,[d]:m}}}},Oar=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,n;let{placement:o,rects:i,platform:a,elements:s}=e,{apply:u=()=>{},...l}=KO(t,e),c=await aV(e,l),d=GO(o),f=g$(o),p=dA(o)==="y",{width:m,height:h}=i.floating,y,g;d==="top"||d==="bottom"?(y=d,g=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(g=d,y=f==="end"?"top":"bottom");let _=h-c.top-c.bottom,w=m-c.left-c.right,S=WO(h-c[y],_),C=WO(m-c[g],w),E=!e.middlewareData.shift,P=S,T=C;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(T=w),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(P=_),E&&!f){let N=am(c.left,0),M=am(c.right,0),D=am(c.top,0),k=am(c.bottom,0);p?T=m-2*(N!==0||M!==0?N+M:am(c.left,c.right)):P=h-2*(D!==0||k!==0?D+k:am(c.top,c.bottom))}await u({...e,availableWidth:T,availableHeight:P});let I=await a.getDimensions(s.floating);return m!==I.width||h!==I.height?{reset:{rects:!0}}:{}}}};function Jbe(){return typeof window<"u"}function _$(t){return Par(t)?(t.nodeName||"").toLowerCase():"#document"}function vh(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function nv(t){var e;return(e=(Par(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Par(t){return Jbe()?t instanceof Node||t instanceof vh(t).Node:!1}function mb(t){return Jbe()?t instanceof Element||t instanceof vh(t).Element:!1}function ov(t){return Jbe()?t instanceof HTMLElement||t instanceof vh(t).HTMLElement:!1}function Ear(t){return!Jbe()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof vh(t).ShadowRoot}function sV(t){let{overflow:e,overflowX:r,overflowY:n,display:o}=hb(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(o)}function Tar(t){return["table","td","th"].includes(_$(t))}function dY(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Zbe(t){let e=Ybe(),r=mb(t)?hb(t):t;return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function Aar(t){let e=fA(t);for(;ov(e)&&!v$(e);){if(Zbe(e))return e;if(dY(e))return null;e=fA(e)}return null}function Ybe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function v$(t){return["html","body","#document"].includes(_$(t))}function hb(t){return vh(t).getComputedStyle(t)}function fY(t){return mb(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function fA(t){if(_$(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Ear(t)&&t.host||nv(t);return Ear(e)?e.host:e}function Iar(t){let e=fA(t);return v$(e)?t.ownerDocument?t.ownerDocument.body:t.body:ov(e)&&sV(e)?e:Iar(e)}function b$(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);let o=Iar(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),a=vh(o);if(i){let s=Xbe(a);return e.concat(a,a.visualViewport||[],sV(o)?o:[],s&&r?b$(s):[])}return e.concat(o,b$(o,[],r))}function Xbe(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Nar(t){let e=hb(t),r=parseFloat(e.width)||0,n=parseFloat(e.height)||0,o=ov(t),i=o?t.offsetWidth:r,a=o?t.offsetHeight:n,s=lY(r)!==i||lY(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function Q8e(t){return mb(t)?t:t.contextElement}function uV(t){let e=Q8e(t);if(!ov(e))return rv(1);let r=e.getBoundingClientRect(),{width:n,height:o,$:i}=Nar(e),a=(i?lY(r.width):r.width)/n,s=(i?lY(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var M4n=rv(0);function jar(t){let e=vh(t);return!Ybe()||!e.visualViewport?M4n:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function R4n(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==vh(t)?!1:e}function w$(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);let o=t.getBoundingClientRect(),i=Q8e(t),a=rv(1);e&&(n?mb(n)&&(a=uV(n)):a=uV(t));let s=R4n(i,r,n)?jar(i):rv(0),u=(o.left+s.x)/a.x,l=(o.top+s.y)/a.y,c=o.width/a.x,d=o.height/a.y;if(i){let f=vh(i),p=n&&mb(n)?vh(n):n,m=f,h=Xbe(m);for(;h&&n&&p!==m;){let y=uV(h),g=h.getBoundingClientRect(),_=hb(h),w=g.left+(h.clientLeft+parseFloat(_.paddingLeft))*y.x,S=g.top+(h.clientTop+parseFloat(_.paddingTop))*y.y;u*=y.x,l*=y.y,c*=y.x,d*=y.y,u+=w,l+=S,m=vh(h),h=Xbe(m)}}return y$({width:c,height:d,x:u,y:l})}function e5e(t,e){let r=fY(t).scrollLeft;return e?e.left+r:w$(nv(t)).left+r}function Dar(t,e,r){r===void 0&&(r=!1);let n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-(r?0:e5e(t,n)),i=n.top+e.scrollTop;return{x:o,y:i}}function N4n(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t,i=o==="fixed",a=nv(n),s=e?dY(e.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=rv(1),c=rv(0),d=ov(n);if((d||!d&&!i)&&((_$(n)!=="body"||sV(a))&&(u=fY(n)),ov(n))){let p=w$(n);l=uV(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?Dar(a,u,!0):rv(0);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-u.scrollLeft*l.x+c.x+f.x,y:r.y*l.y-u.scrollTop*l.y+c.y+f.y}}function j4n(t){return Array.from(t.getClientRects())}function D4n(t){let e=nv(t),r=fY(t),n=t.ownerDocument.body,o=am(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=am(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+e5e(t),s=-r.scrollTop;return hb(n).direction==="rtl"&&(a+=am(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}function L4n(t,e){let r=vh(t),n=nv(t),o=r.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,u=0;if(o){i=o.width,a=o.height;let l=Ybe();(!l||l&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}return{width:i,height:a,x:s,y:u}}function F4n(t,e){let r=w$(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=ov(t)?uV(t):rv(1),a=t.clientWidth*i.x,s=t.clientHeight*i.y,u=o*i.x,l=n*i.y;return{width:a,height:s,x:u,y:l}}function Mar(t,e,r){let n;if(e==="viewport")n=L4n(t,r);else if(e==="document")n=D4n(nv(t));else if(mb(e))n=F4n(e,r);else{let o=jar(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return y$(n)}function Lar(t,e){let r=fA(t);return r===e||!mb(r)||v$(r)?!1:hb(r).position==="fixed"||Lar(r,e)}function k4n(t,e){let r=e.get(t);if(r)return r;let n=b$(t,[],!1).filter(s=>mb(s)&&_$(s)!=="body"),o=null,i=hb(t).position==="fixed",a=i?fA(t):t;for(;mb(a)&&!v$(a);){let s=hb(a),u=Zbe(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||sV(a)&&!u&&Lar(t,a))?n=n.filter(c=>c!==a):o=s,a=fA(a)}return e.set(t,n),n}function $4n(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t,a=[...r==="clippingAncestors"?dY(e)?[]:k4n(e,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=Mar(e,c,o);return l.top=am(d.top,l.top),l.right=WO(d.right,l.right),l.bottom=WO(d.bottom,l.bottom),l.left=am(d.left,l.left),l},Mar(e,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function B4n(t){let{width:e,height:r}=Nar(t);return{width:e,height:r}}function z4n(t,e,r){let n=ov(e),o=nv(e),i=r==="fixed",a=w$(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=rv(0);if(n||!n&&!i)if((_$(e)!=="body"||sV(o))&&(s=fY(e)),n){let f=w$(e,!0,i,e);u.x=f.x+e.clientLeft,u.y=f.y+e.clientTop}else o&&(u.x=e5e(o));let l=o&&!n&&!i?Dar(o,s):rv(0),c=a.left+s.scrollLeft-u.x-l.x,d=a.top+s.scrollTop-u.y-l.y;return{x:c,y:d,width:a.width,height:a.height}}function X8e(t){return hb(t).position==="static"}function Rar(t,e){if(!ov(t)||hb(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return nv(t)===r&&(r=r.ownerDocument.body),r}function Far(t,e){let r=vh(t);if(dY(t))return r;if(!ov(t)){let o=fA(t);for(;o&&!v$(o);){if(mb(o)&&!X8e(o))return o;o=fA(o)}return r}let n=Rar(t,e);for(;n&&Tar(n)&&X8e(n);)n=Rar(n,e);return n&&v$(n)&&X8e(n)&&!Zbe(n)?r:n||Aar(t)||r}var U4n=async function(t){let e=this.getOffsetParent||Far,r=this.getDimensions,n=await r(t.floating);return{reference:z4n(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function q4n(t){return hb(t).direction==="rtl"}var kar={convertOffsetParentRelativeRectToViewportRelativeRect:N4n,getDocumentElement:nv,getClippingRect:$4n,getOffsetParent:Far,getElementRects:U4n,getClientRects:j4n,getDimensions:B4n,getScale:uV,isElement:mb,isRTL:q4n};function H4n(t,e){let r=null,n,o=nv(t);function i(){var s;clearTimeout(n),(s=r)==null||s.disconnect(),r=null}function a(s,u){s===void 0&&(s=!1),u===void 0&&(u=1),i();let{left:l,top:c,width:d,height:f}=t.getBoundingClientRect();if(s||e(),!d||!f)return;let p=cY(c),m=cY(o.clientWidth-(l+d)),h=cY(o.clientHeight-(c+f)),y=cY(l),_={rootMargin:-p+"px "+-m+"px "+-h+"px "+-y+"px",threshold:am(0,WO(1,u))||1},w=!0;function S(C){let E=C[0].intersectionRatio;if(E!==u){if(!w)return a();E?a(!1,E):n=setTimeout(()=>{a(!1,1e-7)},1e3)}w=!1}try{r=new IntersectionObserver(S,{..._,root:o.ownerDocument})}catch{r=new IntersectionObserver(S,_)}r.observe(t)}return a(!0),i}function pA(t,e,r,n){n===void 0&&(n={});let{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:u=!1}=n,l=Q8e(t),c=o||i?[...l?b$(l):[],...b$(e)]:[];c.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),i&&g.addEventListener("resize",r)});let d=l&&s?H4n(l,r):null,f=-1,p=null;a&&(p=new ResizeObserver(g=>{let[_]=g;_&&_.target===l&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(e)})),r()}),l&&!u&&p.observe(l),p.observe(e));let m,h=u?w$(t):null;u&&y();function y(){let g=w$(t);h&&(g.x!==h.x||g.y!==h.y||g.width!==h.width||g.height!==h.height)&&r(),h=g,m=requestAnimationFrame(y)}return r(),()=>{var g;c.forEach(_=>{o&&_.removeEventListener("scroll",r),i&&_.removeEventListener("resize",r)}),d?.(),(g=p)==null||g.disconnect(),p=null,u&&cancelAnimationFrame(m)}}var $ar=xar;var Bar=Sar,zar=_ar,Uar=Oar,qar=war,t5e=bar;var Har=Car,r5e=(t,e,r)=>{let n=new Map,o={platform:kar,...r},i={...o.platform,_c:n};return yar(t,e,{...o,platform:i})};var Ql=j(Z(),1),t_e=j(Z(),1),War=j(qa(),1),Qbe=typeof document<"u"?t_e.useLayoutEffect:t_e.useEffect;function e_e(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!e_e(t[n],e[n]))return!1;return!0}if(o=Object.keys(t),r=o.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,o[n]))return!1;for(n=r;n--!==0;){let i=o[n];if(!(i==="_owner"&&t.$$typeof)&&!e_e(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function Kar(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Var(t,e){let r=Kar(t);return Math.round(e*r)/r}function n5e(t){let e=Ql.useRef(t);return Qbe(()=>{e.current=t}),e}function aN(t){t===void 0&&(t={});let{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:i,floating:a}={},transform:s=!0,whileElementsMounted:u,open:l}=t,[c,d]=Ql.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=Ql.useState(n);e_e(f,n)||p(n);let[m,h]=Ql.useState(null),[y,g]=Ql.useState(null),_=Ql.useCallback(X=>{X!==E.current&&(E.current=X,h(X))},[]),w=Ql.useCallback(X=>{X!==P.current&&(P.current=X,g(X))},[]),S=i||m,C=a||y,E=Ql.useRef(null),P=Ql.useRef(null),T=Ql.useRef(c),I=u!=null,N=n5e(u),M=n5e(o),D=n5e(l),k=Ql.useCallback(()=>{if(!E.current||!P.current)return;let X={placement:e,strategy:r,middleware:f};M.current&&(X.platform=M.current),r5e(E.current,P.current,X).then(F=>{let Q={...F,isPositioned:D.current!==!1};L.current&&!e_e(T.current,Q)&&(T.current=Q,War.flushSync(()=>{d(Q)}))})},[f,e,r,M,D]);Qbe(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(X=>({...X,isPositioned:!1})))},[l]);let L=Ql.useRef(!1);Qbe(()=>(L.current=!0,()=>{L.current=!1}),[]),Qbe(()=>{if(S&&(E.current=S),C&&(P.current=C),S&&C){if(N.current)return N.current(S,C,k);k()}},[S,C,k,N,I]);let H=Ql.useMemo(()=>({reference:E,floating:P,setReference:_,setFloating:w}),[_,w]),K=Ql.useMemo(()=>({reference:S,floating:C}),[S,C]),G=Ql.useMemo(()=>{let X={position:r,left:0,top:0};if(!K.floating)return X;let F=Var(K.floating,c.x),Q=Var(K.floating,c.y);return s?{...X,transform:"translate("+F+"px, "+Q+"px)",...Kar(K.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:F,top:Q}},[r,s,K.floating,c.x,c.y]);return Ql.useMemo(()=>({...c,update:k,refs:H,elements:K,floatingStyles:G}),[c,k,H,K,G])}var V4n=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){let{element:n,padding:o}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?t5e({element:n.current,padding:o}).fn(r):{}:n?t5e({element:n,padding:o}).fn(r):{}}}},sN=(t,e)=>({...$ar(t),options:[t,e]}),uN=(t,e)=>({...Bar(t),options:[t,e]}),lN=(t,e)=>({...Har(t),options:[t,e]}),cN=(t,e)=>({...zar(t),options:[t,e]}),dN=(t,e)=>({...Uar(t),options:[t,e]});var fN=(t,e)=>({...qar(t),options:[t,e]});var pN=(t,e)=>({...V4n(t),options:[t,e]});var Gar=j(Z(),1);var o5e=j(at(),1),W4n="Arrow",Jar=Gar.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,o5e.jsx)(dd.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,o5e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Jar.displayName=W4n;var Zar=Jar;var mN=j(at(),1);var i5e="Popper",[Yar,a5e]=ts(i5e),[G4n,Xar]=Yar(i5e),Qar=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Pg.useState(null);return(0,mN.jsx)(G4n,{scope:e,anchor:n,onAnchorChange:o,children:r})};Qar.displayName=i5e;var esr="PopperAnchor",tsr=Pg.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=Xar(esr,r),a=Pg.useRef(null),s=uf(e,a);return Pg.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,mN.jsx)(dd.div,{...o,ref:s})});tsr.displayName=esr;var s5e="PopperContent",[J4n,Z4n]=Yar(s5e),rsr=Pg.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,y=Xar(s5e,r),[g,_]=Pg.useState(null),w=uf(e,J=>_(J)),[S,C]=Pg.useState(null),E=J1(S),P=E?.width??0,T=E?.height??0,I=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},M=Array.isArray(l)?l:[l],D=M.length>0,k={padding:N,boundary:M.filter(X4n),altBoundary:D},{refs:L,floatingStyles:H,placement:K,isPositioned:G,middlewareData:X}=aN({strategy:"fixed",placement:I,whileElementsMounted:(...J)=>pA(...J,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[sN({mainAxis:o+T,alignmentAxis:a}),u&&uN({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?lN():void 0,...k}),u&&cN({...k}),dN({...k,apply:({elements:J,rects:se,availableWidth:be,availableHeight:ce})=>{let{width:pe,height:Me}=se.reference,Ue=J.floating.style;Ue.setProperty("--radix-popper-available-width",`${be}px`),Ue.setProperty("--radix-popper-available-height",`${ce}px`),Ue.setProperty("--radix-popper-anchor-width",`${pe}px`),Ue.setProperty("--radix-popper-anchor-height",`${Me}px`)}}),S&&pN({element:S,padding:s}),Q4n({arrowWidth:P,arrowHeight:T}),f&&fN({strategy:"referenceHidden",...k})]}),[F,Q]=isr(K),ee=un(m);vo(()=>{G&&ee?.()},[G,ee]);let U=X.arrow?.x,z=X.arrow?.y,V=X.arrow?.centerOffset!==0,[q,W]=Pg.useState();return vo(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,mN.jsx)("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:G?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:q,"--radix-popper-transform-origin":[X.transformOrigin?.x,X.transformOrigin?.y].join(" "),...X.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,mN.jsx)(J4n,{scope:r,placedSide:F,onArrowChange:C,arrowX:U,arrowY:z,shouldHideArrow:V,children:(0,mN.jsx)(dd.div,{"data-side":F,"data-align":Q,...h,ref:w,style:{...h.style,animation:G?void 0:"none"}})})})});rsr.displayName=s5e;var nsr="PopperArrow",Y4n={top:"bottom",right:"left",bottom:"top",left:"right"},osr=Pg.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=Z4n(nsr,n),a=Y4n[i.placedSide];return(0,mN.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,mN.jsx)(Zar,{...o,ref:r,style:{...o.style,display:"block"}})})});osr.displayName=nsr;function X4n(t){return t!==null}var Q4n=t=>({name:"transformOrigin",options:t,fn(e){let{placement:r,rects:n,middlewareData:o}=e,a=o.arrow?.centerOffset!==0,s=a?0:t.arrowWidth,u=a?0:t.arrowHeight,[l,c]=isr(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function isr(t){let[e,r="center"]=t.split("-");return[e,r]}var u5e=Qar,asr=tsr,ssr=rsr,usr=osr;var r_e=j(Z(),1),lsr=j(qa(),1);var csr=j(at(),1),t3n="Portal",l5e=r_e.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=r_e.useState(!1);vo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?lsr.default.createPortal((0,csr.jsx)(dd.div,{...n,ref:e}),a):null});l5e.displayName=t3n;var fd=j(Z(),1);function x$(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var hN=j(Z(),1);var fsr=j(Z(),1);function dsr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function c5e(...t){return e=>{let r=!1,n=t.map(o=>{let i=dsr(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():dsr(t[o],null)}}}}function pY(...t){return fsr.useCallback(c5e(...t),t)}var cf=j(Z(),1);var lV=j(at(),1),cV=cf.forwardRef((t,e)=>{let{children:r,...n}=t,o=cf.Children.toArray(r),i=o.find(n3n);if(i){let a=i.props.children,s=o.map(u=>u===i?cf.Children.count(a)>1?cf.Children.only(null):cf.isValidElement(a)?a.props.children:null:u);return(0,lV.jsx)(d5e,{...n,ref:e,children:cf.isValidElement(a)?cf.cloneElement(a,void 0,s):null})}return(0,lV.jsx)(d5e,{...n,ref:e,children:r})});cV.displayName="Slot";var d5e=cf.forwardRef((t,e)=>{let{children:r,...n}=t;if(cf.isValidElement(r)){let o=i3n(r);return cf.cloneElement(r,{...o3n(n,r.props),ref:e?c5e(e,o):o})}return cf.Children.count(r)>1?cf.Children.only(null):null});d5e.displayName="SlotClone";var r3n=({children:t})=>(0,lV.jsx)(lV.Fragment,{children:t});function n3n(t){return cf.isValidElement(t)&&t.type===r3n}function o3n(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function i3n(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var n_e=j(at(),1);function psr(t){let e=t+"CollectionProvider",[r,n]=ts(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,y=hN.default.useRef(null),g=hN.default.useRef(new Map).current;return(0,n_e.jsx)(o,{scope:m,itemMap:g,collectionRef:y,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=hN.default.forwardRef((p,m)=>{let{scope:h,children:y}=p,g=i(s,h),_=pY(m,g.collectionRef);return(0,n_e.jsx)(cV,{ref:_,children:y})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=hN.default.forwardRef((p,m)=>{let{scope:h,children:y,...g}=p,_=hN.default.useRef(null),w=pY(m,_),S=i(l,h);return hN.default.useEffect(()=>(S.itemMap.set(_,{ref:_,...g}),()=>void S.itemMap.delete(_))),(0,n_e.jsx)(cV,{[c]:"",ref:w,children:y})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return hN.default.useCallback(()=>{let y=m.collectionRef.current;if(!y)return[];let g=Array.from(y.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((S,C)=>g.indexOf(S.ref.current)-g.indexOf(C.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var msr=j(Z(),1),a3n=j(qa(),1);var hsr=j(at(),1),s3n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],f5e=s3n.reduce((t,e)=>{let r=msr.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?cV:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,hsr.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var gN=j(at(),1),p5e="rovingFocusGroup.onEntryFocus",u3n={bubbles:!1,cancelable:!0},o_e="RovingFocusGroup",[m5e,gsr,l3n]=psr(o_e),[c3n,h5e]=ts(o_e,[l3n]),[d3n,f3n]=c3n(o_e),ysr=fd.forwardRef((t,e)=>(0,gN.jsx)(m5e.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,gN.jsx)(m5e.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,gN.jsx)(p3n,{...t,ref:e})})}));ysr.displayName=o_e;var p3n=fd.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:o=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:u,onEntryFocus:l,preventScrollOnEntryFocus:c=!1,...d}=t,f=fd.useRef(null),p=pY(e,f),m=iV(i),[h=null,y]=im({prop:a,defaultProp:s,onChange:u}),[g,_]=fd.useState(!1),w=un(l),S=gsr(r),C=fd.useRef(!1),[E,P]=fd.useState(0);return fd.useEffect(()=>{let T=f.current;if(T)return T.addEventListener(p5e,w),()=>T.removeEventListener(p5e,w)},[w]),(0,gN.jsx)(d3n,{scope:r,orientation:n,dir:m,loop:o,currentTabStopId:h,onItemFocus:fd.useCallback(T=>y(T),[y]),onItemShiftTab:fd.useCallback(()=>_(!0),[]),onFocusableItemAdd:fd.useCallback(()=>P(T=>T+1),[]),onFocusableItemRemove:fd.useCallback(()=>P(T=>T-1),[]),children:(0,gN.jsx)(f5e.div,{tabIndex:g||E===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...t.style},onMouseDown:x$(t.onMouseDown,()=>{C.current=!0}),onFocus:x$(t.onFocus,T=>{let I=!C.current;if(T.target===T.currentTarget&&I&&!g){let N=new CustomEvent(p5e,u3n);if(T.currentTarget.dispatchEvent(N),!N.defaultPrevented){let M=S().filter(K=>K.focusable),D=M.find(K=>K.active),k=M.find(K=>K.id===h),H=[D,k,...M].filter(Boolean).map(K=>K.ref.current);vsr(H,c)}}C.current=!1}),onBlur:x$(t.onBlur,()=>_(!1))})})}),bsr="RovingFocusGroupItem",_sr=fd.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,...a}=t,s=Xl(),u=i||s,l=f3n(bsr,r),c=l.currentTabStopId===u,d=gsr(r),{onFocusableItemAdd:f,onFocusableItemRemove:p}=l;return fd.useEffect(()=>{if(n)return f(),()=>p()},[n,f,p]),(0,gN.jsx)(m5e.ItemSlot,{scope:r,id:u,focusable:n,active:o,children:(0,gN.jsx)(f5e.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...a,ref:e,onMouseDown:x$(t.onMouseDown,m=>{n?l.onItemFocus(u):m.preventDefault()}),onFocus:x$(t.onFocus,()=>l.onItemFocus(u)),onKeyDown:x$(t.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){l.onItemShiftTab();return}if(m.target!==m.currentTarget)return;let h=g3n(m,l.orientation,l.dir);if(h!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let g=d().filter(_=>_.focusable).map(_=>_.ref.current);if(h==="last")g.reverse();else if(h==="prev"||h==="next"){h==="prev"&&g.reverse();let _=g.indexOf(m.currentTarget);g=l.loop?y3n(g,_+1):g.slice(_+1)}setTimeout(()=>vsr(g))}})})})});_sr.displayName=bsr;var m3n={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function h3n(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function g3n(t,e,r){let n=h3n(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return m3n[n]}function vsr(t,e=!1){let r=document.activeElement;for(let n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function y3n(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var wsr=ysr,xsr=_sr;var _3n=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},dV=new WeakMap,i_e=new WeakMap,a_e={},g5e=0,Ssr=function(t){return t&&(t.host||Ssr(t.parentNode))},v3n=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=Ssr(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},w3n=function(t,e,r,n){var o=v3n(e,Array.isArray(t)?t:[t]);a_e[r]||(a_e[r]=new WeakMap);var i=a_e[r],a=[],s=new Set,u=new Set(o),l=function(d){!d||s.has(d)||(s.add(d),l(d.parentNode))};o.forEach(l);var c=function(d){!d||u.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))c(f);else try{var p=f.getAttribute(n),m=p!==null&&p!=="false",h=(dV.get(f)||0)+1,y=(i.get(f)||0)+1;dV.set(f,h),i.set(f,y),a.push(f),h===1&&m&&i_e.set(f,!0),y===1&&f.setAttribute(r,"true"),m||f.setAttribute(n,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return c(e),s.clear(),g5e++,function(){a.forEach(function(d){var f=dV.get(d)-1,p=i.get(d)-1;dV.set(d,f),i.set(d,p),f||(i_e.has(d)||d.removeAttribute(n),i_e.delete(d)),p||d.removeAttribute(r)}),g5e--,g5e||(dV=new WeakMap,dV=new WeakMap,i_e=new WeakMap,a_e={})}},yN=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=e||_3n(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),w3n(n,o,r,"aria-hidden")):function(){return null}};var Di=function(){return Di=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Di.apply(this,arguments)};function bN(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function fV(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}var d_e=j(Z());var fp=j(Z());var iv="right-scroll-bar-position",av="width-before-scroll-bar",y5e="with-scroll-bars-hidden",b5e="--removed-body-scroll-bar-size";function s_e(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var Csr=j(Z());function Osr(t,e){var r=(0,Csr.useState)(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var o=r.value;o!==n&&(r.value=n,r.callback(n,o))}}}})[0];return r.callback=e,r.facade}var u_e=j(Z());var x3n=typeof window<"u"?u_e.useLayoutEffect:u_e.useEffect,Esr=new WeakMap;function S$(t,e){var r=Osr(e||null,function(n){return t.forEach(function(o){return s_e(o,n)})});return x3n(function(){var n=Esr.get(r);if(n){var o=new Set(n),i=new Set(t),a=r.current;o.forEach(function(s){i.has(s)||s_e(s,null)}),i.forEach(function(s){o.has(s)||s_e(s,a)})}Esr.set(r,t)},[t]),r}function S3n(t){return t}function C3n(t,e){e===void 0&&(e=S3n);var r=[],n=!1,o={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(i){var a=e(i,n);return r.push(a),function(){r=r.filter(function(s){return s!==a})}},assignSyncMedium:function(i){for(n=!0;r.length;){var a=r;r=[],a.forEach(i)}r={push:function(s){return i(s)},filter:function(){return r}}},assignMedium:function(i){n=!0;var a=[];if(r.length){var s=r;r=[],s.forEach(i),a=r}var u=function(){var c=a;a=[],c.forEach(i)},l=function(){return Promise.resolve().then(u)};l(),r={push:function(c){a.push(c),l()},filter:function(c){return a=a.filter(c),r}}}};return o}function C$(t){t===void 0&&(t={});var e=C3n(null);return e.options=Di({async:!0,ssr:!1},t),e}var Psr=j(Z()),Tsr=function(t){var e=t.sideCar,r=bN(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return Psr.createElement(n,Di({},r))};Tsr.isSideCarExport=!0;function O$(t,e){return t.useMedium(e),Tsr}var l_e=C$();var _5e=function(){},mY=fp.forwardRef(function(t,e){var r=fp.useRef(null),n=fp.useState({onScrollCapture:_5e,onWheelCapture:_5e,onTouchMoveCapture:_5e}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,y=t.as,g=y===void 0?"div":y,_=t.gapMode,w=bN(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,C=S$([r,e]),E=Di(Di({},w),o);return fp.createElement(fp.Fragment,null,c&&fp.createElement(S,{sideCar:l_e,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:_}),a?fp.cloneElement(fp.Children.only(s),Di(Di({},E),{ref:C})):fp.createElement(g,Di({},E,{className:u,ref:C}),s))});mY.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};mY.classNames={fullWidth:av,zeroRight:iv};var Da=j(Z());var mV=j(Z());var Msr=j(Z());var Asr;var Isr=function(){if(Asr)return Asr;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function O3n(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Isr();return e&&t.setAttribute("nonce",e),t}function E3n(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function P3n(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var v5e=function(){var t=0,e=null;return{add:function(r){t==0&&(e=O3n())&&(E3n(e,r),P3n(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}};var w5e=function(){var t=v5e();return function(e,r){Msr.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}};var mA=function(){var t=w5e(),e=function(r){var n=r.styles,o=r.dynamic;return t(n,o),null};return e};var T3n={left:0,top:0,right:0,gap:0},x5e=function(t){return parseInt(t||"",10)||0},A3n=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[x5e(r),x5e(n),x5e(o)]},S5e=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return T3n;var e=A3n(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}};var I3n=mA(),pV="data-scroll-locked",M3n=function(t,e,r,n){var o=t.left,i=t.top,a=t.right,s=t.gap;return r===void 0&&(r="margin"),`
.`.concat(y5e,` {
overflow: hidden `).concat(n,`;
padding-right: `).concat(s,"px ").concat(n,`;
}
body[`).concat(pV,`] {
overflow: hidden `).concat(n,`;
overscroll-behavior: contain;
`).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&`
padding-left: `.concat(o,`px;
padding-top: `).concat(i,`px;
padding-right: `).concat(a,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(s,"px ").concat(n,`;
`),r==="padding"&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),`
}
.`).concat(iv,` {
right: `).concat(s,"px ").concat(n,`;
}
.`).concat(av,` {
margin-right: `).concat(s,"px ").concat(n,`;
}
.`).concat(iv," .").concat(iv,` {
right: 0 `).concat(n,`;
}
.`).concat(av," .").concat(av,` {
margin-right: 0 `).concat(n,`;
}
body[`).concat(pV,`] {
`).concat(b5e,": ").concat(s,`px;
}
`)},Rsr=function(){var t=parseInt(document.body.getAttribute(pV)||"0",10);return isFinite(t)?t:0},R3n=function(){mV.useEffect(function(){return document.body.setAttribute(pV,(Rsr()+1).toString()),function(){var t=Rsr()-1;t<=0?document.body.removeAttribute(pV):document.body.setAttribute(pV,t.toString())}},[])},E$=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;R3n();var i=mV.useMemo(function(){return S5e(o)},[o]);return mV.createElement(I3n,{styles:M3n(i,!e,o,r?"":"!important")})};var C5e=!1;if(typeof window<"u")try{hY=Object.defineProperty({},"passive",{get:function(){return C5e=!0,!0}}),window.addEventListener("test",hY,hY),window.removeEventListener("test",hY,hY)}catch{C5e=!1}var hY,P$=C5e?{passive:!1}:!1;var N3n=function(t){return t.tagName==="TEXTAREA"},Nsr=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!N3n(t)&&r[e]==="visible")},j3n=function(t){return Nsr(t,"overflowY")},D3n=function(t){return Nsr(t,"overflowX")},O5e=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=jsr(t,n);if(o){var i=Dsr(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},L3n=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},F3n=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},jsr=function(t,e){return t==="v"?j3n(e):D3n(e)},Dsr=function(t,e){return t==="v"?L3n(e):F3n(e)},k3n=function(t,e){return t==="h"&&e==="rtl"?-1:1},Lsr=function(t,e,r,n,o){var i=k3n(t,window.getComputedStyle(e).direction),a=i*n,s=r.target,u=e.contains(s),l=!1,c=a>0,d=0,f=0;do{var p=Dsr(t,s),m=p[0],h=p[1],y=p[2],g=h-y-i*m;(m||g)&&jsr(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var c_e=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Fsr=function(t){return[t.deltaX,t.deltaY]},ksr=function(t){return t&&"current"in t?t.current:t},$3n=function(t,e){return t[0]===e[0]&&t[1]===e[1]},B3n=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},z3n=0,hV=[];function $sr(t){var e=Da.useRef([]),r=Da.useRef([0,0]),n=Da.useRef(),o=Da.useState(z3n++)[0],i=Da.useState(mA)[0],a=Da.useRef(t);Da.useEffect(function(){a.current=t},[t]),Da.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=fV([t.lockRef.current],(t.shards||[]).map(ksr),!0).filter(Boolean);return h.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Da.useCallback(function(h,y){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=c_e(h),_=r.current,w="deltaX"in h?h.deltaX:_[0]-g[0],S="deltaY"in h?h.deltaY:_[1]-g[1],C,E=h.target,P=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in h&&P==="h"&&E.type==="range")return!1;var T=O5e(P,E);if(!T)return!0;if(T?C=P:(C=P==="v"?"h":"v",T=O5e(P,E)),!T)return!1;if(!n.current&&"changedTouches"in h&&(w||S)&&(n.current=C),!C)return!0;var I=n.current||C;return Lsr(I,y,h,I==="h"?w:S,!0)},[]),u=Da.useCallback(function(h){var y=h;if(!(!hV.length||hV[hV.length-1]!==i)){var g="deltaY"in y?Fsr(y):c_e(y),_=e.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&$3n(C.delta,g)})[0];if(_&&_.should){y.cancelable&&y.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(ksr).filter(Boolean).filter(function(C){return C.contains(y.target)}),S=w.length>0?s(y,w[0]):!a.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),l=Da.useCallback(function(h,y,g,_){var w={name:h,delta:y,target:g,should:_,shadowParent:U3n(g)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),c=Da.useCallback(function(h){r.current=c_e(h),n.current=void 0},[]),d=Da.useCallback(function(h){l(h.type,Fsr(h),h.target,s(h,t.lockRef.current))},[]),f=Da.useCallback(function(h){l(h.type,c_e(h),h.target,s(h,t.lockRef.current))},[]);Da.useEffect(function(){return hV.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,P$),document.addEventListener("touchmove",u,P$),document.addEventListener("touchstart",c,P$),function(){hV=hV.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,P$),document.removeEventListener("touchmove",u,P$),document.removeEventListener("touchstart",c,P$)}},[]);var p=t.removeScrollBar,m=t.inert;return Da.createElement(Da.Fragment,null,m?Da.createElement(i,{styles:B3n(o)}):null,p?Da.createElement(E$,{gapMode:t.gapMode}):null)}function U3n(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var Bsr=O$(l_e,$sr);var zsr=d_e.forwardRef(function(t,e){return d_e.createElement(mY,Di({},t,{ref:e,sideCar:Bsr}))});zsr.classNames=mY.classNames;var E5e=zsr;var Jr=j(at(),1),P5e=["Enter"," "],q3n=["ArrowDown","PageUp","Home"],qsr=["ArrowUp","PageDown","End"],H3n=[...q3n,...qsr],V3n={ltr:[...P5e,"ArrowRight"],rtl:[...P5e,"ArrowLeft"]},W3n={ltr:["ArrowLeft"],rtl:["ArrowRight"]},_Y="Menu",[yY,K3n,G3n]=Kir(_Y),[T$,T5e]=ts(_Y,[G3n,a5e,h5e]),vY=a5e(),Hsr=h5e(),[Vsr,_N]=T$(_Y),[J3n,wY]=T$(_Y),Wsr=t=>{let{__scopeMenu:e,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=t,s=vY(e),[u,l]=Yt.useState(null),c=Yt.useRef(!1),d=un(i),f=iV(o);return Yt.useEffect(()=>{let p=()=>{c.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>c.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),(0,Jr.jsx)(u5e,{...s,children:(0,Jr.jsx)(Vsr,{scope:e,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,Jr.jsx)(J3n,{scope:e,onClose:Yt.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};Wsr.displayName=_Y;var Z3n="MenuAnchor",A5e=Yt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=vY(r);return(0,Jr.jsx)(asr,{...o,...n,ref:e})});A5e.displayName=Z3n;var I5e="MenuPortal",[Y3n,Ksr]=T$(I5e,{forceMount:void 0}),Gsr=t=>{let{__scopeMenu:e,forceMount:r,children:n,container:o}=t,i=_N(I5e,e);return(0,Jr.jsx)(Y3n,{scope:e,forceMount:r,children:(0,Jr.jsx)(of,{present:r||i.open,children:(0,Jr.jsx)(l5e,{asChild:!0,container:o,children:n})})})};Gsr.displayName=I5e;var gb="MenuContent",[X3n,M5e]=T$(gb),Jsr=Yt.forwardRef((t,e)=>{let r=Ksr(gb,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=_N(gb,t.__scopeMenu),a=wY(gb,t.__scopeMenu);return(0,Jr.jsx)(yY.Provider,{scope:t.__scopeMenu,children:(0,Jr.jsx)(of,{present:n||i.open,children:(0,Jr.jsx)(yY.Slot,{scope:t.__scopeMenu,children:a.modal?(0,Jr.jsx)(Q3n,{...o,ref:e}):(0,Jr.jsx)(eHn,{...o,ref:e})})})})}),Q3n=Yt.forwardRef((t,e)=>{let r=_N(gb,t.__scopeMenu),n=Yt.useRef(null),o=uf(e,n);return Yt.useEffect(()=>{let i=n.current;if(i)return yN(i)},[]),(0,Jr.jsx)(R5e,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ga(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),eHn=Yt.forwardRef((t,e)=>{let r=_N(gb,t.__scopeMenu);return(0,Jr.jsx)(R5e,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),R5e=Yt.forwardRef((t,e)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=t,y=_N(gb,r),g=wY(gb,r),_=vY(r),w=Hsr(r),S=K3n(r),[C,E]=Yt.useState(null),P=Yt.useRef(null),T=uf(e,P,y.onContentChange),I=Yt.useRef(0),N=Yt.useRef(""),M=Yt.useRef(0),D=Yt.useRef(null),k=Yt.useRef("right"),L=Yt.useRef(0),H=m?E5e:Yt.Fragment,K=m?{as:tN,allowPinchZoom:!0}:void 0,G=F=>{let Q=N.current+F,ee=S().filter(J=>!J.disabled),U=document.activeElement,z=ee.find(J=>J.ref.current===U)?.textValue,V=ee.map(J=>J.textValue),q=pHn(V,Q,z),W=ee.find(J=>J.textValue===q)?.ref.current;(function J(se){N.current=se,window.clearTimeout(I.current),se!==""&&(I.current=window.setTimeout(()=>J(""),1e3))})(Q),W&&setTimeout(()=>W.focus())};Yt.useEffect(()=>()=>window.clearTimeout(I.current),[]),oN();let X=Yt.useCallback(F=>k.current===D.current?.side&&hHn(F,D.current?.area),[]);return(0,Jr.jsx)(X3n,{scope:r,searchRef:N,onItemEnter:Yt.useCallback(F=>{X(F)&&F.preventDefault()},[X]),onItemLeave:Yt.useCallback(F=>{X(F)||(P.current?.focus(),E(null))},[X]),onTriggerLeave:Yt.useCallback(F=>{X(F)&&F.preventDefault()},[X]),pointerGraceTimerRef:M,onPointerGraceIntentChange:Yt.useCallback(F=>{D.current=F},[]),children:(0,Jr.jsx)(H,{...K,children:(0,Jr.jsx)(Z8e,{asChild:!0,trapped:o,onMountAutoFocus:ga(i,F=>{F.preventDefault(),P.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,Jr.jsx)(W8e,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Jr.jsx)(wsr,{asChild:!0,...w,dir:g.dir,orientation:"vertical",loop:n,currentTabStopId:C,onCurrentTabStopIdChange:E,onEntryFocus:ga(u,F=>{g.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Jr.jsx)(ssr,{role:"menu","aria-orientation":"vertical","data-state":dur(y.open),"data-radix-menu-content":"",dir:g.dir,..._,...h,ref:T,style:{outline:"none",...h.style},onKeyDown:ga(h.onKeyDown,F=>{let ee=F.target.closest("[data-radix-menu-content]")===F.currentTarget,U=F.ctrlKey||F.altKey||F.metaKey,z=F.key.length===1;ee&&(F.key==="Tab"&&F.preventDefault(),!U&&z&&G(F.key));let V=P.current;if(F.target!==V||!H3n.includes(F.key))return;F.preventDefault();let W=S().filter(J=>!J.disabled).map(J=>J.ref.current);qsr.includes(F.key)&&W.reverse(),dHn(W)}),onBlur:ga(t.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(I.current),N.current="")}),onPointerMove:ga(t.onPointerMove,bY(F=>{let Q=F.target,ee=L.current!==F.clientX;if(F.currentTarget.contains(Q)&&ee){let U=F.clientX>L.current?"right":"left";k.current=U,L.current=F.clientX}}))})})})})})})});Jsr.displayName=gb;var tHn="MenuGroup",N5e=Yt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Jr.jsx)(dd.div,{role:"group",...n,ref:e})});N5e.displayName=tHn;var rHn="MenuLabel",Zsr=Yt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Jr.jsx)(dd.div,{...n,ref:e})});Zsr.displayName=rHn;var f_e="MenuItem",Usr="menu.itemSelect",m_e=Yt.forwardRef((t,e)=>{let{disabled:r=!1,onSelect:n,...o}=t,i=Yt.useRef(null),a=wY(f_e,t.__scopeMenu),s=M5e(f_e,t.__scopeMenu),u=uf(e,i),l=Yt.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(Usr,{bubbles:!0,cancelable:!0});d.addEventListener(Usr,p=>n?.(p),{once:!0}),Ube(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,Jr.jsx)(Ysr,{...o,ref:u,disabled:r,onClick:ga(t.onClick,c),onPointerDown:d=>{t.onPointerDown?.(d),l.current=!0},onPointerUp:ga(t.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:ga(t.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||P5e.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});m_e.displayName=f_e;var Ysr=Yt.forwardRef((t,e)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=t,a=M5e(f_e,r),s=Hsr(r),u=Yt.useRef(null),l=uf(e,u),[c,d]=Yt.useState(!1),[f,p]=Yt.useState("");return Yt.useEffect(()=>{let m=u.current;m&&p((m.textContent??"").trim())},[i.children]),(0,Jr.jsx)(yY.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,Jr.jsx)(xsr,{asChild:!0,...s,focusable:!n,children:(0,Jr.jsx)(dd.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:ga(t.onPointerMove,bY(m=>{n?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ga(t.onPointerLeave,bY(m=>a.onItemLeave(m))),onFocus:ga(t.onFocus,()=>d(!0)),onBlur:ga(t.onBlur,()=>d(!1))})})})}),nHn="MenuCheckboxItem",Xsr=Yt.forwardRef((t,e)=>{let{checked:r=!1,onCheckedChange:n,...o}=t;return(0,Jr.jsx)(nur,{scope:t.__scopeMenu,checked:r,children:(0,Jr.jsx)(m_e,{role:"menuitemcheckbox","aria-checked":p_e(r)?"mixed":r,...o,ref:e,"data-state":L5e(r),onSelect:ga(o.onSelect,()=>n?.(p_e(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Xsr.displayName=nHn;var Qsr="MenuRadioGroup",[oHn,iHn]=T$(Qsr,{value:void 0,onValueChange:()=>{}}),eur=Yt.forwardRef((t,e)=>{let{value:r,onValueChange:n,...o}=t,i=un(n);return(0,Jr.jsx)(oHn,{scope:t.__scopeMenu,value:r,onValueChange:i,children:(0,Jr.jsx)(N5e,{...o,ref:e})})});eur.displayName=Qsr;var tur="MenuRadioItem",rur=Yt.forwardRef((t,e)=>{let{value:r,...n}=t,o=iHn(tur,t.__scopeMenu),i=r===o.value;return(0,Jr.jsx)(nur,{scope:t.__scopeMenu,checked:i,children:(0,Jr.jsx)(m_e,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":L5e(i),onSelect:ga(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});rur.displayName=tur;var j5e="MenuItemIndicator",[nur,aHn]=T$(j5e,{checked:!1}),our=Yt.forwardRef((t,e)=>{let{__scopeMenu:r,forceMount:n,...o}=t,i=aHn(j5e,r);return(0,Jr.jsx)(of,{present:n||p_e(i.checked)||i.checked===!0,children:(0,Jr.jsx)(dd.span,{...o,ref:e,"data-state":L5e(i.checked)})})});our.displayName=j5e;var sHn="MenuSeparator",iur=Yt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Jr.jsx)(dd.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});iur.displayName=sHn;var uHn="MenuArrow",aur=Yt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=vY(r);return(0,Jr.jsx)(usr,{...o,...n,ref:e})});aur.displayName=uHn;var D5e="MenuSub",[lHn,sur]=T$(D5e),cHn=t=>{let{__scopeMenu:e,children:r,open:n=!1,onOpenChange:o}=t,i=_N(D5e,e),a=vY(e),[s,u]=Yt.useState(null),[l,c]=Yt.useState(null),d=un(o);return Yt.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,Jr.jsx)(u5e,{...a,children:(0,Jr.jsx)(Vsr,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,Jr.jsx)(lHn,{scope:e,contentId:Xl(),triggerId:Xl(),trigger:s,onTriggerChange:u,children:r})})})};cHn.displayName=D5e;var gY="MenuSubTrigger",uur=Yt.forwardRef((t,e)=>{let r=_N(gY,t.__scopeMenu),n=wY(gY,t.__scopeMenu),o=sur(gY,t.__scopeMenu),i=M5e(gY,t.__scopeMenu),a=Yt.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:u}=i,l={__scopeMenu:t.__scopeMenu},c=Yt.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return Yt.useEffect(()=>c,[c]),Yt.useEffect(()=>{let d=s.current;return()=>{window.clearTimeout(d),u(null)}},[s,u]),(0,Jr.jsx)(A5e,{asChild:!0,...l,children:(0,Jr.jsx)(Ysr,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":dur(r.open),...t,ref:sY(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ga(t.onPointerMove,bY(d=>{i.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!r.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),c()},100))})),onPointerLeave:ga(t.onPointerLeave,bY(d=>{c();let f=r.content?.getBoundingClientRect();if(f){let p=r.content?.dataset.side,m=p==="right",h=m?-5:5,y=f[m?"left":"right"],g=f[m?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+h,y:d.clientY},{x:y,y:f.top},{x:g,y:f.top},{x:g,y:f.bottom},{x:y,y:f.bottom}],side:p}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:ga(t.onKeyDown,d=>{let f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||V3n[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});uur.displayName=gY;var lur="MenuSubContent",cur=Yt.forwardRef((t,e)=>{let r=Ksr(gb,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=_N(gb,t.__scopeMenu),a=wY(gb,t.__scopeMenu),s=sur(lur,t.__scopeMenu),u=Yt.useRef(null),l=uf(e,u);return(0,Jr.jsx)(yY.Provider,{scope:t.__scopeMenu,children:(0,Jr.jsx)(of,{present:n||i.open,children:(0,Jr.jsx)(yY.Slot,{scope:t.__scopeMenu,children:(0,Jr.jsx)(R5e,{id:s.contentId,"aria-labelledby":s.triggerId,...o,ref:l,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:c=>{a.isUsingKeyboardRef.current&&u.current?.focus(),c.preventDefault()},onCloseAutoFocus:c=>c.preventDefault(),onFocusOutside:ga(t.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ga(t.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:ga(t.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=W3n[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});cur.displayName=lur;function dur(t){return t?"open":"closed"}function p_e(t){return t==="indeterminate"}function L5e(t){return p_e(t)?"indeterminate":t?"checked":"unchecked"}function dHn(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function fHn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function pHn(t,e,r){let o=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,i=r?t.indexOf(r):-1,a=fHn(t,Math.max(i,0));o.length===1&&(a=a.filter(l=>l!==r));let u=a.find(l=>l.toLowerCase().startsWith(o.toLowerCase()));return u!==r?u:void 0}function mHn(t,e){let{x:r,y:n}=t,o=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){let s=e[i].x,u=e[i].y,l=e[a].x,c=e[a].y;u>n!=c>n&&r<(l-s)*(n-u)/(c-u)+s&&(o=!o)}return o}function hHn(t,e){if(!e)return!1;let r={x:t.clientX,y:t.clientY};return mHn(r,e)}function bY(t){return e=>e.pointerType==="mouse"?t(e):void 0}var fur=Wsr,pur=A5e,mur=Gsr,hur=Jsr,gur=N5e,yur=Zsr,bur=m_e,_ur=Xsr,vur=eur,wur=rur,xur=our,Sur=iur,Cur=aur;var Our=uur,Eur=cur;var pd=j(at(),1),F5e="DropdownMenu",[yHn,bVi]=ts(F5e,[T5e]),sm=T5e(),[bHn,Pur]=yHn(F5e),xY=t=>{let{__scopeDropdownMenu:e,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,u=sm(e),l=Ic.useRef(null),[c=!1,d]=im({prop:o,defaultProp:i,onChange:a});return(0,pd.jsx)(bHn,{scope:e,triggerId:Xl(),triggerRef:l,contentId:Xl(),open:c,onOpenChange:d,onOpenToggle:Ic.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,pd.jsx)(fur,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};xY.displayName=F5e;var Tur="DropdownMenuTrigger",SY=Ic.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=t,i=Pur(Tur,r),a=sm(r);return(0,pd.jsx)(pur,{asChild:!0,...a,children:(0,pd.jsx)(Hir.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...o,ref:$be(e,i.triggerRef),onPointerDown:aY(t.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:aY(t.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});SY.displayName=Tur;var _Hn="DropdownMenuPortal",Aur=t=>{let{__scopeDropdownMenu:e,...r}=t,n=sm(e);return(0,pd.jsx)(mur,{...n,...r})};Aur.displayName=_Hn;var Iur="DropdownMenuContent",Mur=Ic.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Pur(Iur,r),i=sm(r),a=Ic.useRef(!1);return(0,pd.jsx)(hur,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:e,onCloseAutoFocus:aY(t.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:aY(t.onInteractOutside,s=>{let u=s.detail.originalEvent,l=u.button===0&&u.ctrlKey===!0,c=u.button===2||l;(!o.modal||c)&&(a.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Mur.displayName=Iur;var vHn="DropdownMenuGroup",wHn=Ic.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sm(r);return(0,pd.jsx)(gur,{...o,...n,ref:e})});wHn.displayName=vHn;var xHn="DropdownMenuLabel",Rur=Ic.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sm(r);return(0,pd.jsx)(yur,{...o,...n,ref:e})});Rur.displayName=xHn;var SHn="DropdownMenuItem",Nur=Ic.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sm(r);return(0,pd.jsx)(bur,{...o,...n,ref:e})});Nur.displayName=SHn;var CHn="DropdownMenuCheckboxItem",jur=Ic.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sm(r);return(0,pd.jsx)(_ur,{...o,...n,ref:e})});jur.displayName=CHn;var OHn="DropdownMenuRadioGroup",EHn=Ic.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sm(r);return(0,pd.jsx)(vur,{...o,...n,ref:e})});EHn.displayName=OHn;var PHn="DropdownMenuRadioItem",Dur=Ic.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sm(r);return(0,pd.jsx)(wur,{...o,...n,ref:e})});Dur.displayName=PHn;var THn="DropdownMenuItemIndicator",Lur=Ic.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sm(r);return(0,pd.jsx)(xur,{...o,...n,ref:e})});Lur.displayName=THn;var AHn="DropdownMenuSeparator",Fur=Ic.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sm(r);return(0,pd.jsx)(Sur,{...o,...n,ref:e})});Fur.displayName=AHn;var IHn="DropdownMenuArrow",MHn=Ic.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sm(r);return(0,pd.jsx)(Cur,{...o,...n,ref:e})});MHn.displayName=IHn;var RHn="DropdownMenuSubTrigger",kur=Ic.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sm(r);return(0,pd.jsx)(Our,{...o,...n,ref:e})});kur.displayName=RHn;var NHn="DropdownMenuSubContent",$ur=Ic.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sm(r);return(0,pd.jsx)(Eur,{...o,...n,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});$ur.displayName=NHn;var Bur=xY,zur=SY,Uur=Aur,k5e=Mur;var $5e=Rur,B5e=Nur,z5e=jur;var U5e=Dur,q5e=Lur,H5e=Fur;var V5e=kur,W5e=$ur;_n();dn();var JO=Bur,ZO=zur;var DHn=ua.forwardRef(({className:t,inset:e,children:r,...n},o)=>ua.createElement(V5e,{ref:o,className:he("tw-flex tw-cursor-default tw-select-none tw-items-center tw-gap-2 tw-rounded-sm tw-px-2 tw-py-1.5 tw-text-sm tw-outline-none focus:tw-bg-dropdown-hover data-[state=open]:tw-bg-dropdown-hover [&_svg]:tw-pointer-events-none [&_svg]:tw-size-4 [&_svg]:tw-shrink-0",e&&"tw-pl-8",t),...n},r,ua.createElement($m,{className:"tw-ml-auto"})));DHn.displayName=V5e.displayName;var LHn=ua.forwardRef(({className:t,...e},r)=>ua.createElement(W5e,{ref:r,className:he("tw-z-[50] tw-min-w-32 tw-overflow-hidden tw-rounded-md tw-border tw-bg-primary tw-p-1 tw-text-normal tw-shadow-lg data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",t),...e}));LHn.displayName=W5e.displayName;var wh=ua.forwardRef(({className:t,sideOffset:e=4,container:r,...n},o)=>ua.createElement(Uur,{container:r??activeDocument.body},ua.createElement(k5e,{ref:o,sideOffset:e,className:he("tw-z-[50] tw-min-w-32 tw-overflow-hidden tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-1 tw-text-normal tw-shadow-md","data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",t),...n})));wh.displayName=k5e.displayName;var so=ua.forwardRef(({className:t,inset:e,...r},n)=>ua.createElement(B5e,{ref:n,className:he("tw-relative tw-flex tw-cursor-default tw-select-none tw-items-center tw-gap-2 tw-rounded-sm tw-px-2 tw-py-1.5 tw-text-sm tw-outline-none tw-transition-colors focus:tw-bg-dropdown-hover focus:tw-text-normal data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50 [&>svg]:tw-size-4 [&>svg]:tw-shrink-0",e&&"tw-pl-8",t),...r}));so.displayName=B5e.displayName;var FHn=ua.forwardRef(({className:t,children:e,checked:r,...n},o)=>ua.createElement(z5e,{ref:o,className:he("tw-relative tw-flex tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-py-1.5 tw-pl-8 tw-pr-2 tw-text-sm tw-outline-none tw-transition-colors focus:tw-bg-dropdown-hover focus:tw-text-normal data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",t),checked:r,...n},ua.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},ua.createElement(q5e,null,ua.createElement(ds,{className:"tw-size-4"}))),e));FHn.displayName=z5e.displayName;var kHn=ua.forwardRef(({className:t,children:e,...r},n)=>ua.createElement(U5e,{ref:n,className:he("tw-relative tw-flex tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-py-1.5 tw-pl-8 tw-pr-2 tw-text-sm tw-outline-none tw-transition-colors focus:tw-bg-dropdown-hover focus:tw-text-normal data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",t),...r},ua.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},ua.createElement(q5e,null,ua.createElement(I5,{className:"tw-size-2 tw-fill-current"}))),e));kHn.displayName=U5e.displayName;var $Hn=ua.forwardRef(({className:t,inset:e,...r},n)=>ua.createElement($5e,{ref:n,className:he("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",e&&"tw-pl-8",t),...r}));$Hn.displayName=$5e.displayName;var BHn=ua.forwardRef(({className:t,...e},r)=>ua.createElement(H5e,{ref:r,className:he("-tw-mx-1 tw-my-1 tw-h-px",t),...e}));BHn.displayName=H5e.displayName;var zHn=({className:t,...e})=>ua.createElement("span",{className:he("tw-ml-auto tw-text-xs tw-tracking-widest tw-opacity-60",t),...e});zHn.displayName="DropdownMenuShortcut";var CY=j(Z());dn();var gV=CY.forwardRef(({checked:t=!1,onCheckedChange:e,disabled:r=!1,className:n,...o},i)=>{let a=()=>{r||e?.(!t)},s=u=>{r||(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),e?.(!t))};return CY.createElement("div",{role:"switch","aria-checked":t,"aria-disabled":r,"data-state":t?"checked":"unchecked","data-disabled":r?"":void 0,ref:i,tabIndex:r?-1:0,className:he("tw-relative tw-inline-flex tw-h-5.5 tw-w-10 tw-shrink-0 tw-cursor-pointer tw-items-center tw-rounded-full tw-transition-colors","focus-visible:tw-outline-none focus-visible:tw-ring-2 focus-visible:tw-ring-ring focus-visible:tw-ring-offset-2",t?"tw-bg-interactive-accent":"tw-bg-[--background-modifier-border-hover]",r&&"tw-cursor-not-allowed tw-opacity-50",n),onClick:a,onKeyDown:s,...o},CY.createElement("div",{className:he("tw-pointer-events-none tw-block tw-size-4 tw-rounded-full tw-bg-toggle-thumb tw-shadow-lg tw-ring-0 tw-transition-transform",t?"tw-translate-x-5.5":"tw-translate-x-0.5")}))});gV.displayName="SettingSwitch";var PY=j(Z());var yn=j(Z(),1);function sv(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Hur=j(Z(),1);function qur(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function UHn(...t){return e=>{let r=!1,n=t.map(o=>{let i=qur(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():qur(t[o],null)}}}}function uv(...t){return Hur.useCallback(UHn(...t),t)}var hA=j(Z(),1),Vur=j(at(),1);function h_e(t,e=[]){let r=[];function n(i,a){let s=hA.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=hA.useMemo(()=>m,Object.values(m));return(0,Vur.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=hA.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>hA.createContext(a));return function(s){let u=s?.[t]||i;return hA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,qHn(o,...e)]}function qHn(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return hA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Es=j(Z(),1);var Wur=j(Z(),1),Kur=j(qa(),1);Wv();var Gur=j(at(),1),HHn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yb=HHn.reduce((t,e)=>{let r=zf(`Primitive.${e}`),n=Wur.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Gur.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function Jur(t,e){t&&Kur.flushSync(()=>t.dispatchEvent(e))}var yV=j(Z(),1);function A$(t){let e=yV.useRef(t);return yV.useEffect(()=>{e.current=t}),yV.useMemo(()=>(...r)=>e.current?.(...r),[])}var Zur=j(Z(),1);function Yur(t,e=globalThis?.document){let r=A$(t);Zur.useEffect(()=>{let n=o=>{o.key==="Escape"&&r(o)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var G5e=j(at(),1),VHn="DismissableLayer",K5e="dismissableLayer.update",WHn="dismissableLayer.pointerDownOutside",KHn="dismissableLayer.focusOutside",Xur,elr=Es.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),J5e=Es.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Es.useContext(elr),[c,d]=Es.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Es.useState({}),m=uv(e,P=>d(P)),h=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(y),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=g,C=ZHn(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=YHn(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return Yur(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Es.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Xur=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),Qur(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Xur)}},[c,f,r,l]),Es.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),Qur())},[c,l]),Es.useEffect(()=>{let P=()=>p({});return document.addEventListener(K5e,P),()=>document.removeEventListener(K5e,P)},[]),(0,G5e.jsx)(yb.div,{...u,ref:m,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:sv(t.onFocusCapture,E.onFocusCapture),onBlurCapture:sv(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:sv(t.onPointerDownCapture,C.onPointerDownCapture)})});J5e.displayName=VHn;var GHn="DismissableLayerBranch",JHn=Es.forwardRef((t,e)=>{let r=Es.useContext(elr),n=Es.useRef(null),o=uv(e,n);return Es.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,G5e.jsx)(yb.div,{...t,ref:o})});JHn.displayName=GHn;function ZHn(t,e=globalThis?.document){let r=A$(t),n=Es.useRef(!1),o=Es.useRef(()=>{});return Es.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){tlr(WHn,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function YHn(t,e=globalThis?.document){let r=A$(t),n=Es.useRef(!1);return Es.useEffect(()=>{let o=i=>{i.target&&!n.current&&tlr(KHn,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Qur(){let t=new CustomEvent(K5e);document.dispatchEvent(t)}function tlr(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?Jur(o,i):o.dispatchEvent(i)}var Z5e=j(Z(),1);var rlr=j(Z(),1),xh=globalThis?.document?rlr.useLayoutEffect:()=>{};var XHn=Z5e[" useId ".trim().toString()]||(()=>{}),QHn=0;function nlr(t){let[e,r]=Z5e.useState(XHn());return xh(()=>{t||r(n=>n??String(QHn++))},[t]),t||(e?`radix-${e}`:"")}var Tg=j(Z(),1);var olr=j(Z(),1);var Y5e=j(at(),1),eVn="Arrow",ilr=olr.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,Y5e.jsx)(yb.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,Y5e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});ilr.displayName=eVn;var alr=ilr;var slr=j(Z(),1);function ulr(t){let[e,r]=slr.useState(void 0);return xh(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});let n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;let i=o[0],a,s;if("borderBoxSize"in i){let u=i.borderBoxSize,l=Array.isArray(u)?u[0]:u;a=l.inlineSize,s=l.blockSize}else a=t.offsetWidth,s=t.offsetHeight;r({width:a,height:s})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}var vN=j(at(),1);var X5e="Popper",[llr,Q5e]=h_e(X5e),[rVn,clr]=llr(X5e),dlr=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Tg.useState(null);return(0,vN.jsx)(rVn,{scope:e,anchor:n,onAnchorChange:o,children:r})};dlr.displayName=X5e;var flr="PopperAnchor",plr=Tg.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=clr(flr,r),a=Tg.useRef(null),s=uv(e,a);return Tg.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,vN.jsx)(yb.div,{...o,ref:s})});plr.displayName=flr;var eWe="PopperContent",[nVn,oVn]=llr(eWe),mlr=Tg.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,y=clr(eWe,r),[g,_]=Tg.useState(null),w=uv(e,J=>_(J)),[S,C]=Tg.useState(null),E=ulr(S),P=E?.width??0,T=E?.height??0,I=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},M=Array.isArray(l)?l:[l],D=M.length>0,k={padding:N,boundary:M.filter(aVn),altBoundary:D},{refs:L,floatingStyles:H,placement:K,isPositioned:G,middlewareData:X}=aN({strategy:"fixed",placement:I,whileElementsMounted:(...J)=>pA(...J,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[sN({mainAxis:o+T,alignmentAxis:a}),u&&uN({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?lN():void 0,...k}),u&&cN({...k}),dN({...k,apply:({elements:J,rects:se,availableWidth:be,availableHeight:ce})=>{let{width:pe,height:Me}=se.reference,Ue=J.floating.style;Ue.setProperty("--radix-popper-available-width",`${be}px`),Ue.setProperty("--radix-popper-available-height",`${ce}px`),Ue.setProperty("--radix-popper-anchor-width",`${pe}px`),Ue.setProperty("--radix-popper-anchor-height",`${Me}px`)}}),S&&pN({element:S,padding:s}),sVn({arrowWidth:P,arrowHeight:T}),f&&fN({strategy:"referenceHidden",...k})]}),[F,Q]=ylr(K),ee=A$(m);xh(()=>{G&&ee?.()},[G,ee]);let U=X.arrow?.x,z=X.arrow?.y,V=X.arrow?.centerOffset!==0,[q,W]=Tg.useState();return xh(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,vN.jsx)("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:G?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:q,"--radix-popper-transform-origin":[X.transformOrigin?.x,X.transformOrigin?.y].join(" "),...X.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,vN.jsx)(nVn,{scope:r,placedSide:F,onArrowChange:C,arrowX:U,arrowY:z,shouldHideArrow:V,children:(0,vN.jsx)(yb.div,{"data-side":F,"data-align":Q,...h,ref:w,style:{...h.style,animation:G?void 0:"none"}})})})});mlr.displayName=eWe;var hlr="PopperArrow",iVn={top:"bottom",right:"left",bottom:"top",left:"right"},glr=Tg.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=oVn(hlr,n),a=iVn[i.placedSide];return(0,vN.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,vN.jsx)(alr,{...o,ref:r,style:{...o.style,display:"block"}})})});glr.displayName=hlr;function aVn(t){return t!==null}var sVn=t=>({name:"transformOrigin",options:t,fn(e){let{placement:r,rects:n,middlewareData:o}=e,a=o.arrow?.centerOffset!==0,s=a?0:t.arrowWidth,u=a?0:t.arrowHeight,[l,c]=ylr(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function ylr(t){let[e,r="center"]=t.split("-");return[e,r]}var blr=dlr,_lr=plr,vlr=mlr,wlr=glr;var g_e=j(Z(),1),xlr=j(qa(),1);var Slr=j(at(),1),lVn="Portal",tWe=g_e.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=g_e.useState(!1);xh(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?xlr.default.createPortal((0,Slr.jsx)(yb.div,{...n,ref:e}),a):null});tWe.displayName=lVn;var Sh=j(Z(),1);var Clr=j(Z(),1);function cVn(t,e){return Clr.useReducer((r,n)=>e[r][n]??r,t)}var b_e=t=>{let{present:e,children:r}=t,n=dVn(e),o=typeof r=="function"?r({present:n.isPresent}):Sh.Children.only(r),i=uv(n.ref,fVn(o));return typeof r=="function"||n.isPresent?Sh.cloneElement(o,{ref:i}):null};b_e.displayName="Presence";function dVn(t){let[e,r]=Sh.useState(),n=Sh.useRef(null),o=Sh.useRef(t),i=Sh.useRef("none"),a=t?"mounted":"unmounted",[s,u]=cVn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Sh.useEffect(()=>{let l=y_e(n.current);i.current=s==="mounted"?l:"none"},[s]),xh(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=y_e(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),xh(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=y_e(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=y_e(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{c.clearTimeout(l),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:Sh.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function y_e(t){return t?.animationName||"none"}function fVn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}Wv();var bb=j(Z(),1);var __e=j(Z(),1);var pVn=bb[" useInsertionEffect ".trim().toString()]||xh;function Olr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=mVn({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=bb.useRef(t!==void 0);bb.useEffect(()=>{let d=c.current;d!==s&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}let l=bb.useCallback(c=>{if(s){let d=hVn(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function mVn({defaultProp:t,onChange:e}){let[r,n]=bb.useState(t),o=bb.useRef(r),i=bb.useRef(e);return pVn(()=>{i.current=e},[e]),bb.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function hVn(t){return typeof t=="function"}var s6i=Symbol("RADIX:SYNC_STATE");var Alr=j(Z(),1);var Elr=j(Z(),1),gVn=j(qa(),1);Wv();var Plr=j(at(),1),yVn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Tlr=yVn.reduce((t,e)=>{let r=zf(`Primitive.${e}`),n=Elr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Plr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Ilr=j(at(),1),bVn=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),_Vn="VisuallyHidden",Mlr=Alr.forwardRef((t,e)=>(0,Ilr.jsx)(Tlr.span,{...t,ref:e,style:{...bVn,...t.style}}));Mlr.displayName=_Vn;var Rlr=Mlr;var ec=j(at(),1),[v_e,S6i]=h_e("Tooltip",[Q5e]),w_e=Q5e(),Nlr="TooltipProvider",wVn=700,rWe="tooltip.open",[xVn,oWe]=v_e(Nlr),jlr=t=>{let{__scopeTooltip:e,delayDuration:r=wVn,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=t,a=yn.useRef(!0),s=yn.useRef(!1),u=yn.useRef(0);return yn.useEffect(()=>{let l=u.current;return()=>window.clearTimeout(l)},[]),(0,ec.jsx)(xVn,{scope:e,isOpenDelayedRef:a,delayDuration:r,onOpen:yn.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:yn.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:s,onPointerInTransitChange:yn.useCallback(l=>{s.current=l},[]),disableHoverableContent:o,children:i})};jlr.displayName=Nlr;var OY="Tooltip",[SVn,EY]=v_e(OY),Dlr=t=>{let{__scopeTooltip:e,children:r,open:n,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=t,u=oWe(OY,t.__scopeTooltip),l=w_e(e),[c,d]=yn.useState(null),f=nlr(),p=yn.useRef(0),m=a??u.disableHoverableContent,h=s??u.delayDuration,y=yn.useRef(!1),[g,_]=Olr({prop:n,defaultProp:o??!1,onChange:P=>{P?(u.onOpen(),document.dispatchEvent(new CustomEvent(rWe))):u.onClose(),i?.(P)},caller:OY}),w=yn.useMemo(()=>g?y.current?"delayed-open":"instant-open":"closed",[g]),S=yn.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,_(!0)},[_]),C=yn.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),E=yn.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,_(!0),p.current=0},h)},[h,_]);return yn.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,ec.jsx)(blr,{...l,children:(0,ec.jsx)(SVn,{scope:e,contentId:f,open:g,stateAttribute:w,trigger:c,onTriggerChange:d,onTriggerEnter:yn.useCallback(()=>{u.isOpenDelayedRef.current?E():S()},[u.isOpenDelayedRef,E,S]),onTriggerLeave:yn.useCallback(()=>{m?C():(window.clearTimeout(p.current),p.current=0)},[C,m]),onOpen:S,onClose:C,disableHoverableContent:m,children:r})})};Dlr.displayName=OY;var nWe="TooltipTrigger",Llr=yn.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=EY(nWe,r),i=oWe(nWe,r),a=w_e(r),s=yn.useRef(null),u=uv(e,s,o.onTriggerChange),l=yn.useRef(!1),c=yn.useRef(!1),d=yn.useCallback(()=>l.current=!1,[]);return yn.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,ec.jsx)(_lr,{asChild:!0,...a,children:(0,ec.jsx)(yb.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:sv(t.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:sv(t.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:sv(t.onPointerDown,()=>{o.open&&o.onClose(),l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:sv(t.onFocus,()=>{l.current||o.onOpen()}),onBlur:sv(t.onBlur,o.onClose),onClick:sv(t.onClick,o.onClose)})})});Llr.displayName=nWe;var iWe="TooltipPortal",[CVn,OVn]=v_e(iWe,{forceMount:void 0}),Flr=t=>{let{__scopeTooltip:e,forceMount:r,children:n,container:o}=t,i=EY(iWe,e);return(0,ec.jsx)(CVn,{scope:e,forceMount:r,children:(0,ec.jsx)(b_e,{present:r||i.open,children:(0,ec.jsx)(tWe,{asChild:!0,container:o,children:n})})})};Flr.displayName=iWe;var bV="TooltipContent",klr=yn.forwardRef((t,e)=>{let r=OVn(bV,t.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=t,a=EY(bV,t.__scopeTooltip);return(0,ec.jsx)(b_e,{present:n||a.open,children:a.disableHoverableContent?(0,ec.jsx)($lr,{side:o,...i,ref:e}):(0,ec.jsx)(EVn,{side:o,...i,ref:e})})}),EVn=yn.forwardRef((t,e)=>{let r=EY(bV,t.__scopeTooltip),n=oWe(bV,t.__scopeTooltip),o=yn.useRef(null),i=uv(e,o),[a,s]=yn.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=yn.useCallback(()=>{s(null),d(!1)},[d]),p=yn.useCallback((m,h)=>{let y=m.currentTarget,g={x:m.clientX,y:m.clientY},_=MVn(g,y.getBoundingClientRect()),w=RVn(g,_),S=NVn(h.getBoundingClientRect()),C=DVn([...w,...S]);s(C),d(!0)},[d]);return yn.useEffect(()=>()=>f(),[f]),yn.useEffect(()=>{if(u&&c){let m=y=>p(y,c),h=y=>p(y,u);return u.addEventListener("pointerleave",m),c.addEventListener("pointerleave",h),()=>{u.removeEventListener("pointerleave",m),c.removeEventListener("pointerleave",h)}}},[u,c,p,f]),yn.useEffect(()=>{if(a){let m=h=>{let y=h.target,g={x:h.clientX,y:h.clientY},_=u?.contains(y)||c?.contains(y),w=!jVn(g,a);_?f():w&&(f(),l())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[u,c,a,l,f]),(0,ec.jsx)($lr,{...t,ref:i})}),[PVn,TVn]=v_e(OY,{isInside:!1}),AVn=mit("TooltipContent"),$lr=yn.forwardRef((t,e)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=t,u=EY(bV,r),l=w_e(r),{onClose:c}=u;return yn.useEffect(()=>(document.addEventListener(rWe,c),()=>document.removeEventListener(rWe,c)),[c]),yn.useEffect(()=>{if(u.trigger){let d=f=>{f.target?.contains(u.trigger)&&c()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[u.trigger,c]),(0,ec.jsx)(J5e,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,ec.jsxs)(vlr,{"data-state":u.stateAttribute,...l,...s,ref:e,style:{...s.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,ec.jsx)(AVn,{children:n}),(0,ec.jsx)(PVn,{scope:r,isInside:!0,children:(0,ec.jsx)(Rlr,{id:u.contentId,role:"tooltip",children:o||n})})]})})});klr.displayName=bV;var Blr="TooltipArrow",IVn=yn.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=w_e(r);return TVn(Blr,r).isInside?null:(0,ec.jsx)(wlr,{...o,...n,ref:e})});IVn.displayName=Blr;function MVn(t,e){let r=Math.abs(e.top-t.y),n=Math.abs(e.bottom-t.y),o=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(r,n,o,i)){case i:return"left";case o:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function RVn(t,e,r=5){let n=[];switch(e){case"top":n.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":n.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":n.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":n.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return n}function NVn(t){let{top:e,right:r,bottom:n,left:o}=t;return[{x:o,y:e},{x:r,y:e},{x:r,y:n},{x:o,y:n}]}function jVn(t,e){let{x:r,y:n}=t,o=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){let s=e[i],u=e[a],l=s.x,c=s.y,d=u.x,f=u.y;c>n!=f>n&&r<(d-l)*(n-c)/(f-c)+l&&(o=!o)}return o}function DVn(t){let e=t.slice();return e.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),LVn(e)}function LVn(t){if(t.length<=1)return t.slice();let e=[];for(let n=0;n<t.length;n++){let o=t[n];for(;e.length>=2;){let i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))e.pop();else break}e.push(o)}e.pop();let r=[];for(let n=t.length-1;n>=0;n--){let o=t[n];for(;r.length>=2;){let i=r[r.length-1],a=r[r.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))r.pop();else break}r.push(o)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var x_e=jlr,zlr=Dlr,Ulr=Llr,qlr=Flr,aWe=klr;dn();var YO=x_e,Zn=zlr,Yn=Ulr,Hn=PY.forwardRef(({className:t,sideOffset:e=4,...r},n)=>PY.createElement(qlr,{container:activeDocument.body},PY.createElement(aWe,{ref:n,sideOffset:e,className:he("tw-z-[50] tw-overflow-hidden tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-secondary tw-px-3 tw-py-1.5 tw-text-xs tw-text-normal tw-animate-in tw-fade-in-0 tw-zoom-in-95 data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=closed]:tw-zoom-out-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",t),...r})));Hn.displayName=aWe.displayName;er();$t();fy();_t();Kde();bG();_n();var um=require("obsidian"),Ht=j(Z());async function FVn(){try{let{getSettings:t}=await Promise.resolve().then(()=>(_t(),_8));if(t().enableSemanticSearchV3){let n=await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().indexVaultToVectorStore(!1);new um.Notice(`Semantic search index refreshed with ${n} documents.`)}else new um.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(t){console.error("Error refreshing vault index:",t),new um.Notice("Failed to refresh vault index. Check console for details.")}}async function kVn(){try{let{getSettings:t}=await Promise.resolve().then(()=>(_t(),_8));if(t().enableSemanticSearchV3){let n=await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().indexVaultToVectorStore(!0);new um.Notice(`Semantic search index rebuilt with ${n} documents.`)}else new um.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(t){console.error("Error force reindexing vault:",t),new um.Notice("Failed to force reindex vault. Check console for details.")}}async function S_e(){let t=Su();if(!t){new um.Notice("No project is currently selected to reload.");return}try{kv(!0),await S_.getInstance().invalidateMarkdownContext(t,!0);let e=app.plugins.getPlugin("copilot");if(e&&e.projectManager)await e.projectManager.getProjectContext(t.id),new um.Notice(`Project context for "${t.name}" reloaded successfully.`);else throw new Error("Copilot plugin or ProjectManager not available.")}catch(e){ie("Error reloading project context:",e),GP(e)||new um.Notice("Failed to reload project context. Check console for details.")}finally{kv(!1)}}async function $Vn(){let t=Su();if(!t){new um.Notice("No project is currently selected to rebuild.");return}new Yl(app,async()=>{try{kv(!0),new um.Notice(`Force rebuilding context for project: ${t.name}... This will take some time and re-fetch all data.`,1e4),_G.resetRateLimitNoticeTimer(),await S_.getInstance().clearForProject(t),new um.Notice(`Cache for project "${t.name}" has been cleared.`);let r=app.plugins.getPlugin("copilot");if(r&&r.projectManager)await r.projectManager.getProjectContext(t.id),new um.Notice(`Project context for "${t.name}" rebuilt successfully from scratch.`);else throw new Error("Copilot plugin or ProjectManager not available for rebuild.")}catch(r){ie("Error force rebuilding project context:",r),GP(r)||new um.Notice("Failed to force rebuild project context. Check console for details.")}finally{kv(!1)}},`DANGER: This will permanently delete all cached data (markdown, web URLs, YouTube transcripts, and processed file content) for the project "${t.name}" from both memory and disk. The context will then be rebuilt from scratch, re-fetching all remote data and re-processing all local files. This cannot be undone. Are you absolutely sure?`,"Force Rebuild Project Context").open()}function Vlr({onNewChat:t,onSaveAsNote:e,onLoadHistory:r,onModeChange:n,onCloseProject:o}){let i=an(),[a,s]=Dp(),u=_4(),l=c=>{s(c),n(c),c!=="project"&&(Vj(null),o?.())};return Ht.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between tw-p-1"},Ht.default.createElement("div",{className:"tw-flex-1"},Ht.default.createElement(xY,null,Ht.default.createElement(SY,{asChild:!0},Ht.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-ml-1 tw-text-sm tw-text-muted"},a==="llm_chain"&&"chat (free)",a==="vault_qa"&&"vault QA (free)",a==="copilot_plus"&&Ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ht.default.createElement(Uf,{className:"tw-size-4"}),"copilot plus"),a==="project"&&"projects (alpha)",Ht.default.createElement($i,{className:"tw-mt-0.5 tw-size-5"}))),Ht.default.createElement(wh,{align:"start"},Ht.default.createElement(so,{onSelect:()=>{l("llm_chain")}},"chat (free)"),Ht.default.createElement(so,{onSelect:()=>{l("vault_qa")}},"vault QA (free)"),u?Ht.default.createElement(so,{onSelect:()=>{l("copilot_plus")}},Ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ht.default.createElement(Uf,{className:"tw-size-4"}),"copilot plus")):Ht.default.createElement(so,{onSelect:()=>{fD(jE.CHAT_MODE_SELECT),o?.()}},"copilot plus",Ht.default.createElement(ZE,{className:"tw-size-3"})),u?Ht.default.createElement(so,{className:"tw-flex tw-items-center tw-gap-1",onSelect:()=>{l("project")}},Ht.default.createElement(cD,{className:"tw-size-4"}),"projects (alpha)"):Ht.default.createElement(so,{onSelect:()=>{fD(jE.CHAT_MODE_SELECT),o?.()}},"copilot plus",Ht.default.createElement(ZE,{className:"tw-size-3"}))))),Ht.default.createElement("div",null,Ht.default.createElement(Zn,null,Ht.default.createElement(Yn,{asChild:!0},Ht.default.createElement(me,{variant:"ghost2",size:"icon",title:"New Chat",onClick:t},Ht.default.createElement(H5,{className:"tw-size-4"}))),Ht.default.createElement(Hn,null,"New Chat")),!i.autosaveChat&&Ht.default.createElement(Zn,null,Ht.default.createElement(Yn,{asChild:!0},Ht.default.createElement(me,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:e},Ht.default.createElement(N5,{className:"tw-size-4"}))),Ht.default.createElement(Hn,null,"Save Chat as Note")),Ht.default.createElement(Zn,null,Ht.default.createElement(Yn,{asChild:!0},Ht.default.createElement(me,{variant:"ghost2",size:"icon",title:"Chat History",onClick:r},Ht.default.createElement(z5,{className:"tw-size-4"}))),Ht.default.createElement(Hn,null,"Chat History")),Ht.default.createElement(xY,null,Ht.default.createElement(SY,{asChild:!0},Ht.default.createElement(me,{variant:"ghost2",size:"icon",title:"Advanced Settings"},Ht.default.createElement(kI,{className:"tw-size-4"}))),Ht.default.createElement(wh,{align:"end",className:"tw-w-64"},Ht.default.createElement(so,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),Xe("showSuggestedPrompts",!i.showSuggestedPrompts)}},Ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ht.default.createElement(Uf,{className:"tw-size-4"}),"Suggested Prompt"),Ht.default.createElement(gV,{checked:i.showSuggestedPrompts})),Ht.default.createElement(so,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),Xe("showRelevantNotes",!i.showRelevantNotes)}},Ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ht.default.createElement(zm,{className:"tw-size-4"}),"Relevant Note"),Ht.default.createElement(gV,{checked:i.showRelevantNotes})),a==="project"?Ht.default.createElement(Ht.default.Fragment,null,Ht.default.createElement(so,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>S_e()},Ht.default.createElement(Jv,{className:"tw-size-4"}),"Reload Current Project"),Ht.default.createElement(so,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>$Vn()},Ht.default.createElement($p,{className:"tw-size-4"}),"Force Rebuild Context")):Ht.default.createElement(Ht.default.Fragment,null,Ht.default.createElement(so,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>FVn()},Ht.default.createElement(Jv,{className:"tw-size-4"}),"Refresh Vault Index"),Ht.default.createElement(so,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>{new Yl(app,()=>kVn(),"This will delete and rebuild your entire vault index from scratch. This operation cannot be undone. Are you sure you want to proceed?","Force Reindex Vault").open()}},Ht.default.createElement($p,{className:"tw-size-4"}),"Force Reindex Vault"))))))}la();xu();var O_e=require("obsidian");var C_e=require("obsidian");kt();xu();var _V=class extends C_e.FuzzySuggestModal{constructor(e,r="copilot_plus"){super(e),this.activeNote=e.workspace.getActiveFile(),this.chainType=r}getOrderedNotes(e=[]){let r=this.app.workspace.getLastOpenFiles().map(a=>this.app.vault.getAbstractFileByPath(a)).filter(a=>a instanceof C_e.TFile&&oz(a,this.chainType)&&!e.includes(a.path)&&a.path!==this.activeNote?.path),o=this.app.vault.getFiles().filter(a=>oz(a,this.chainType)).filter(a=>!r.some(s=>s.path===a.path)&&!e.includes(a.path)&&a.path!==this.activeNote?.path);return[...this.activeNote&&oz(this.activeNote,this.chainType)?[this.activeNote]:[],...r,...o]}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n==="pdf"?o+=" (PDF)":n==="canvas"&&(o+=" (Canvas)"),o}};xu();kt();er();var wN=class extends _V{constructor({app:e,onNoteSelect:r,excludeNotePaths:n,titleOnly:o=!1,chainType:i="copilot_plus"}){super(e,i),this.onNoteSelect=r,this.availableNotes=this.getOrderedNotes(n),this.titleOnly=o}getItems(){if(this.titleOnly){let e=new Map;return this.availableNotes.forEach(r=>{e.set(r.basename,r)}),Array.from(e.values())}return this.availableNotes}getItemText(e){let r=e.path===this.activeNote?.path;return this.formatNoteTitle(e.basename,r,e.extension)}onChooseItem(e,r){if(!oz(e,this.chainType)){new O_e.Notice(dz.NON_MARKDOWN_FILES_RESTRICTED);return}this.onNoteSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof O_e.TFile){let o=n.createDiv(),i=e.item;o.setText(this.formatNoteTitle(i.basename,i===this.activeNote,i.extension)),this.titleOnly||n.createDiv({cls:"mt-1 text-muted text-xs"}).setText(i.path)}}};var E_e=class{constructor(e,r){this.app=e,this.onImagesSelected=r}open(){let e=document.createElement("input");e.type="file",e.accept="image/*",e.multiple=!0,e.style.display="none",e.addEventListener("change",()=>{let r=Array.from(e.files||[]);this.onImagesSelected(r),document.body.removeChild(e)}),document.body.appendChild(e),e.click()}};var Wlr=require("obsidian"),TY=class extends Wlr.FuzzySuggestModal{constructor(e,r,n,o=[]){super(e),this.promptTitles=r,this.onChoosePromptTitle=n,this.descriptions=o}getItems(){return this.promptTitles}getItemText(e){let r=this.promptTitles.indexOf(e),n=this.descriptions[r];return n?`${e} (${n})`:e}onChooseItem(e,r){let n=this.promptTitles.findIndex(i=>e.startsWith(i+" (")||e===i),o=n>=0?this.promptTitles[n]:e;this.onChoosePromptTitle(o)}};Un();var Ch=j(Z()),sWe=require("obsidian");Un();_t();kt();_n();dn();function P_e({disabled:t=!1,size:e="fit",variant:r="ghost2",className:n,value:o,onChange:i}){let[a,s]=(0,Ch.useState)(null),u=an(),l=u.activeModels.find(c=>c.enabled&&Qr(c)===o);return Ch.default.createElement(JO,null,Ch.default.createElement(ZO,{asChild:!0},Ch.default.createElement(me,{variant:r,size:e,disabled:t,className:he("tw-min-w-0 tw-justify-start tw-text-muted",n)},Ch.default.createElement("div",{className:"tw-min-w-0 tw-flex-1 tw-truncate"},a?Ch.default.createElement("span",{className:"tw-truncate tw-text-error"},"Model Load Failed"):l?Ch.default.createElement(j8e,{model:l,iconSize:8}):Ch.default.createElement("span",{className:"tw-truncate"},"Select Model")),!t&&Ch.default.createElement($i,{className:"tw-mt-0.5 tw-size-5 tw-shrink-0"}))),Ch.default.createElement(wh,{align:"start"},u.activeModels.filter(c=>c.enabled).map(c=>{let{hasApiKey:d,errorNotice:f}=sz(c,u);return Ch.default.createElement(so,{key:Qr(c),onSelect:async p=>{if(!d&&f){p.preventDefault(),new sWe.Notice(f);return}try{s(null),i(Qr(c))}catch(m){let h="Model switch failed: "+Fn(m);s(h),new sWe.Notice(h);let y=u.activeModels.find(g=>g.enabled&&Qr(g)===o);y&&i(Qr(y))}},className:d?"":"tw-cursor-not-allowed tw-opacity-50"},Ch.default.createElement(j8e,{model:c,iconSize:12}))})))}var gt=j(Z());_n();Un();xu();dn();_t();kt();var Klr=({vaultToggle:t,setVaultToggle:e,webToggle:r,setWebToggle:n,composerToggle:o,setComposerToggle:i,autonomousAgentToggle:a,setAutonomousAgentToggle:s,currentChain:u})=>{let l=Fh(u),c=l&&u!=="project",d=()=>{let f=!a;s(f),Xe("enableAutonomousAgent",f)};return l?gt.default.createElement(YO,{delayDuration:0},gt.default.createElement("div",{className:"tw-hidden tw-items-center tw-gap-1.5 @[420px]/chat-input:tw-flex"},c&&gt.default.createElement(Zn,null,gt.default.createElement(Yn,{asChild:!0},gt.default.createElement(me,{variant:"ghost2",size:"fit",onClick:d,className:he("tw-text-muted hover:tw-text-accent",a&&"tw-text-accent tw-bg-accent/10")},gt.default.createElement(Yz,{className:"tw-size-4"}))),gt.default.createElement(Hn,{className:"tw-px-1 tw-py-0.5"},"Toggle autonomous agent mode")),!a&&gt.default.createElement(gt.default.Fragment,null,gt.default.createElement(Zn,null,gt.default.createElement(Yn,{asChild:!0},gt.default.createElement(me,{variant:"ghost2",size:"fit",onClick:()=>e(!t),className:he("tw-text-muted hover:tw-text-accent",t&&"tw-text-accent tw-bg-accent/10")},gt.default.createElement(KE,{className:"tw-size-4"}))),gt.default.createElement(Hn,{className:"tw-px-1 tw-py-0.5"},"Toggle vault search")),gt.default.createElement(Zn,null,gt.default.createElement(Yn,{asChild:!0},gt.default.createElement(me,{variant:"ghost2",size:"fit",onClick:()=>n(!r),className:he("tw-text-muted hover:tw-text-accent",r&&"tw-text-accent tw-bg-accent/10")},gt.default.createElement(Zb,{className:"tw-size-4"}))),gt.default.createElement(Hn,{className:"tw-px-1 tw-py-0.5"},"Toggle web search")),gt.default.createElement(Zn,null,gt.default.createElement(Yn,{asChild:!0},gt.default.createElement(me,{variant:"ghost2",size:"fit",onClick:()=>i(!o),className:he("tw-text-muted hover:tw-text-accent",o&&"tw-text-accent tw-bg-accent/10")},gt.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},gt.default.createElement(Uf,{className:"tw-size-2"}),gt.default.createElement(Vh,{className:"tw-size-3"})))),gt.default.createElement(Hn,{className:"tw-px-1 tw-py-0.5"},"Toggle composer (note editing)")))),gt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-0.5 @[420px]/chat-input:tw-hidden"},gt.default.createElement(JO,null,gt.default.createElement(ZO,{asChild:!0},gt.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-text-muted hover:tw-text-accent"},gt.default.createElement(YE,{className:"tw-size-4"}))),gt.default.createElement(wh,{align:"end",className:"tw-w-56"},c&&gt.default.createElement(so,{onClick:d,className:"tw-flex tw-items-center tw-justify-between"},gt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},gt.default.createElement(Yz,{className:"tw-size-4"}),gt.default.createElement("span",null,"Autonomous Agent")),a&&gt.default.createElement(ds,{className:"tw-size-4"})),!a&&gt.default.createElement(gt.default.Fragment,null,gt.default.createElement(so,{onClick:()=>e(!t),className:"tw-flex tw-items-center tw-justify-between"},gt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},gt.default.createElement(KE,{className:"tw-size-4"}),gt.default.createElement("span",null,"Vault Search")),t&&gt.default.createElement(ds,{className:"tw-size-4"})),gt.default.createElement(so,{onClick:()=>n(!r),className:"tw-flex tw-items-center tw-justify-between"},gt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},gt.default.createElement(Zb,{className:"tw-size-4"}),gt.default.createElement("span",null,"Web Search")),r&&gt.default.createElement(ds,{className:"tw-size-4"})),gt.default.createElement(so,{onClick:()=>i(!o),className:"tw-flex tw-items-center tw-justify-between"},gt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},gt.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},gt.default.createElement(Uf,{className:"tw-size-2"}),gt.default.createElement(Vh,{className:"tw-size-3"})),gt.default.createElement("span",null,"Composer")),o&&gt.default.createElement(ds,{className:"tw-size-4"}))),a&&gt.default.createElement(gt.default.Fragment,null,gt.default.createElement(so,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},gt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},gt.default.createElement(KE,{className:"tw-size-4"}),gt.default.createElement("span",null,"Vault Search"))),gt.default.createElement(so,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},gt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},gt.default.createElement(Zb,{className:"tw-size-4"}),gt.default.createElement("span",null,"Web Search"))),gt.default.createElement(so,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},gt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},gt.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},gt.default.createElement(Uf,{className:"tw-size-2"}),gt.default.createElement(Vh,{className:"tw-size-3"})),gt.default.createElement("span",null,"Composer")))))))):null};la();er();kt();var T_e=require("obsidian");er();var vV=class t{constructor(){}static getInstance(){return t.instance||(t.instance=new t),t.instance}async processEmbeddedPDFs(e,r,n){let o=/!\[\[(.*?\.pdf)\]\]/g,i=[...e.matchAll(o)];for(let a of i){let s=a[1],u=r.getAbstractFileByPath(s);if(u instanceof T_e.TFile)try{let l=await n.parseFile(u,r);e=e.replace(a[0],`
<${T8}>
<name>${s}</name>
<content>
${l}
</content>
</${T8}>
`)}catch(l){console.error(`Error processing embedded PDF ${s}:`,l),e=e.replace(a[0],`
<${T8}>
<name>${s}</name>
<error>Could not process PDF</error>
</${T8}>
`)}}return e}async processContextNotes(e,r,n,o,i,a,s){let u="",l=async(d,f=E8)=>{try{if(e.has(d.path)){console.log(`Skipping note ${d.path} as it was included via custom prompt.`);return}if(console.log(`Processing note: ${d.path}, extension: ${d.extension}, chain: ${s}`),!r.supportsExtension(d.extension)){console.warn(`Unsupported file type: ${d.extension}`);return}if(!Fh(s)&&d.extension!=="md"&&d.extension!=="canvas"){console.warn(`File type ${d.extension} requires Copilot Plus mode for context processing.`),new T_e.Notice(dz.NON_MARKDOWN_FILES_RESTRICTED);return}let p=await r.parseFile(d,n);d.extension==="md"&&Fh(s)&&(p=await this.processEmbeddedPDFs(p,n,r));let m=await n.adapter.stat(d.path),h=m?new Date(m.ctime).toISOString():"Unknown",y=m?new Date(m.mtime).toISOString():"Unknown";u+=`
<${f}>
<title>${d.basename}</title>
<path>${d.path}</path>
<ctime>${h}</ctime>
<mtime>${y}</mtime>
<content>
${p}
</content>
</${f}>`}catch(p){console.error(`Error processing file ${d.path}:`,p),u+=`
<${f}_error>
<title>${d.basename}</title>
<path>${d.path}</path>
<error>[Error: Could not process file]</error>
</${f}_error>`}},c=new Set;i&&a&&(await l(a,"active_note"),c.add(a.path));for(let d of o)c.has(d.path)||(await l(d),c.add(d.path));return u}async hasEmbeddedPDFs(e){return/!\[\[(.*?\.pdf)\]\]/g.test(e)}async addNoteToContext(e,r,n,o,i,a){if(n.some(l=>l.path===e.path))return;let s=await r.read(e),u=await this.hasEmbeddedPDFs(s);o&&e.path===o.path&&a(!0),i(l=>[...l,Object.assign(e,{wasAddedViaReference:!0,hasEmbeddedPDFs:u})])}processSelectedTextContexts(){let e=Kj();if(!e||e.length===0)return"";let r="";for(let n of e)r+=`
<${Rm}>
<title>${n.noteTitle}</title>
<path>${n.notePath}</path>
<start_line>${n.startLine.toString()}</start_line>
<end_line>${n.endLine.toString()}</end_line>
<content>
${n.content}
</content>
</${Rm}>`;return r}};obe();kt();_t();C7();kt();_n();var xWe=require("obsidian"),jt=j(Z());var Bn=j(Z()),ea=j(tcr());function xN(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}var UVn=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function I$(t,e,r){let n=qVn(t),{webkitRelativePath:o}=t,i=typeof e=="string"?e:typeof o=="string"&&o.length>0?o:`./${t.name}`;return typeof n.path!="string"&&rcr(n,"path",i),r!==void 0&&Object.defineProperty(n,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),rcr(n,"relativePath",i),n}function qVn(t){let{name:e}=t;if(e&&e.lastIndexOf(".")!==-1&&!t.type){let n=e.split(".").pop().toLowerCase(),o=UVn.get(n);o&&Object.defineProperty(t,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return t}function rcr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!1,configurable:!1,enumerable:!0})}var HVn=[".DS_Store","Thumbs.db"];function lWe(t){return xN(this,void 0,void 0,function*(){return A_e(t)&&VVn(t.dataTransfer)?JVn(t.dataTransfer,t.type):WVn(t)?KVn(t):Array.isArray(t)&&t.every(e=>"getFile"in e&&typeof e.getFile=="function")?GVn(t):[]})}function VVn(t){return A_e(t)}function WVn(t){return A_e(t)&&A_e(t.target)}function A_e(t){return typeof t=="object"&&t!==null}function KVn(t){return uWe(t.target.files).map(e=>I$(e))}function GVn(t){return xN(this,void 0,void 0,function*(){return(yield Promise.all(t.map(r=>r.getFile()))).map(r=>I$(r))})}function JVn(t,e){return xN(this,void 0,void 0,function*(){if(t.items){let r=uWe(t.items).filter(o=>o.kind==="file");if(e!=="drop")return r;let n=yield Promise.all(r.map(ZVn));return ncr(icr(n))}return ncr(uWe(t.files).map(r=>I$(r)))})}function ncr(t){return t.filter(e=>HVn.indexOf(e.name)===-1)}function uWe(t){if(t===null)return[];let e=[];for(let r=0;r<t.length;r++){let n=t[r];e.push(n)}return e}function ZVn(t){if(typeof t.webkitGetAsEntry!="function")return ocr(t);let e=t.webkitGetAsEntry();return e&&e.isDirectory?acr(e):ocr(t,e)}function icr(t){return t.reduce((e,r)=>[...e,...Array.isArray(r)?icr(r):[r]],[])}function ocr(t,e){return xN(this,void 0,void 0,function*(){var r;if(globalThis.isSecureContext&&typeof t.getAsFileSystemHandle=="function"){let i=yield t.getAsFileSystemHandle();if(i===null)throw new Error(`${t} is not a File`);if(i!==void 0){let a=yield i.getFile();return a.handle=i,I$(a)}}let n=t.getAsFile();if(!n)throw new Error(`${t} is not a File`);return I$(n,(r=e?.fullPath)!==null&&r!==void 0?r:void 0)})}function YVn(t){return xN(this,void 0,void 0,function*(){return t.isDirectory?acr(t):XVn(t)})}function acr(t){let e=t.createReader();return new Promise((r,n)=>{let o=[];function i(){e.readEntries(a=>xN(this,void 0,void 0,function*(){if(a.length){let s=Promise.all(a.map(YVn));o.push(s),i()}else try{let s=yield Promise.all(o);r(s)}catch(s){n(s)}}),a=>{n(a)})}i()})}function XVn(t){return xN(this,void 0,void 0,function*(){return new Promise((e,r)=>{t.file(n=>{let o=I$(n,t.fullPath);e(o)},n=>{r(n)})})})}var I_e=j(scr());function ucr(t){return t6n(t)||e6n(t)||mcr(t)||QVn()}function QVn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e6n(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function t6n(t){if(Array.isArray(t))return dWe(t)}function lcr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function ccr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?lcr(Object(r),!0).forEach(function(n){pcr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lcr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function pcr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function AY(t,e){return o6n(t)||n6n(t,e)||mcr(t,e)||r6n()}function r6n(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mcr(t,e){if(t){if(typeof t=="string")return dWe(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return dWe(t,e)}}function dWe(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function n6n(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,s;try{for(r=r.call(t);!(o=(a=r.next()).done)&&(n.push(a.value),!(e&&n.length===e));o=!0);}catch(u){i=!0,s=u}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw s}}return n}}function o6n(t){if(Array.isArray(t))return t}var i6n=typeof I_e.default=="function"?I_e.default:I_e.default.default,a6n="file-invalid-type",s6n="file-too-large",u6n="file-too-small",l6n="too-many-files";var c6n=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=e.split(","),n=r.length>1?"one of ".concat(r.join(", ")):r[0];return{code:a6n,message:"File type must be ".concat(n)}},dcr=function(e){return{code:s6n,message:"File is larger than ".concat(e," ").concat(e===1?"byte":"bytes")}},fcr=function(e){return{code:u6n,message:"File is smaller than ".concat(e," ").concat(e===1?"byte":"bytes")}},hcr={code:l6n,message:"Too many files"};function fWe(t,e){var r=t.type==="application/x-moz-file"||i6n(t,e);return[r,r?null:c6n(e)]}function pWe(t,e,r){if(M$(t.size))if(M$(e)&&M$(r)){if(t.size>r)return[!1,dcr(r)];if(t.size<e)return[!1,fcr(e)]}else{if(M$(e)&&t.size<e)return[!1,fcr(e)];if(M$(r)&&t.size>r)return[!1,dcr(r)]}return[!0,null]}function M$(t){return t!=null}function gcr(t){var e=t.files,r=t.accept,n=t.minSize,o=t.maxSize,i=t.multiple,a=t.maxFiles,s=t.validator;return!i&&e.length>1||i&&a>=1&&e.length>a?!1:e.every(function(u){var l=fWe(u,r),c=AY(l,1),d=c[0],f=pWe(u,n,o),p=AY(f,1),m=p[0],h=s?s(u):null;return d&&m&&!h})}function IY(t){return typeof t.isPropagationStopped=="function"?t.isPropagationStopped():typeof t.cancelBubble<"u"?t.cancelBubble:!1}function MY(t){return t.dataTransfer?Array.prototype.some.call(t.dataTransfer.types,function(e){return e==="Files"||e==="application/x-moz-file"}):!!t.target&&!!t.target.files}function mWe(t){t.preventDefault()}function d6n(t){return t.indexOf("MSIE")!==-1||t.indexOf("Trident/")!==-1}function f6n(t){return t.indexOf("Edge/")!==-1}function ycr(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return d6n(t)||f6n(t)}function lv(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(n){for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return e.some(function(s){return!IY(n)&&s&&s.apply(void 0,[n].concat(i)),IY(n)})}}function bcr(){return"showOpenFilePicker"in window}function _cr(t){if(M$(t)){var e=Object.entries(t).filter(function(r){var n=AY(r,2),o=n[0],i=n[1],a=!0;return Scr(o)||(console.warn('Skipped "'.concat(o,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),a=!1),(!Array.isArray(i)||!i.every(Ccr))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),a=!1),a}).reduce(function(r,n){var o=AY(n,2),i=o[0],a=o[1];return ccr(ccr({},r),{},pcr({},i,a))},{});return[{description:"Files",accept:e}]}return t}function vcr(t){if(M$(t))return Object.entries(t).reduce(function(e,r){var n=AY(r,2),o=n[0],i=n[1];return[].concat(ucr(e),[o],ucr(i))},[]).filter(function(e){return Scr(e)||Ccr(e)}).join(",")}function wcr(t){return t instanceof DOMException&&(t.name==="AbortError"||t.code===t.ABORT_ERR)}function xcr(t){return t instanceof DOMException&&(t.name==="SecurityError"||t.code===t.SECURITY_ERR)}function Scr(t){return t==="audio/*"||t==="video/*"||t==="image/*"||t==="text/*"||t==="application/*"||/\w+\/[-+.\w]+/g.test(t)}function Ccr(t){return/^.*\.[\w]+$/.test(t)}var p6n=["children"],m6n=["open"],h6n=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],g6n=["refKey","onChange","onClick"];function y6n(t){return v6n(t)||_6n(t)||Pcr(t)||b6n()}function b6n(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _6n(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function v6n(t){if(Array.isArray(t))return gWe(t)}function hWe(t,e){return S6n(t)||x6n(t,e)||Pcr(t,e)||w6n()}function w6n(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pcr(t,e){if(t){if(typeof t=="string")return gWe(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return gWe(t,e)}}function gWe(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function x6n(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,s;try{for(r=r.call(t);!(o=(a=r.next()).done)&&(n.push(a.value),!(e&&n.length===e));o=!0);}catch(u){i=!0,s=u}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw s}}return n}}function S6n(t){if(Array.isArray(t))return t}function Ocr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function Ps(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ocr(Object(r),!0).forEach(function(n){yWe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ocr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function yWe(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function M_e(t,e){if(t==null)return{};var r=C6n(t,e),n,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)n=i[o],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function C6n(t,e){if(t==null)return{};var r={},n=Object.keys(t),o,i;for(i=0;i<n.length;i++)o=n[i],!(e.indexOf(o)>=0)&&(r[o]=t[o]);return r}var _We=(0,Bn.forwardRef)(function(t,e){var r=t.children,n=M_e(t,p6n),o=vWe(n),i=o.open,a=M_e(o,m6n);return(0,Bn.useImperativeHandle)(e,function(){return{open:i}},[i]),Bn.default.createElement(Bn.Fragment,null,r(Ps(Ps({},a),{},{open:i})))});_We.displayName="Dropzone";var Tcr={disabled:!1,getFilesFromEvent:lWe,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};_We.defaultProps=Tcr;_We.propTypes={children:ea.default.func,accept:ea.default.objectOf(ea.default.arrayOf(ea.default.string)),multiple:ea.default.bool,preventDropOnDocument:ea.default.bool,noClick:ea.default.bool,noKeyboard:ea.default.bool,noDrag:ea.default.bool,noDragEventsBubbling:ea.default.bool,minSize:ea.default.number,maxSize:ea.default.number,maxFiles:ea.default.number,disabled:ea.default.bool,getFilesFromEvent:ea.default.func,onFileDialogCancel:ea.default.func,onFileDialogOpen:ea.default.func,useFsAccessApi:ea.default.bool,autoFocus:ea.default.bool,onDragEnter:ea.default.func,onDragLeave:ea.default.func,onDragOver:ea.default.func,onDrop:ea.default.func,onDropAccepted:ea.default.func,onDropRejected:ea.default.func,onError:ea.default.func,validator:ea.default.func};var bWe={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function vWe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=Ps(Ps({},Tcr),t),r=e.accept,n=e.disabled,o=e.getFilesFromEvent,i=e.maxSize,a=e.minSize,s=e.multiple,u=e.maxFiles,l=e.onDragEnter,c=e.onDragLeave,d=e.onDragOver,f=e.onDrop,p=e.onDropAccepted,m=e.onDropRejected,h=e.onFileDialogCancel,y=e.onFileDialogOpen,g=e.useFsAccessApi,_=e.autoFocus,w=e.preventDropOnDocument,S=e.noClick,C=e.noKeyboard,E=e.noDrag,P=e.noDragEventsBubbling,T=e.onError,I=e.validator,N=(0,Bn.useMemo)(function(){return vcr(r)},[r]),M=(0,Bn.useMemo)(function(){return _cr(r)},[r]),D=(0,Bn.useMemo)(function(){return typeof y=="function"?y:Ecr},[y]),k=(0,Bn.useMemo)(function(){return typeof h=="function"?h:Ecr},[h]),L=(0,Bn.useRef)(null),H=(0,Bn.useRef)(null),K=(0,Bn.useReducer)(O6n,bWe),G=hWe(K,2),X=G[0],F=G[1],Q=X.isFocused,ee=X.isFileDialogActive,U=(0,Bn.useRef)(typeof window<"u"&&window.isSecureContext&&g&&bcr()),z=function(){!U.current&&ee&&setTimeout(function(){if(H.current){var fe=H.current.files;fe.length||(F({type:"closeDialog"}),k())}},300)};(0,Bn.useEffect)(function(){return window.addEventListener("focus",z,!1),function(){window.removeEventListener("focus",z,!1)}},[H,ee,k,U]);var V=(0,Bn.useRef)([]),q=function(fe){L.current&&L.current.contains(fe.target)||(fe.preventDefault(),V.current=[])};(0,Bn.useEffect)(function(){return w&&(document.addEventListener("dragover",mWe,!1),document.addEventListener("drop",q,!1)),function(){w&&(document.removeEventListener("dragover",mWe),document.removeEventListener("drop",q))}},[L,w]),(0,Bn.useEffect)(function(){return!n&&_&&L.current&&L.current.focus(),function(){}},[L,_,n]);var W=(0,Bn.useCallback)(function(oe){T?T(oe):console.error(oe)},[T]),J=(0,Bn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),Ie(oe),V.current=[].concat(y6n(V.current),[oe.target]),MY(oe)&&Promise.resolve(o(oe)).then(function(fe){if(!(IY(oe)&&!P)){var _e=fe.length,ge=_e>0&&gcr({files:fe,accept:N,minSize:a,maxSize:i,multiple:s,maxFiles:u,validator:I}),Le=_e>0&&!ge;F({isDragAccept:ge,isDragReject:Le,isDragActive:!0,type:"setDraggedFiles"}),l&&l(oe)}}).catch(function(fe){return W(fe)})},[o,l,W,P,N,a,i,s,u,I]),se=(0,Bn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),Ie(oe);var fe=MY(oe);if(fe&&oe.dataTransfer)try{oe.dataTransfer.dropEffect="copy"}catch{}return fe&&d&&d(oe),!1},[d,P]),be=(0,Bn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),Ie(oe);var fe=V.current.filter(function(ge){return L.current&&L.current.contains(ge)}),_e=fe.indexOf(oe.target);_e!==-1&&fe.splice(_e,1),V.current=fe,!(fe.length>0)&&(F({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),MY(oe)&&c&&c(oe))},[L,c,P]),ce=(0,Bn.useCallback)(function(oe,fe){var _e=[],ge=[];oe.forEach(function(Le){var dr=fWe(Le,N),Ii=hWe(dr,2),bi=Ii[0],_f=Ii[1],yp=pWe(Le,a,i),Vi=hWe(yp,2),gd=Vi[0],yd=Vi[1],vf=I?I(Le):null;if(bi&&gd&&!vf)_e.push(Le);else{var Wn=[_f,yd];vf&&(Wn=Wn.concat(vf)),ge.push({file:Le,errors:Wn.filter(function(MA){return MA})})}}),(!s&&_e.length>1||s&&u>=1&&_e.length>u)&&(_e.forEach(function(Le){ge.push({file:Le,errors:[hcr]})}),_e.splice(0)),F({acceptedFiles:_e,fileRejections:ge,isDragReject:ge.length>0,type:"setFiles"}),f&&f(_e,ge,fe),ge.length>0&&m&&m(ge,fe),_e.length>0&&p&&p(_e,fe)},[F,s,N,a,i,u,f,p,m,I]),pe=(0,Bn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),Ie(oe),V.current=[],MY(oe)&&Promise.resolve(o(oe)).then(function(fe){IY(oe)&&!P||ce(fe,oe)}).catch(function(fe){return W(fe)}),F({type:"reset"})},[o,ce,W,P]),Me=(0,Bn.useCallback)(function(){if(U.current){F({type:"openDialog"}),D();var oe={multiple:s,types:M};window.showOpenFilePicker(oe).then(function(fe){return o(fe)}).then(function(fe){ce(fe,null),F({type:"closeDialog"})}).catch(function(fe){wcr(fe)?(k(fe),F({type:"closeDialog"})):xcr(fe)?(U.current=!1,H.current?(H.current.value=null,H.current.click()):W(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):W(fe)});return}H.current&&(F({type:"openDialog"}),D(),H.current.value=null,H.current.click())},[F,D,k,g,ce,W,M,s]),Ue=(0,Bn.useCallback)(function(oe){!L.current||!L.current.isEqualNode(oe.target)||(oe.key===" "||oe.key==="Enter"||oe.keyCode===32||oe.keyCode===13)&&(oe.preventDefault(),Me())},[L,Me]),Et=(0,Bn.useCallback)(function(){F({type:"focus"})},[]),pr=(0,Bn.useCallback)(function(){F({type:"blur"})},[]),$r=(0,Bn.useCallback)(function(){S||(ycr()?setTimeout(Me,0):Me())},[S,Me]),On=function(fe){return n?null:fe},Br=function(fe){return C?null:On(fe)},Tr=function(fe){return E?null:On(fe)},Ie=function(fe){P&&fe.stopPropagation()},Ge=(0,Bn.useMemo)(function(){return function(){var oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},fe=oe.refKey,_e=fe===void 0?"ref":fe,ge=oe.role,Le=oe.onKeyDown,dr=oe.onFocus,Ii=oe.onBlur,bi=oe.onClick,_f=oe.onDragEnter,yp=oe.onDragOver,Vi=oe.onDragLeave,gd=oe.onDrop,yd=M_e(oe,h6n);return Ps(Ps(yWe({onKeyDown:Br(lv(Le,Ue)),onFocus:Br(lv(dr,Et)),onBlur:Br(lv(Ii,pr)),onClick:On(lv(bi,$r)),onDragEnter:Tr(lv(_f,J)),onDragOver:Tr(lv(yp,se)),onDragLeave:Tr(lv(Vi,be)),onDrop:Tr(lv(gd,pe)),role:typeof ge=="string"&&ge!==""?ge:"presentation"},_e,L),!n&&!C?{tabIndex:0}:{}),yd)}},[L,Ue,Et,pr,$r,J,se,be,pe,C,E,n]),Ne=(0,Bn.useCallback)(function(oe){oe.stopPropagation()},[]),le=(0,Bn.useMemo)(function(){return function(){var oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},fe=oe.refKey,_e=fe===void 0?"ref":fe,ge=oe.onChange,Le=oe.onClick,dr=M_e(oe,g6n),Ii=yWe({accept:N,multiple:s,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:On(lv(ge,pe)),onClick:On(lv(Le,Ne)),tabIndex:-1},_e,H);return Ps(Ps({},Ii),dr)}},[H,r,s,pe,n]);return Ps(Ps({},X),{},{isFocused:Q&&!n,getRootProps:Ge,getInputProps:le,rootRef:L,inputRef:H,open:On(Me)})}function O6n(t,e){switch(e.type){case"focus":return Ps(Ps({},t),{},{isFocused:!0});case"blur":return Ps(Ps({},t),{},{isFocused:!1});case"openDialog":return Ps(Ps({},bWe),{},{isFileDialogActive:!0});case"closeDialog":return Ps(Ps({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return Ps(Ps({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return Ps(Ps({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return Ps({},bWe);default:return t}}function Ecr(){}var kcr=j(Z());la();_n();var Cn=j(Z());Un();var R_e=j(Z());hre();dn();var E6n=Kz("tw-inline-flex tw-items-center tw-rounded-md tw-px-2.5 tw-py-0.5 tw-text-ui-smaller tw-text-normal tw-transition-colors focus:tw-outline-none",{variants:{variant:{default:"tw-bg-primary-alt tw-shadow",secondary:"tw-bg-secondary-alt",destructive:"tw-bg-modifier-error tw-shadow",outline:"tw-border tw-border-solid tw-border-border"}},defaultVariants:{variant:"default"}}),pp=R_e.forwardRef(({className:t,variant:e,...r},n)=>R_e.createElement("div",{ref:n,className:he(E6n({variant:e}),t),...r}));pp.displayName="Badge";xu();var N_e=j(Z());var Ncr=j(Z(),1);var Acr=j(Z(),1),P6n=j(qa(),1);Wv();var Icr=j(at(),1),T6n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mcr=T6n.reduce((t,e)=>{let r=zf(`Primitive.${e}`),n=Acr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Icr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var jcr=j(at(),1),A6n="Separator",Rcr="horizontal",I6n=["horizontal","vertical"],Dcr=Ncr.forwardRef((t,e)=>{let{decorative:r,orientation:n=Rcr,...o}=t,i=M6n(n)?n:Rcr,s=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return(0,jcr.jsx)(Mcr.div,{"data-orientation":i,...s,...o,ref:e})});Dcr.displayName=A6n;function M6n(t){return I6n.includes(t)}var wWe=Dcr;dn();var R$=N_e.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},o)=>N_e.createElement(wWe,{ref:o,decorative:r,orientation:e,className:he("tw-shrink-0 tw-bg-[var(--background-modifier-border)]",e==="horizontal"?"tw-h-px tw-w-full":"tw-h-full tw-w-px",t),...n}));R$.displayName=wWe.displayName;la();function Lcr({note:t,isActive:e=!1,onRemoveContext:r}){return Cn.default.createElement(pp,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Cn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Cn.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.basename),e&&Cn.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),t.extension==="pdf"&&Cn.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")),Cn.default.createElement(me,{variant:"ghost2",size:"fit",onClick:()=>r(t.path),"aria-label":"Remove from context",className:"tw-text-muted"},Cn.default.createElement(_i,{className:"tw-size-4"})))}function N6n({url:t,onRemoveUrl:e}){return Cn.default.createElement(pp,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Cn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Cn.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t),Cn.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Link")),Cn.default.createElement(me,{variant:"ghost2",size:"fit",onClick:()=>e(t),"aria-label":"Remove from context",className:"tw-text-muted"},Cn.default.createElement(_i,{className:"tw-size-4"})))}function j6n({selectedText:t,onRemoveSelectedText:e}){let r=t.startLine===t.endLine?`L${t.startLine}`:`L${t.startLine}-${t.endLine}`;return Cn.default.createElement(pp,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Cn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Cn.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.noteTitle),Cn.default.createElement("span",{className:"tw-text-xs tw-text-faint"},r)),Cn.default.createElement(me,{variant:"ghost2",size:"fit",onClick:()=>e(t.id),"aria-label":"Remove from context",className:"tw-text-muted"},Cn.default.createElement(_i,{className:"tw-size-4"})))}var Fcr=({activeNote:t,contextNotes:e,contextUrls:r,selectedTextContexts:n=[],onAddContext:o,onRemoveContext:i,onRemoveUrl:a,onRemoveSelectedText:s,showProgressCard:u})=>{let[l]=Dp(),c=kbe(),d=Cn.default.useMemo(()=>{let h=new Map(e.map(y=>[y.path,y]));return Array.from(h.values()).filter(y=>y.wasAddedManually?!0:!(t&&y.path===t.path))},[e,t]),f=Cn.default.useMemo(()=>Array.from(new Set(r)),[r]),p=d.length>0||f.length>0||n.length>0||!!t,m=()=>{switch(c){case"success":return Cn.default.createElement(NI,{className:"tw-size-4 tw-text-success"});case"loading":return Cn.default.createElement(iu,{className:"tw-size-4 tw-animate-spin tw-text-loading"});case"error":return Cn.default.createElement(Kv,{className:"tw-size-4 tw-text-error"});case"initial":return Cn.default.createElement(A5,{className:"tw-size-4 tw-text-faint"})}};return Cn.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-gap-1"},Cn.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},Cn.default.createElement(me,{onClick:o,variant:"ghost2",size:"fit",className:"tw-ml-1 tw-rounded-sm tw-border tw-border-solid tw-border-border tw-text-muted"},Cn.default.createElement(Wh,{className:"tw-size-4"}),!p&&Cn.default.createElement("span",{className:"tw-pr-1 tw-text-sm tw-leading-4"},"Add context"))),Cn.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-wrap tw-gap-1"},t&&Cn.default.createElement(Lcr,{key:t.path,note:t,isActive:!0,onRemoveContext:i}),d.map(h=>Cn.default.createElement(Lcr,{key:h.path,note:h,isActive:!1,onRemoveContext:i})),f.map(h=>Cn.default.createElement(N6n,{key:h,url:h,onRemoveUrl:a})),n.map(h=>Cn.default.createElement(j6n,{key:h.id,selectedText:h,onRemoveSelectedText:s||(()=>{})}))),l==="project"&&Cn.default.createElement(Cn.default.Fragment,null,Cn.default.createElement(R$,{orientation:"vertical"}),Cn.default.createElement("div",{className:""},Cn.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>u()},m()))))};var D6n=({app:t,excludeNotePaths:e,contextNotes:r,setContextNotes:n,includeActiveNote:o,setIncludeActiveNote:i,activeNote:a,contextUrls:s,onRemoveUrl:u,selectedTextContexts:l,onRemoveSelectedText:c,showProgressCard:d})=>{let[f]=Dp();return kcr.default.createElement(Fcr,{activeNote:o?a:null,contextNotes:r,onAddContext:()=>{new wN({app:t,onNoteSelect:h=>{a&&h.path===a.path?(i(!0),n(y=>y.filter(g=>g.path!==h.path))):n(y=>[...y,Object.assign(h,{wasAddedManually:!0})])},excludeNotePaths:e,chainType:f}).open()},onRemoveContext:h=>{let y=r.find(_=>_.path===h);y&&y.wasAddedManually?n(_=>_.filter(w=>w.path!==h)):(i(!1),n(_=>_.filter(w=>w.path!==h)))},contextUrls:s,onRemoveUrl:u,selectedTextContexts:l,onRemoveSelectedText:c,showProgressCard:d})},$cr=D6n;var Bcr=(0,jt.forwardRef)(({inputMessage:t,setInputMessage:e,handleSendMessage:r,isGenerating:n,onStopGenerating:o,app:i,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,mention:c,selectedImages:d,onAddImage:f,setSelectedImages:p,disableModelSwitch:m,selectedTextContexts:h,onRemoveSelectedText:y,showProgressCard:g},_)=>{let[w,S]=(0,jt.useState)([]),C=(0,jt.useRef)(null),E=(0,jt.useRef)(null),[P,T]=lI(),[I]=Dp(),[N]=Wee(),M=an(),[D,k]=(0,jt.useState)(()=>{let Ge=i.workspace.getActiveFile();return dCe(Ge)?Ge:null}),[L,H]=(0,jt.useState)(null),K=Fh(I),[G,X]=(0,jt.useState)(!1),[F,Q]=(0,jt.useState)(!1),[ee,U]=(0,jt.useState)(!1),[z,V]=(0,jt.useState)(M.enableAutonomousAgent),[q,W]=(0,jt.useState)(0),J=["Loading the project context...","Processing context files...","If you have many files in context, this can take a while..."];(0,jt.useImperativeHandle)(_,()=>({focus:()=>{C.current?.focus()}})),(0,jt.useEffect)(()=>{I==="project"?V(!1):V(M.enableAutonomousAgent)},[M.enableAutonomousAgent,I]),(0,jt.useEffect)(()=>{if(I==="project"){H(Su());let Ge=gz(Ne=>{H(Ne)});return()=>{Ge()}}else H(null)},[I]),(0,jt.useEffect)(()=>{if(!N)return;let Ge=setInterval(()=>{W(Ne=>(Ne+1)%J.length)},3e3);return()=>clearInterval(Ge)},[N,J.length]);let se=()=>L&&I==="project"&&L.projectModelKey?L.projectModelKey:P,be=()=>{if(!K){r();return}let Ge=[];z||(G&&Ge.push("@vault"),F&&Ge.push("@websearch"),ee&&Ge.push("@composer")),r({toolCalls:Ge,contextNotes:a,urls:w})},ce=async Ge=>{let Ne=Ge.target.value,le=Ge.target.selectionStart,oe=le>0&&Ne[le-1]==="/"&&(le===1||Ne[le-2]===" ");e(Ne),pe();let _e=c.extractAllUrls(Ne).filter(ge=>!w.includes(ge));_e.length>0&&Fh(I)&&S(ge=>Array.from(new Set([...ge,..._e]))),le>=2&&Ne.slice(le-2,le)==="[["?Me(le):oe?Ue(le,Ne):Ne.slice(-1)==="@"&&K&&Et()},pe=()=>{C.current&&(C.current.style.height="auto",C.current.style.height=`${C.current.scrollHeight}px`)};(0,jt.useEffect)(()=>{pe()},[t]);let Me=Ge=>{(async()=>{let le=vV.getInstance();new wN({app:i,onNoteSelect:async oe=>{let fe=t.slice(0,Ge-2),_e=t.slice(Ge-1),Le=fCe(oe.basename,i.vault)?oe.basename:oe.path,dr=`${fe}[[${Le}]]${_e}`;e(dr);let Ii=i.workspace.getActiveFile();oe&&await le.addNoteToContext(oe,i.vault,a,Ii,s,l),setTimeout(()=>{if(C.current){let bi=Ge+Le.length+2;C.current.setSelectionRange(bi,bi)}},0)},excludeNotePaths:Ie}).open()})()},Ue=(Ge,Ne)=>{let le=Ac.getInstance(),oe=cp(),fe=Nbe(oe.filter(dr=>dr.showInSlashMenu)),_e=fe.map(dr=>dr.title),ge=Ge-1;new TY(i,_e,dr=>{let Ii=fe.find(bi=>bi.title===dr);if(Ii){le.recordUsage(Ii);let bi="",_f="";ge>=0&&Ne[ge]==="/"&&(bi=Ne.slice(0,ge),_f=Ne.slice(ge+1));let yp=bi+Ii.content+_f;e(yp),setTimeout(()=>{if(C.current){let Vi=bi.length+Ii.content.length;C.current.setSelectionRange(Vi,Vi),C.current.focus()}},0)}}).open()},Et=()=>{let Ge=zZ.map(Ne=>({title:Ne,description:dtr(Ne)}));new TY(i,Ge.map(Ne=>Ne.title),Ne=>{e(t+Ne+" ")},Ge.map(Ne=>Ne.description)).open()},pr=Ge=>{if(!Ge.nativeEvent.isComposing&&Ge.key==="Enter"){if(!(!Ge.shiftKey&&!xWe.Platform.isMobile||Ge.shiftKey&&xWe.Platform.isMobile))return;Ge.preventDefault(),be()}},$r=(0,jt.useCallback)(async Ge=>{let Ne=Ge.clipboardData?.items;if(!Ne)return;let le=Array.from(Ne).filter(oe=>oe.type.indexOf("image")!==-1);if(le.length>0){Ge.preventDefault();let fe=(await Promise.all(le.map(_e=>{let ge=_e.getAsFile();return ge||null}))).filter(_e=>_e!==null);fe.length>0&&f(fe)}},[f]);(0,jt.useEffect)(()=>{let Ge=new Set(Zg(t,i.vault)),Ne=c.extractAllUrls(t);s(le=>le.filter(oe=>{if(oe.wasAddedManually===!0)return!0;let _e=oe.wasAddedViaReference===!0;return oe.path===D?.path?_e?Ge.has(oe):u:_e?Ge.has(oe):!0})),Fh(I)?S(le=>le.filter(oe=>Ne.includes(oe))):S([])},[t,u,D,c,s,i.vault,I]),(0,jt.useEffect)(()=>{let Ge,Ne=()=>{clearTimeout(Ge),Ge=setTimeout(()=>{let oe=i.workspace.getActiveFile();k(dCe(oe)?oe:null)},100)},le=i.workspace.on("active-leaf-change",Ne);return()=>{clearTimeout(Ge),i.workspace.offref(le)}},[i.workspace]);let{getRootProps:On,getInputProps:Br,isDragActive:Tr}=vWe({accept:{"image/*":[".png",".gif",".jpeg",".jpg",".webp"]},onDrop:Ge=>{f(Ge)},noClick:!0,noDragEventsBubbling:!0}),Ie=(0,jt.useMemo)(()=>[...a.map(Ge=>Ge.path),...u&&D?[D.path]:[]].filter(Ge=>Ge!=null),[a,u,D]);return jt.default.createElement("div",{className:"tw-flex tw-w-full tw-flex-col tw-gap-0.5 tw-rounded-md tw-border tw-border-solid tw-border-border tw-px-1 tw-pb-1 tw-pt-2 tw-@container/chat-input",ref:E},jt.default.createElement($cr,{app:i,excludeNotePaths:Ie,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,activeNote:D,contextUrls:w,onRemoveUrl:Ge=>S(Ne=>Ne.filter(le=>le!==Ge)),selectedTextContexts:h,onRemoveSelectedText:y,showProgressCard:g}),d.length>0&&jt.default.createElement("div",{className:"selected-images"},d.map((Ge,Ne)=>jt.default.createElement("div",{key:Ne,className:"image-preview-container"},jt.default.createElement("img",{src:URL.createObjectURL(Ge),alt:Ge.name,className:"selected-image-preview"}),jt.default.createElement("button",{className:"remove-image-button",onClick:()=>p(le=>le.filter((oe,fe)=>fe!==Ne)),title:"Remove image"},jt.default.createElement(_i,{className:"tw-size-4"}))))),jt.default.createElement("div",{className:"tw-relative",...On()},N&&jt.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-bg-primary tw-opacity-80 tw-backdrop-blur-sm"},jt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},jt.default.createElement(iu,{className:"tw-size-4 tw-animate-spin"}),jt.default.createElement("span",{className:"tw-text-sm"},J[q]))),jt.default.createElement("textarea",{ref:C,className:"tw-max-h-40 tw-min-h-[60px] tw-w-full tw-resize-none tw-overflow-y-auto tw-rounded-md tw-border-none tw-bg-transparent tw-px-2 tw-text-sm tw-text-normal placeholder:tw-text-sm placeholder:tw-text-muted/60 focus-visible:tw-ring-0",placeholder:"Ask anything. [[ for notes. / for custom prompts. "+(K?"@ for tools.":""),value:t,onChange:ce,onKeyDown:pr,onPaste:$r,disabled:N}),jt.default.createElement("input",{...Br()}),Tr&&jt.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-flex tw-items-center tw-justify-center tw-rounded-md tw-border tw-border-dashed tw-bg-primary"},jt.default.createElement("span",null,"Drop images here..."))),jt.default.createElement("div",{className:"tw-flex tw-h-6 tw-justify-between tw-gap-1 tw-px-1"},n?jt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-px-1 tw-text-sm tw-text-muted"},jt.default.createElement(iu,{className:"tw-size-3 tw-animate-spin"}),jt.default.createElement("span",null,"Generating...")):jt.default.createElement("div",{className:"tw-min-w-0 tw-flex-1"},jt.default.createElement(P_e,{variant:"ghost2",size:"fit",disabled:m,value:se(),onChange:Ge=>{I!=="project"&&T(Ge)},className:"tw-max-w-full tw-truncate"})),jt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},n?jt.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>o()},jt.default.createElement(DI,{className:"tw-size-4"}),"Stop"):jt.default.createElement(jt.default.Fragment,null,jt.default.createElement(Klr,{vaultToggle:G,setVaultToggle:X,webToggle:F,setWebToggle:Q,composerToggle:ee,setComposerToggle:U,autonomousAgentToggle:z,setAutonomousAgentToggle:V,currentChain:I}),jt.default.createElement(YO,{delayDuration:0},jt.default.createElement(Zn,null,jt.default.createElement(Yn,{asChild:!0},jt.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-text-muted hover:tw-text-accent",onClick:()=>{new E_e(i,f).open()}},jt.default.createElement(U5,{className:"tw-size-4"}))),jt.default.createElement(Hn,{className:"tw-px-1 tw-py-0.5"},"Add image(s)"))),jt.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>be()},jt.default.createElement(Jb,{className:"!tw-size-3"}),jt.default.createElement("span",null,"chat"))))))});Bcr.displayName="ChatInput";var zcr=Bcr;Un();er();dn();_n();var Ucr=require("obsidian"),Fr=j(Z()),qcr=({message:t,onCopy:e,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>Fr.default.createElement("div",{className:he("tw-flex tw-gap-1",{"group-hover:opacity-100 opacity-0":!Ucr.Platform.isMobile})},t.sender===So?Fr.default.createElement(Fr.default.Fragment,null,Fr.default.createElement(Zn,null,Fr.default.createElement(Yn,{asChild:!0},Fr.default.createElement(me,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?Fr.default.createElement(ds,{className:"tw-size-4"}):Fr.default.createElement(Bm,{className:"tw-size-4"}))),Fr.default.createElement(Hn,null,"Copy")),Fr.default.createElement(Zn,null,Fr.default.createElement(Yn,{asChild:!0},Fr.default.createElement(me,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},Fr.default.createElement(Um,{className:"tw-size-4"}))),Fr.default.createElement(Hn,null,"Edit")),Fr.default.createElement(Zn,null,Fr.default.createElement(Yn,{asChild:!0},Fr.default.createElement(me,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Fr.default.createElement(qm,{className:"tw-size-4"}))),Fr.default.createElement(Hn,null,"Delete"))):Fr.default.createElement(Fr.default.Fragment,null,u&&Fr.default.createElement(Zn,null,Fr.default.createElement(Yn,{asChild:!0},Fr.default.createElement(me,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},Fr.default.createElement(cD,{className:"tw-size-4"}))),Fr.default.createElement(Hn,null,"Show Sources")),Fr.default.createElement(Zn,null,Fr.default.createElement(Yn,{asChild:!0},Fr.default.createElement(me,{onClick:n,variant:"ghost2",size:"fit",title:"Insert / Replace at cursor"},Fr.default.createElement(G5,{className:"tw-size-4"}))),Fr.default.createElement(Hn,null,"Insert / Replace at cursor")),Fr.default.createElement(Zn,null,Fr.default.createElement(Yn,{asChild:!0},Fr.default.createElement(me,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?Fr.default.createElement(ds,{className:"tw-size-4"}):Fr.default.createElement(Bm,{className:"tw-size-4"}))),Fr.default.createElement(Hn,null,"Copy")),Fr.default.createElement(Zn,null,Fr.default.createElement(Yn,{asChild:!0},Fr.default.createElement(me,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},Fr.default.createElement(K5,{className:"tw-size-4"}))),Fr.default.createElement(Hn,null,"Regenerate")),Fr.default.createElement(Zn,null,Fr.default.createElement(Yn,{asChild:!0},Fr.default.createElement(me,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Fr.default.createElement(qm,{className:"tw-size-4"}))),Fr.default.createElement(Hn,null,"Delete"))));var rs=j(Z());_n();var ff=j(Z(),1);function Hcr(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Wcr=j(Z(),1);function Vcr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function SWe(...t){return e=>{let r=!1,n=t.map(o=>{let i=Vcr(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():Vcr(t[o],null)}}}}function Kcr(...t){return Wcr.useCallback(SWe(...t),t)}var Gcr=j(Z(),1),B6n=j(qa(),1);var df=j(Z(),1);var wV=j(at(),1),OWe=df.forwardRef((t,e)=>{let{children:r,...n}=t,o=df.Children.toArray(r),i=o.find(F6n);if(i){let a=i.props.children,s=o.map(u=>u===i?df.Children.count(a)>1?df.Children.only(null):df.isValidElement(a)?a.props.children:null:u);return(0,wV.jsx)(CWe,{...n,ref:e,children:df.isValidElement(a)?df.cloneElement(a,void 0,s):null})}return(0,wV.jsx)(CWe,{...n,ref:e,children:r})});OWe.displayName="Slot";var CWe=df.forwardRef((t,e)=>{let{children:r,...n}=t;if(df.isValidElement(r)){let o=$6n(r);return df.cloneElement(r,{...k6n(n,r.props),ref:e?SWe(e,o):o})}return df.Children.count(r)>1?df.Children.only(null):null});CWe.displayName="SlotClone";var L6n=({children:t})=>(0,wV.jsx)(wV.Fragment,{children:t});function F6n(t){return df.isValidElement(t)&&t.type===L6n}function k6n(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function $6n(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Jcr=j(at(),1),z6n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],j_e=z6n.reduce((t,e)=>{let r=Gcr.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?OWe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Jcr.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var N$=j(at(),1),EWe="Collapsible",[U6n,eWi]=ts(EWe),[q6n,PWe]=U6n(EWe),Zcr=ff.forwardRef((t,e)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=t,[u=!1,l]=im({prop:n,defaultProp:o,onChange:a});return(0,N$.jsx)(q6n,{scope:r,disabled:i,contentId:Xl(),open:u,onOpenToggle:ff.useCallback(()=>l(c=>!c),[l]),children:(0,N$.jsx)(j_e.div,{"data-state":MWe(u),"data-disabled":i?"":void 0,...s,ref:e})})});Zcr.displayName=EWe;var Ycr="CollapsibleTrigger",TWe=ff.forwardRef((t,e)=>{let{__scopeCollapsible:r,...n}=t,o=PWe(Ycr,r);return(0,N$.jsx)(j_e.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":MWe(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:e,onClick:Hcr(t.onClick,o.onOpenToggle)})});TWe.displayName=Ycr;var AWe="CollapsibleContent",IWe=ff.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=PWe(AWe,t.__scopeCollapsible);return(0,N$.jsx)(of,{present:r||o.open,children:({present:i})=>(0,N$.jsx)(H6n,{...n,ref:e,present:i})})});IWe.displayName=AWe;var H6n=ff.forwardRef((t,e)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=t,a=PWe(AWe,r),[s,u]=ff.useState(n),l=ff.useRef(null),c=Kcr(e,l),d=ff.useRef(0),f=d.current,p=ff.useRef(0),m=p.current,h=a.open||s,y=ff.useRef(h),g=ff.useRef(void 0);return ff.useEffect(()=>{let _=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(_)},[]),vo(()=>{let _=l.current;if(_){g.current=g.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";let w=_.getBoundingClientRect();d.current=w.height,p.current=w.width,y.current||(_.style.transitionDuration=g.current.transitionDuration,_.style.animationName=g.current.animationName),u(n)}},[a.open,n]),(0,N$.jsx)(j_e.div,{"data-state":MWe(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!h,...i,ref:c,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...t.style},children:h&&o})});function MWe(t){return t?"open":"closed"}var Xcr=Zcr;var cv=Xcr,gA=TWe,dv=IWe;dn();K6e();var W6n="shimmer 2s ease-in-out infinite",RWe=({toolName:t,displayName:e,emoji:r,isExecuting:n,result:o,confirmationMessage:i,onAccept:a,onReject:s})=>{let[u,l]=(0,rs.useState)(!1),c=!n&&o!==null;return rs.default.createElement(cv,{open:u,onOpenChange:l,disabled:!c,"aria-disabled":!c,className:"tw-my-3 tw-w-full sm:tw-max-w-sm"},rs.default.createElement("div",{className:he("tw-rounded-md tw-border tw-border-border tw-bg-secondary/50",n&&"tw-relative tw-overflow-hidden")},n&&rs.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-z-[1] tw-overflow-hidden"},rs.default.createElement("div",{className:"tw-absolute tw-inset-0 -tw-translate-x-full",style:{background:"linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%)",animation:W6n}})),rs.default.createElement(gA,{className:he("tw-flex tw-w-full tw-items-center tw-justify-between tw-px-3 tw-py-2.5 tw-text-sm sm:tw-px-4 sm:tw-py-3",c&&"hover:tw-bg-secondary/70",!c&&"tw-cursor-default")},rs.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},rs.default.createElement("span",{className:"tw-text-base"},r),rs.default.createElement("span",{className:"tw-font-medium"},n?"Calling":"Called"," ",e,n&&"..."),n&&i&&rs.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"\u2022 ",i,"...")),rs.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},!n&&a&&s&&rs.default.createElement(rs.default.Fragment,null,rs.default.createElement("button",{onClick:d=>{d.stopPropagation(),a()},className:"hover:tw-bg-green-rgb/20 tw-rounded tw-p-1",title:"Accept"},rs.default.createElement(ds,{className:"tw-size-4 tw-text-success"})),rs.default.createElement("button",{onClick:d=>{d.stopPropagation(),s()},className:"hover:tw-bg-red-rgb/20 tw-rounded tw-p-1",title:"Reject"},rs.default.createElement(_i,{className:"tw-size-4 tw-text-error"}))),c&&rs.default.createElement($m,{className:he("tw-size-4 tw-text-muted tw-transition-transform",u&&"tw-rotate-90")}))),rs.default.createElement(dv,null,rs.default.createElement("div",{className:"tw-border-t tw-border-border tw-px-3 tw-py-2.5 sm:tw-px-4 sm:tw-py-3"},rs.default.createElement("div",{className:"tw-text-sm tw-text-muted"},rs.default.createElement("pre",{className:"tw-overflow-x-auto tw-whitespace-pre-wrap tw-font-mono tw-text-xs"},o?qH.format(t,o):"No result available"))))))};var Qcr=require("obsidian"),D_e=class extends Qcr.Modal{constructor(e,r){super(e),this.sources=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Sources"}),this.createSourceList(e,this.sources)}createSourceList(e,r){let n=e.createEl("ul");n.style.listStyleType="none",n.style.padding="0",r.forEach(o=>{let i=n.createEl("li");i.style.marginBottom="1em";let a=i.createDiv();a.style.cursor="pointer";let s=a.createSpan();s.style.marginRight="0.5em",s.style.display="inline-block",s.style.width="1em",s.style.transition="transform 0.2s",s.textContent=o.explanation?"\u25B6":"";let u=o.path&&o.path!==o.title?`${o.title} (${o.path})`:o.title,l=a.createEl("a",{href:`obsidian://open?vault=${encodeURIComponent(this.app.vault.getName())}&file=${encodeURIComponent(o.path||o.title)}`,text:u});l.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),this.app.workspace.openLinkText(o.path||o.title,"")}),typeof o.score=="number"&&a.appendChild(document.createTextNode(` - Relevance score: ${o.score.toFixed(4)}`));let c=null;o.explanation&&(c=this.addExplanation(i,o.explanation),c.style.display="none",a.addEventListener("click",d=>{if(d.target!==l&&c){let f=c.style.display!=="none";c.style.display=f?"none":"block",s.style.transform=f?"":"rotate(90deg)"}}))})}addExplanation(e,r){let n=e.createDiv({cls:"search-explanation"});n.style.marginTop="0.5em",n.style.marginLeft="2.5em",n.style.fontSize="0.9em",n.style.color="var(--text-muted)",n.style.borderLeft="2px solid var(--background-modifier-border)",n.style.paddingLeft="0.5em";let o=[];if(r.lexicalMatches&&r.lexicalMatches.length>0){let i=new Set(r.lexicalMatches.map(s=>s.field)),a=new Set(r.lexicalMatches.map(s=>s.query));o.push(`Lexical: matched "${Array.from(a).join('", "')}" in ${Array.from(i).join(", ")}`)}if(r.semanticScore!==void 0&&r.semanticScore>0&&o.push(`Semantic: ${(r.semanticScore*100).toFixed(1)}% similarity`),r.folderBoost&&o.push(`Folder boost: ${r.folderBoost.boostFactor.toFixed(2)}x (${r.folderBoost.documentCount} docs in ${r.folderBoost.folder||"root"})`),r.graphConnections){let i=r.graphConnections,a=[];i.backlinks>0&&a.push(`${i.backlinks} backlinks`),i.coCitations>0&&a.push(`${i.coCitations} co-citations`),i.sharedTags>0&&a.push(`${i.sharedTags} shared tags`),a.length>0&&o.push(`Graph connections: ${i.score.toFixed(1)} score (${a.join(", ")})`)}return r.graphBoost&&!r.graphConnections&&o.push(`Graph boost: ${r.graphBoost.boostFactor.toFixed(2)}x (${r.graphBoost.connections} connections)`),r.baseScore!==r.finalScore&&o.push(`Score: ${r.baseScore.toFixed(4)} \u2192 ${r.finalScore.toFixed(4)}`),o.length>0&&o.forEach(i=>{let a=n.createEl("div");a.style.marginBottom="0.25em",a.textContent=`\u2022 ${i}`}),n}onClose(){let{contentEl:e}=this;e.empty()}};Un();_n();var fv=j(Z()),edr=require("obsidian"),jn=({content:t,children:e,side:r="bottom",delayDuration:n=0,contentClassName:o,buttonClassName:i})=>{let a=edr.Platform.isMobile,[s,u]=(0,fv.useState)(!1),l=fv.default.useRef(!1),c=()=>{a&&(l.current=!0)},d=()=>{a&&(u(!s),setTimeout(()=>{l.current=!1},100))};return fv.default.createElement(YO,{delayDuration:n},fv.default.createElement(Zn,{open:s,onOpenChange:f=>{a&&l.current||u(f)}},fv.default.createElement(Yn,{asChild:!0},e?fv.default.createElement("div",{onClick:d,onTouchStart:c,className:"tw-cursor-pointer"},e):fv.default.createElement(me,{variant:"ghost",size:"sm",onClick:d,onTouchStart:c,className:`tw-inline-flex tw-size-6 tw-items-center tw-justify-center tw-p-0 hover:tw-bg-transparent hover:tw-text-normal ${i||""}`},fv.default.createElement(jI,{className:"tw-size-4"}))),fv.default.createElement(Hn,{side:r,className:o},t)))};er();dn();x4();y7();_t();kt();var j$=require("obsidian"),Zr=j(Z()),tdr=j(Bc()),K6n=/^\d+-\d+$/,G6n=t=>{let e=t.querySelector(".footnotes");e?(e.querySelectorAll("hr, hr.footnotes-sep").forEach(r=>r.remove()),e.querySelectorAll("a.footnote-backref, a.footnote-link.footnote-backref").forEach(r=>r.remove())):t.querySelectorAll("a.footnote-backref, a.footnote-link.footnote-backref").forEach(r=>r.remove()),t.querySelectorAll('a.footnote-ref, sup a[href^="#fn"], sup a[href^="#fn-"], a[href^="#fn"], a[href^="#fn-"]').forEach(r=>{let n=r.textContent?.trim()??"";if(!n||!K6n.test(n))return;let[o]=n.split("-");o&&o!==n&&(r.textContent=o)})};function J6n({context:t}){return!t||!t.notes?.length&&!t.urls?.length?null:Zr.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-gap-2"},t.notes.map((e,r)=>Zr.default.createElement(jn,{key:`${r}-${e.path}`,content:e.path,side:"top"},Zr.default.createElement(pp,{variant:"secondary"},Zr.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e.basename)))),t.urls.map((e,r)=>Zr.default.createElement(jn,{key:`${r}-${e}`,content:e,side:"top"},Zr.default.createElement(pp,{variant:"secondary"},Zr.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e)))))}var Z6n=({message:t,app:e,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i,chatHistory:a=[]})=>{let s=an(),[u,l]=(0,Zr.useState)(!1),[c,d]=(0,Zr.useState)(!1),[f,p]=(0,Zr.useState)(t.message),m=(0,Zr.useRef)(null),h=(0,Zr.useRef)(null),y=(0,Zr.useRef)(null),g=(0,Zr.useRef)(!1),_=(0,Zr.useRef)(t.timestamp?.epoch?String(t.timestamp.epoch):`temp-${Date.now()}-${Math.random()}`),w=()=>(window.__copilotToolCallRoots||(window.__copilotToolCallRoots=new Map),window.__copilotToolCallRoots),C=(0,Zr.useRef)((()=>{let G=w();return G.has(_.current)||G.set(_.current,new Map),G.get(_.current)})()),E=()=>{if(!navigator.clipboard||!navigator.clipboard.writeText)return;let G=Mee(t.message);navigator.clipboard.writeText(G).then(()=>{l(!0),setTimeout(()=>{l(!1)},2e3)})},P=(0,Zr.useCallback)(G=>{let X=e.workspace.getActiveFile(),F=X?X.path:"",Q=(ce,pe,Me,Ue)=>{let Et="margin: 0.5rem 0 1.5rem; padding: 0.75rem; border: 1px solid var(--background-modifier-border); border-radius: 4px; background-color: var(--background-secondary)",pr="cursor: pointer; color: var(--text-muted); font-size: 0.8em; margin-bottom: 0.5rem; user-select: none",$r="margin-top: 0.75rem; padding: 0.75rem; border-radius: 4px; background-color: var(--background-primary)",On=`<${pe}>`;if(r&&ce.includes(On)){let Tr=new RegExp(`<${pe}>([\\s\\S]*?)<\\/${pe}>`,"g");ce=ce.replace(Tr,(Ge,Ne)=>`<details style="${Et}">
<summary style="${pr}">${Me}</summary>
<div class="tw-text-muted" style="${$r}">${Ne.trim()}</div>
</details>
`);let Ie=new RegExp(`<${pe}>([\\s\\S]*)$`);return ce=ce.replace(Ie,(Ge,Ne)=>`<div style="${Et}">
<div style="${pr}">${Ue}</div>
<div class="tw-text-muted" style="${$r}">${Ne.trim()}</div>
</div>`),ce}let Br=new RegExp(`<${pe}>([\\s\\S]*?)<\\/${pe}>`,"g");return ce.replace(Br,(Tr,Ie)=>`<details style="${Et}">
<summary style="${pr}">${Me}</summary>
<div class="tw-text-muted" style="${$r}">${Ie.trim()}</div>
</details>
`)},ee=ce=>Q(ce,"think","Thought for a while","Thinking..."),U=ce=>{let pe=Et=>{let pr=/```(?:xml)?\s*([\s\S]*?<writeToFile>[\s\S]*?<\/writeToFile>[\s\S]*?)\s*```/g;return Et.replace(pr,($r,On)=>On.trim())},Me=Et=>{if(!r)return Et;let pr=/```xml\s*([\s\S]*?<writeToFile>[\s\S]*?)$/g;return Et.replace(pr,($r,On)=>On.trim())},Ue=pe(ce);return Ue=Me(Ue),Q(Ue,"writeToFile","Generated new content","Generating changes...")},z=(ce,pe,Me)=>ce.split(/(```[\s\S]*?```|`[^`]*`)/g).map((Et,pr)=>pr%2===0?Et.replace(pe,($r,On)=>{let Br=e.metadataCache.getFirstLinkpathDest(On,F);return Br?Me(Br):$r}):Et).join(""),V=G.replace(/\\\[\s*/g,"$$").replace(/\s*\\\]/g,"$$").replace(/\\\(\s*/g,"$").replace(/\s*\\\)/g,"$"),q=z(V,/!\[\[(.*?)]]/g,ce=>`![](${e.vault.getResourcePath(ce)})`),W=ee(q),J=U(W),se=Wer(J,s.enableInlineCitations);return z(se,/(?<!!)\[\[([^\]]+)]]/g,ce=>`<a href="obsidian://open?file=${encodeURIComponent(ce.path)}">${ce.basename}</a>`)},[e,r,s.enableInlineCitations]);(0,Zr.useEffect)(()=>{if(g.current=!1,m.current&&t.sender!==So){h.current||(h.current=new j$.Component);let G=P(t.message),X=Dze(G);if(!g.current){let F=new Set;m.current.querySelectorAll('[id^="tool-call-"]').forEach(V=>{let q=V.id.replace("tool-call-","");F.add(q)}),m.current.querySelectorAll(".message-segment").forEach(V=>V.remove());let U=0;X.segments.forEach((V,q)=>{if(V.type==="text"&&V.content.trim()){let W=m.current.children[U],J=document.createElement("div");J.className="message-segment",W?m.current.insertBefore(J,W):m.current.appendChild(J),j$.MarkdownRenderer.renderMarkdown(V.content,J,"",h.current),G6n(J),U++}else if(V.type==="toolCall"&&V.toolCall){let W=V.toolCall.id;if(document.getElementById(`tool-call-${W}`)){let se=C.current.get(W);se&&!g.current&&se.render(Zr.default.createElement(RWe,{toolName:V.toolCall.toolName,displayName:V.toolCall.displayName,emoji:V.toolCall.emoji,isExecuting:V.toolCall.isExecuting,result:V.toolCall.result||null,confirmationMessage:V.toolCall.confirmationMessage})),U++}else{let se=m.current.children[U],be=document.createElement("div");be.className="tool-call-container",be.id=`tool-call-${W}`,se?m.current.insertBefore(be,se):m.current.appendChild(be);let ce=tdr.default.createRoot(be);C.current.set(W,ce),g.current||ce.render(Zr.default.createElement(RWe,{toolName:V.toolCall.toolName,displayName:V.toolCall.displayName,emoji:V.toolCall.emoji,isExecuting:V.toolCall.isExecuting,result:V.toolCall.result||null,confirmationMessage:V.toolCall.confirmationMessage})),U++}}});let z=new Set(X.segments.filter(V=>V.type==="toolCall"&&V.toolCall).map(V=>V.toolCall.id));F.forEach(V=>{if(!z.has(V)){let q=document.getElementById(`tool-call-${V}`);if(q){let W=C.current.get(V);W&&setTimeout(()=>{try{W.unmount()}catch(J){console.debug("Error unmounting tool call root:",J)}C.current.delete(V)},0),q.remove()}}})}}return()=>{g.current=!0}},[t,e,h,r,P]),(0,Zr.useEffect)(()=>{let G=h,X=_.current;return(()=>{let Q=w(),ee=Date.now()-60*60*1e3;Q.forEach((U,z)=>{let V=parseInt(z);!isNaN(V)&&V<ee&&setTimeout(()=>{U.forEach(q=>{try{q.unmount()}catch{}}),Q.delete(z)},0)})})(),()=>{g.current=!0,setTimeout(()=>{if(G.current&&(G.current.unload(),G.current=null),X.startsWith("temp-")){let Q=w(),ee=Q.get(X);ee&&(ee.forEach(U=>{try{U.unmount()}catch(z){console.debug("Error unmounting React root during cleanup:",z)}}),Q.delete(X))}},0)}},[]),(0,Zr.useEffect)(()=>{c&&y.current&&T(y.current)},[c]),(0,Zr.useEffect)(()=>{p(t.message)},[t.message]);let T=G=>{G.style.height="auto",G.style.height=`${G.scrollHeight}px`},I=G=>{p(G.target.value),T(G.target)},N=G=>{G.nativeEvent.isComposing||(G.key==="Enter"&&!G.shiftKey?(G.preventDefault(),k()):G.key==="Escape"&&(G.preventDefault(),M()))},M=()=>{d(!1),p(t.message)},D=()=>{d(!0)},k=()=>{d(!1),o&&o(f)},L=()=>{t.sources&&t.sources.length>0&&new D_e(e,t.sources).open()},H=()=>{let G=e.workspace.getMostRecentLeaf();if((!G||!(G.view instanceof j$.MarkdownView))&&(G=e.workspace.getLeaf(!1),!G||!(G.view instanceof j$.MarkdownView)))return;let F=G.view.editor.getSelection().length>0,Q=Mee(t.message);x8(Q,F)},K=()=>t.content?Zr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3"},t.content.map((G,X)=>G.type==="text"?Zr.default.createElement("div",{key:X},t.sender===So&&c?Zr.default.createElement("textarea",{ref:y,value:f,onChange:I,onKeyDown:N,autoFocus:!0,className:"edit-textarea"}):t.sender===So?Zr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):Zr.default.createElement("div",{ref:m,className:t.isErrorMessage?"tw-text-error":""})):G.type==="image_url"?Zr.default.createElement("div",{key:X,className:"message-image-content"},Zr.default.createElement("img",{src:G.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):t.sender===So&&c?Zr.default.createElement("textarea",{ref:y,value:f,onChange:I,onKeyDown:N,autoFocus:!0,className:"edit-textarea"}):t.sender===So?Zr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):Zr.default.createElement("div",{ref:m,className:t.isErrorMessage?"tw-text-error":""});return Zr.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},Zr.default.createElement("div",{className:he("tw-group tw-mx-2 tw-rounded-md tw-p-2",t.sender===So&&"tw-border tw-border-solid tw-border-border"),style:t.sender===So?{backgroundColor:"var(--background-modifier-hover)"}:void 0},Zr.default.createElement("div",{className:"tw-flex tw-max-w-full tw-flex-col tw-gap-2 tw-overflow-hidden"},!c&&Zr.default.createElement(J6n,{context:t.context}),Zr.default.createElement("div",{className:"message-content"},K()),!r&&Zr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},Zr.default.createElement("div",{className:"tw-text-xs tw-text-faint"},t.timestamp?.display),Zr.default.createElement(qcr,{message:t,onCopy:E,isCopied:u,onInsertIntoEditor:H,onRegenerate:n,onEdit:D,onDelete:i,onShowSources:L,hasSources:!!(t.sources&&t.sources.length>0)})))))},NWe=Z6n;Un();var LY=j(Z());var ns=j(Z(),1);function XO(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var ndr=j(Z(),1);function rdr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function jWe(...t){return e=>{let r=!1,n=t.map(o=>{let i=rdr(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():rdr(t[o],null)}}}}function pv(...t){return ndr.useCallback(jWe(...t),t)}var Ts=j(Z(),1);var odr=j(Z(),1),idr=j(qa(),1);var pf=j(Z(),1);var xV=j(at(),1),RY=pf.forwardRef((t,e)=>{let{children:r,...n}=t,o=pf.Children.toArray(r),i=o.find(X6n);if(i){let a=i.props.children,s=o.map(u=>u===i?pf.Children.count(a)>1?pf.Children.only(null):pf.isValidElement(a)?a.props.children:null:u);return(0,xV.jsx)(DWe,{...n,ref:e,children:pf.isValidElement(a)?pf.cloneElement(a,void 0,s):null})}return(0,xV.jsx)(DWe,{...n,ref:e,children:r})});RY.displayName="Slot";var DWe=pf.forwardRef((t,e)=>{let{children:r,...n}=t;if(pf.isValidElement(r)){let o=e8n(r);return pf.cloneElement(r,{...Q6n(n,r.props),ref:e?jWe(e,o):o})}return pf.Children.count(r)>1?pf.Children.only(null):null});DWe.displayName="SlotClone";var Y6n=({children:t})=>(0,xV.jsx)(xV.Fragment,{children:t});function X6n(t){return pf.isValidElement(t)&&t.type===Y6n}function Q6n(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function e8n(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var adr=j(at(),1),t8n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],lm=t8n.reduce((t,e)=>{let r=odr.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?RY:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,adr.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function sdr(t,e){t&&idr.flushSync(()=>t.dispatchEvent(e))}var FWe=j(at(),1),r8n="DismissableLayer",LWe="dismissableLayer.update",n8n="dismissableLayer.pointerDownOutside",o8n="dismissableLayer.focusOutside",udr,cdr=Ts.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),kWe=Ts.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ts.useContext(cdr),[c,d]=Ts.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ts.useState({}),m=pv(e,P=>d(P)),h=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(y),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=g,C=s8n(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=u8n(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return nN(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Ts.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(udr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),ldr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=udr)}},[c,f,r,l]),Ts.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),ldr())},[c,l]),Ts.useEffect(()=>{let P=()=>p({});return document.addEventListener(LWe,P),()=>document.removeEventListener(LWe,P)},[]),(0,FWe.jsx)(lm.div,{...u,ref:m,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:XO(t.onFocusCapture,E.onFocusCapture),onBlurCapture:XO(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:XO(t.onPointerDownCapture,C.onPointerDownCapture)})});kWe.displayName=r8n;var i8n="DismissableLayerBranch",a8n=Ts.forwardRef((t,e)=>{let r=Ts.useContext(cdr),n=Ts.useRef(null),o=pv(e,n);return Ts.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,FWe.jsx)(lm.div,{...t,ref:o})});a8n.displayName=i8n;function s8n(t,e=globalThis?.document){let r=un(t),n=Ts.useRef(!1),o=Ts.useRef(()=>{});return Ts.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){ddr(n8n,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function u8n(t,e=globalThis?.document){let r=un(t),n=Ts.useRef(!1);return Ts.useEffect(()=>{let o=i=>{i.target&&!n.current&&ddr(o8n,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function ldr(){let t=new CustomEvent(LWe);document.dispatchEvent(t)}function ddr(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?sdr(o,i):o.dispatchEvent(i)}var _b=j(Z(),1);var gdr=j(at(),1),$We="focusScope.autoFocusOnMount",BWe="focusScope.autoFocusOnUnmount",fdr={bubbles:!1,cancelable:!0},l8n="FocusScope",zWe=_b.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=_b.useState(null),l=un(o),c=un(i),d=_b.useRef(null),f=pv(e,h=>u(h)),p=_b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_b.useEffect(()=>{if(n){let _=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:SN(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||SN(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let T of E)T.removedNodes.length>0&&SN(s)};var h=_,y=w,g=S;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(S);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),_b.useEffect(()=>{if(s){mdr.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent($We,fdr);s.addEventListener($We,l),s.dispatchEvent(g),g.defaultPrevented||(c8n(h8n(ydr(s)),{select:!0}),document.activeElement===h&&SN(s))}return()=>{s.removeEventListener($We,l),setTimeout(()=>{let g=new CustomEvent(BWe,fdr);s.addEventListener(BWe,c),s.dispatchEvent(g),g.defaultPrevented||SN(h??document.body,{select:!0}),s.removeEventListener(BWe,c),mdr.remove(p)},0)}}},[s,l,c,p]);let m=_b.useCallback(h=>{if(!r&&!n||p.paused)return;let y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(y&&g){let _=h.currentTarget,[w,S]=d8n(_);w&&S?!h.shiftKey&&g===S?(h.preventDefault(),r&&SN(w,{select:!0})):h.shiftKey&&g===w&&(h.preventDefault(),r&&SN(S,{select:!0})):g===_&&h.preventDefault()}},[r,n,p.paused]);return(0,gdr.jsx)(lm.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});zWe.displayName=l8n;function c8n(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(SN(n,{select:e}),document.activeElement!==r)return}function d8n(t){let e=ydr(t),r=pdr(e,t),n=pdr(e.reverse(),t);return[r,n]}function ydr(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{let o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function pdr(t,e){for(let r of t)if(!f8n(r,{upTo:e}))return r}function f8n(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function p8n(t){return t instanceof HTMLInputElement&&"select"in t}function SN(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&p8n(t)&&e&&t.select()}}var mdr=m8n();function m8n(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=hdr(t,e),t.unshift(e)},remove(e){t=hdr(t,e),t[0]?.resume()}}}function hdr(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function h8n(t){return t.filter(e=>e.tagName!=="A")}var Ag=j(Z(),1);var bdr=j(Z(),1);var UWe=j(at(),1),g8n="Arrow",_dr=bdr.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,UWe.jsx)(lm.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,UWe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});_dr.displayName=g8n;var vdr=_dr;var CN=j(at(),1);var qWe="Popper",[wdr,HWe]=ts(qWe),[b8n,xdr]=wdr(qWe),Sdr=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Ag.useState(null);return(0,CN.jsx)(b8n,{scope:e,anchor:n,onAnchorChange:o,children:r})};Sdr.displayName=qWe;var Cdr="PopperAnchor",Odr=Ag.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=xdr(Cdr,r),a=Ag.useRef(null),s=pv(e,a);return Ag.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,CN.jsx)(lm.div,{...o,ref:s})});Odr.displayName=Cdr;var VWe="PopperContent",[_8n,v8n]=wdr(VWe),Edr=Ag.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,y=xdr(VWe,r),[g,_]=Ag.useState(null),w=pv(e,J=>_(J)),[S,C]=Ag.useState(null),E=J1(S),P=E?.width??0,T=E?.height??0,I=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},M=Array.isArray(l)?l:[l],D=M.length>0,k={padding:N,boundary:M.filter(x8n),altBoundary:D},{refs:L,floatingStyles:H,placement:K,isPositioned:G,middlewareData:X}=aN({strategy:"fixed",placement:I,whileElementsMounted:(...J)=>pA(...J,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[sN({mainAxis:o+T,alignmentAxis:a}),u&&uN({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?lN():void 0,...k}),u&&cN({...k}),dN({...k,apply:({elements:J,rects:se,availableWidth:be,availableHeight:ce})=>{let{width:pe,height:Me}=se.reference,Ue=J.floating.style;Ue.setProperty("--radix-popper-available-width",`${be}px`),Ue.setProperty("--radix-popper-available-height",`${ce}px`),Ue.setProperty("--radix-popper-anchor-width",`${pe}px`),Ue.setProperty("--radix-popper-anchor-height",`${Me}px`)}}),S&&pN({element:S,padding:s}),S8n({arrowWidth:P,arrowHeight:T}),f&&fN({strategy:"referenceHidden",...k})]}),[F,Q]=Adr(K),ee=un(m);vo(()=>{G&&ee?.()},[G,ee]);let U=X.arrow?.x,z=X.arrow?.y,V=X.arrow?.centerOffset!==0,[q,W]=Ag.useState();return vo(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,CN.jsx)("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:G?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:q,"--radix-popper-transform-origin":[X.transformOrigin?.x,X.transformOrigin?.y].join(" "),...X.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,CN.jsx)(_8n,{scope:r,placedSide:F,onArrowChange:C,arrowX:U,arrowY:z,shouldHideArrow:V,children:(0,CN.jsx)(lm.div,{"data-side":F,"data-align":Q,...h,ref:w,style:{...h.style,animation:G?void 0:"none"}})})})});Edr.displayName=VWe;var Pdr="PopperArrow",w8n={top:"bottom",right:"left",bottom:"top",left:"right"},Tdr=Ag.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=v8n(Pdr,n),a=w8n[i.placedSide];return(0,CN.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,CN.jsx)(vdr,{...o,ref:r,style:{...o.style,display:"block"}})})});Tdr.displayName=Pdr;function x8n(t){return t!==null}var S8n=t=>({name:"transformOrigin",options:t,fn(e){let{placement:r,rects:n,middlewareData:o}=e,a=o.arrow?.centerOffset!==0,s=a?0:t.arrowWidth,u=a?0:t.arrowHeight,[l,c]=Adr(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function Adr(t){let[e,r="center"]=t.split("-");return[e,r]}var Idr=Sdr,WWe=Odr,Mdr=Edr,Rdr=Tdr;var L_e=j(Z(),1),Ndr=j(qa(),1);var jdr=j(at(),1),O8n="Portal",KWe=L_e.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=L_e.useState(!1);vo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Ndr.default.createPortal((0,jdr.jsx)(lm.div,{...n,ref:e}),a):null});KWe.displayName=O8n;var $_e=j(Z());var mp=j(Z());var F_e=C$();var GWe=function(){},NY=mp.forwardRef(function(t,e){var r=mp.useRef(null),n=mp.useState({onScrollCapture:GWe,onWheelCapture:GWe,onTouchMoveCapture:GWe}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,y=t.as,g=y===void 0?"div":y,_=t.gapMode,w=bN(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,C=S$([r,e]),E=Di(Di({},w),o);return mp.createElement(mp.Fragment,null,c&&mp.createElement(S,{sideCar:F_e,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:_}),a?mp.cloneElement(mp.Children.only(s),Di(Di({},E),{ref:C})):mp.createElement(g,Di({},E,{className:u,ref:C}),s))});NY.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};NY.classNames={fullWidth:av,zeroRight:iv};var La=j(Z());var JWe=!1;if(typeof window<"u")try{jY=Object.defineProperty({},"passive",{get:function(){return JWe=!0,!0}}),window.addEventListener("test",jY,jY),window.removeEventListener("test",jY,jY)}catch{JWe=!1}var jY,D$=JWe?{passive:!1}:!1;var E8n=function(t){return t.tagName==="TEXTAREA"},Ddr=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!E8n(t)&&r[e]==="visible")},P8n=function(t){return Ddr(t,"overflowY")},T8n=function(t){return Ddr(t,"overflowX")},ZWe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=Ldr(t,n);if(o){var i=Fdr(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},A8n=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},I8n=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},Ldr=function(t,e){return t==="v"?P8n(e):T8n(e)},Fdr=function(t,e){return t==="v"?A8n(e):I8n(e)},M8n=function(t,e){return t==="h"&&e==="rtl"?-1:1},kdr=function(t,e,r,n,o){var i=M8n(t,window.getComputedStyle(e).direction),a=i*n,s=r.target,u=e.contains(s),l=!1,c=a>0,d=0,f=0;do{var p=Fdr(t,s),m=p[0],h=p[1],y=p[2],g=h-y-i*m;(m||g)&&Ldr(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var k_e=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},$dr=function(t){return[t.deltaX,t.deltaY]},Bdr=function(t){return t&&"current"in t?t.current:t},R8n=function(t,e){return t[0]===e[0]&&t[1]===e[1]},N8n=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},j8n=0,SV=[];function zdr(t){var e=La.useRef([]),r=La.useRef([0,0]),n=La.useRef(),o=La.useState(j8n++)[0],i=La.useState(mA)[0],a=La.useRef(t);La.useEffect(function(){a.current=t},[t]),La.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=fV([t.lockRef.current],(t.shards||[]).map(Bdr),!0).filter(Boolean);return h.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=La.useCallback(function(h,y){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=k_e(h),_=r.current,w="deltaX"in h?h.deltaX:_[0]-g[0],S="deltaY"in h?h.deltaY:_[1]-g[1],C,E=h.target,P=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in h&&P==="h"&&E.type==="range")return!1;var T=ZWe(P,E);if(!T)return!0;if(T?C=P:(C=P==="v"?"h":"v",T=ZWe(P,E)),!T)return!1;if(!n.current&&"changedTouches"in h&&(w||S)&&(n.current=C),!C)return!0;var I=n.current||C;return kdr(I,y,h,I==="h"?w:S,!0)},[]),u=La.useCallback(function(h){var y=h;if(!(!SV.length||SV[SV.length-1]!==i)){var g="deltaY"in y?$dr(y):k_e(y),_=e.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&R8n(C.delta,g)})[0];if(_&&_.should){y.cancelable&&y.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(Bdr).filter(Boolean).filter(function(C){return C.contains(y.target)}),S=w.length>0?s(y,w[0]):!a.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),l=La.useCallback(function(h,y,g,_){var w={name:h,delta:y,target:g,should:_,shadowParent:D8n(g)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),c=La.useCallback(function(h){r.current=k_e(h),n.current=void 0},[]),d=La.useCallback(function(h){l(h.type,$dr(h),h.target,s(h,t.lockRef.current))},[]),f=La.useCallback(function(h){l(h.type,k_e(h),h.target,s(h,t.lockRef.current))},[]);La.useEffect(function(){return SV.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,D$),document.addEventListener("touchmove",u,D$),document.addEventListener("touchstart",c,D$),function(){SV=SV.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,D$),document.removeEventListener("touchmove",u,D$),document.removeEventListener("touchstart",c,D$)}},[]);var p=t.removeScrollBar,m=t.inert;return La.createElement(La.Fragment,null,m?La.createElement(i,{styles:N8n(o)}):null,p?La.createElement(E$,{gapMode:t.gapMode}):null)}function D8n(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var Udr=O$(F_e,zdr);var qdr=$_e.forwardRef(function(t,e){return $_e.createElement(NY,Di({},t,{ref:e,sideCar:Udr}))});qdr.classNames=NY.classNames;var YWe=qdr;var tc=j(at(),1),XWe="Popover",[Hdr,z9i]=ts(XWe,[HWe]),DY=HWe(),[L8n,ON]=Hdr(XWe),Vdr=t=>{let{__scopePopover:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=t,s=DY(e),u=ns.useRef(null),[l,c]=ns.useState(!1),[d=!1,f]=im({prop:n,defaultProp:o,onChange:i});return(0,tc.jsx)(Idr,{...s,children:(0,tc.jsx)(L8n,{scope:e,contentId:Xl(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:ns.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:ns.useCallback(()=>c(!0),[]),onCustomAnchorRemove:ns.useCallback(()=>c(!1),[]),modal:a,children:r})})};Vdr.displayName=XWe;var Wdr="PopoverAnchor",F8n=ns.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=ON(Wdr,r),i=DY(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return ns.useEffect(()=>(a(),()=>s()),[a,s]),(0,tc.jsx)(WWe,{...i,...n,ref:e})});F8n.displayName=Wdr;var Kdr="PopoverTrigger",Gdr=ns.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=ON(Kdr,r),i=DY(r),a=pv(e,o.triggerRef),s=(0,tc.jsx)(lm.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Qdr(o.open),...n,ref:a,onClick:XO(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,tc.jsx)(WWe,{asChild:!0,...i,children:s})});Gdr.displayName=Kdr;var QWe="PopoverPortal",[k8n,$8n]=Hdr(QWe,{forceMount:void 0}),Jdr=t=>{let{__scopePopover:e,forceMount:r,children:n,container:o}=t,i=ON(QWe,e);return(0,tc.jsx)(k8n,{scope:e,forceMount:r,children:(0,tc.jsx)(of,{present:r||i.open,children:(0,tc.jsx)(KWe,{asChild:!0,container:o,children:n})})})};Jdr.displayName=QWe;var CV="PopoverContent",Zdr=ns.forwardRef((t,e)=>{let r=$8n(CV,t.__scopePopover),{forceMount:n=r.forceMount,...o}=t,i=ON(CV,t.__scopePopover);return(0,tc.jsx)(of,{present:n||i.open,children:i.modal?(0,tc.jsx)(B8n,{...o,ref:e}):(0,tc.jsx)(z8n,{...o,ref:e})})});Zdr.displayName=CV;var B8n=ns.forwardRef((t,e)=>{let r=ON(CV,t.__scopePopover),n=ns.useRef(null),o=pv(e,n),i=ns.useRef(!1);return ns.useEffect(()=>{let a=n.current;if(a)return yN(a)},[]),(0,tc.jsx)(YWe,{as:RY,allowPinchZoom:!0,children:(0,tc.jsx)(Ydr,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:XO(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:XO(t.onPointerDownOutside,a=>{let s=a.detail.originalEvent,u=s.button===0&&s.ctrlKey===!0,l=s.button===2||u;i.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:XO(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),z8n=ns.forwardRef((t,e)=>{let r=ON(CV,t.__scopePopover),n=ns.useRef(!1),o=ns.useRef(!1);return(0,tc.jsx)(Ydr,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(n.current||r.triggerRef.current?.focus(),i.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));let a=i.target;r.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),Ydr=ns.forwardRef((t,e)=>{let{__scopePopover:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onInteractOutside:c,...d}=t,f=ON(CV,r),p=DY(r);return oN(),(0,tc.jsx)(zWe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,tc.jsx)(kWe,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,tc.jsx)(Mdr,{"data-state":Qdr(f.open),role:"dialog",id:f.contentId,...p,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Xdr="PopoverClose",U8n=ns.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=ON(Xdr,r);return(0,tc.jsx)(lm.button,{type:"button",...n,ref:e,onClick:XO(t.onClick,()=>o.onOpenChange(!1))})});U8n.displayName=Xdr;var q8n="PopoverArrow",H8n=ns.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=DY(r);return(0,tc.jsx)(Rdr,{...o,...n,ref:e})});H8n.displayName=q8n;function Qdr(t){return t?"open":"closed"}var efr=Vdr;var tfr=Gdr,rfr=Jdr,e9e=Zdr;dn();var nfr=efr,ofr=tfr;var t9e=LY.forwardRef(({className:t,align:e="center",sideOffset:r=4,container:n,...o},i)=>LY.createElement(rfr,{container:n??activeDocument.body},LY.createElement(e9e,{ref:i,align:e,sideOffset:r,className:he("tw-z-popover tw-w-72 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-4 tw-text-normal tw-shadow-md tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",t),...o})));t9e.displayName=e9e.displayName;er();var r9e=j(Z()),B_e=r9e.createContext(void 0),OV=r9e.createContext(void 0);var EV=j(Z());function n9e(){let[t,e]=(0,EV.useState)(null),r=(0,EV.useContext)(OV);return(0,EV.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();e(o)};return r?.addEventListener(Qg.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(Qg.ACTIVE_LEAF_CHANGE,n)}},[r]),t}dn();_n();var FY=require("obsidian"),it=j(Z());function W8n(t){let[e,r]=(0,it.useState)([]),n=n9e();return(0,it.useEffect)(()=>{async function o(){if(n?.path)try{let a=await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().getDb();if(!a){r([]);return}let s=await vbe({db:a,filePath:n.path});r(s)}catch(i){console.warn("Failed to fetch relevant notes:",i),r([])}}o()},[n?.path,t]),e}function K8n(t,e){let[r,n]=(0,it.useState)(!0);return(0,it.useEffect)(()=>{if(!t)return;async function o(){try{let a=await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().hasIndex(t);n(a)}catch{n(!1)}}o()},[t,e]),r}function G8n({score:t}){let e=_be(t),r="\u{1F534}";return e===2&&(r="\u{1F7E0}"),e===3&&(r="\u{1F7E2}"),it.default.createElement("span",{className:"tw-text-sm"},r)}function J8n({note:t,onAddToChat:e,onNavigateToNote:r}){let[n,o]=(0,it.useState)(!1),[i,a]=(0,it.useState)(null),s=(0,it.useCallback)(async()=>{if(i)return;let u=app.vault.getAbstractFileByPath(t.document.path);if(u instanceof FY.TFile){let l=await app.vault.cachedRead(u),c=l;if(l.startsWith("---")){let d=l.indexOf("---",3);d!==-1&&(c=l.slice(d+3).trim())}a(c.slice(0,1e3)+(c.length>1e3?"...":""))}},[i,t.document.path]);return(0,it.useEffect)(()=>{n&&s()},[n,s]),it.default.createElement(cv,{open:n,onOpenChange:o,className:"tw-rounded-md tw-border tw-border-solid tw-border-border"},it.default.createElement("div",{className:he("tw-flex tw-items-center tw-justify-between tw-gap-2 tw-p-2")},it.default.createElement(me,{variant:"ghost2",size:"icon",className:"tw-shrink-0",asChild:!0},it.default.createElement(gA,null,it.default.createElement($m,{className:he("tw-size-4 tw-transition-transform tw-duration-200",{"rotate-90":n})}))),it.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-2"},it.default.createElement(G8n,{score:t.metadata.similarityScore??0})),it.default.createElement("div",{className:"tw-flex-1 tw-overflow-hidden"},it.default.createElement("a",{onClick:u=>{u.preventDefault();let l=u.metaKey||u.ctrlKey;r(l)},onAuxClick:u=>{u.button===1&&(u.preventDefault(),r(!0))},className:"tw-block tw-w-full tw-truncate tw-text-sm tw-font-bold tw-text-normal",title:t.document.title},t.document.title)),it.default.createElement(Zn,null,it.default.createElement(Yn,{asChild:!0},it.default.createElement(me,{variant:"ghost2",size:"icon",onClick:e,className:"tw-shrink-0"},it.default.createElement(Hh,{className:"tw-size-4"}))),it.default.createElement(Hn,null,"Add to Chat"))),it.default.createElement(dv,null,it.default.createElement("div",{className:"tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2"},it.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-wrap tw-break-all tw-text-xs tw-text-muted tw-opacity-75"},t.document.path),i&&it.default.createElement("div",{className:"tw-overflow-hidden tw-whitespace-pre-wrap tw-border-t tw-border-border tw-pb-4 tw-pt-2 tw-text-xs tw-text-normal"},i)),it.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4 tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2 tw-text-xs tw-text-muted"},t.metadata.similarityScore!=null&&it.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},it.default.createElement("span",null,"Similarity: ",(t.metadata.similarityScore*100).toFixed(1),"%")),t.metadata.hasOutgoingLinks&&it.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},it.default.createElement(k5,{className:"tw-size-4"}),it.default.createElement("span",null,"Outgoing links")),t.metadata.hasBacklinks&&it.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},it.default.createElement(F5,{className:"tw-size-4"}),it.default.createElement("span",null,"Backlinks")))))}function Z8n({note:t,onAddToChat:e,onNavigateToNote:r,children:n}){return it.default.createElement(nfr,{key:t.document.path},it.default.createElement(ofr,{asChild:!0},n),it.default.createElement(t9e,{className:"tw-flex tw-w-fit tw-min-w-72 tw-max-w-96 tw-flex-col tw-gap-2 tw-overflow-hidden"},it.default.createElement("span",{className:"tw-text-sm tw-text-normal"},t.document.title),it.default.createElement("span",{className:"tw-text-xs tw-text-muted"},t.document.path),it.default.createElement("div",{className:"tw-flex tw-gap-2"},it.default.createElement("button",{onClick:e,className:"tw-inline-flex tw-items-center tw-gap-2 tw-border tw-border-solid tw-border-border !tw-bg-transparent !tw-shadow-none hover:!tw-bg-interactive-hover"},"Add to Chat ",it.default.createElement(Hh,{className:"tw-size-4"})),it.default.createElement("button",{onClick:o=>{let i=o.metaKey||o.ctrlKey;r(i)},className:"tw-inline-flex tw-items-center tw-gap-2 tw-border tw-border-solid tw-border-border !tw-bg-transparent !tw-shadow-none hover:!tw-bg-interactive-hover"},"Navigate to Note ",it.default.createElement(P5,{className:"tw-size-4"})))))}var z_e=(0,it.memo)(({className:t,onInsertToChat:e,defaultOpen:r=!1})=>{let[n,o]=(0,it.useState)(0),[i,a]=(0,it.useState)(r),s=W8n(n),u=n9e(),l=K8n(u?.path??"",n),c=(p,m=!1)=>{let h=app.vault.getAbstractFileByPath(p);h instanceof FY.TFile&&app.workspace.getLeaf(m).openFile(h)},d=p=>{e(`[[${p}]]`)},f=async()=>{u&&(await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().reindexFile(u),new FY.Notice(`Refreshed index for ${u.basename}`),o(n+1))};return it.default.createElement("div",{className:he("tw-w-full tw-border tw-border-solid tw-border-transparent tw-border-b-border tw-pb-2",t)},it.default.createElement(cv,{open:i,onOpenChange:a},it.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-pb-2 tw-pl-1"},it.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},it.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Relevant Notes"),it.default.createElement(jn,{content:"Relevance is a combination of semantic similarity and links.",contentClassName:"tw-w-64",buttonClassName:"tw-size-4 tw-text-muted"}),!l&&it.default.createElement(jn,{content:"Note has not been indexed",side:"bottom"},it.default.createElement($p,{className:"tw-size-4 tw-text-warning"}))),it.default.createElement("div",{className:"tw-flex tw-items-center"},it.default.createElement(Zn,null,it.default.createElement(Yn,{asChild:!0},it.default.createElement(me,{variant:"ghost2",size:"icon",onClick:f},it.default.createElement(V5,{className:"tw-size-4"}))),it.default.createElement(Hn,{side:"bottom"},"Reindex Current Note")),s.length>0&&it.default.createElement(gA,{asChild:!0},it.default.createElement(me,{variant:"ghost2",size:"icon"},i?it.default.createElement(Gb,{className:"tw-size-5"}):it.default.createElement($i,{className:"tw-size-5"}))))),s.length===0&&it.default.createElement("div",{className:"tw-flex tw-max-h-12 tw-flex-wrap tw-gap-x-2 tw-gap-y-1 tw-overflow-y-hidden tw-px-1"},it.default.createElement("span",{className:"tw-text-xs tw-text-muted"},l?"No relevant notes found":"No index available. Click refresh to build index.")),!i&&s.length>0&&it.default.createElement("div",{className:"tw-flex tw-max-h-6 tw-flex-wrap tw-gap-x-2 tw-gap-y-1 tw-overflow-y-hidden tw-px-1"},s.map(p=>it.default.createElement(Z8n,{key:p.document.path,note:p,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)},it.default.createElement(pp,{variant:"outline",key:p.document.path,className:"tw-max-w-40 tw-text-xs tw-text-muted hover:tw-cursor-pointer hover:tw-bg-interactive-hover"},it.default.createElement("span",{className:"tw-truncate"},p.document.title))))),it.default.createElement(dv,null,it.default.createElement("div",{className:"tw-flex tw-max-h-screen tw-flex-col tw-gap-2 tw-overflow-y-auto tw-px-1 tw-py-2"},s.map(p=>it.default.createElement(J8n,{note:p,key:p.document.path,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)}))))))});z_e.displayName="RelevantNotes";la();xu();Un();var Oh=j(Z());dn();var L$=Oh.forwardRef(({className:t,...e},r)=>Oh.createElement("div",{ref:r,className:he("tw-rounded-xl tw-border tw-border-border tw-bg-primary tw-text-normal tw-shadow",t),...e}));L$.displayName="Card";var F$=Oh.forwardRef(({className:t,...e},r)=>Oh.createElement("div",{ref:r,className:he("tw-flex tw-flex-col tw-space-y-1.5 tw-p-6",t),...e}));F$.displayName="CardHeader";var kY=Oh.forwardRef(({className:t,...e},r)=>Oh.createElement("div",{ref:r,className:he("tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));kY.displayName="CardTitle";var Y8n=Oh.forwardRef(({className:t,...e},r)=>Oh.createElement("div",{ref:r,className:he("tw-text-sm tw-text-muted",t),...e}));Y8n.displayName="CardDescription";var k$=Oh.forwardRef(({className:t,...e},r)=>Oh.createElement("div",{ref:r,className:he("tw-p-6 tw-pt-0",t),...e}));k$.displayName="CardContent";var X8n=Oh.forwardRef(({className:t,...e},r)=>Oh.createElement("div",{ref:r,className:he("tw-flex tw-items-center tw-p-6 tw-pt-0",t),...e}));X8n.displayName="CardFooter";er();_t();_n();var ya=j(Z());var o9e={activeNote:{title:"Active Note Insights",prompts:["Provide three follow-up questions worded as if I'm asking you based on {activeNote}?","What key questions does {activeNote} answer?","Give me a quick recap of {activeNote} in two sentences."]},quoteNote:{title:"Note Link Chat",prompts:["Based on [[<note>]], what improvements should we focus on next?","Summarize the key points from [[<note>]].","Summarize the recent updates from [[<note>]].","Roast my writing in [[<note>]] and give concrete actionable feedback"]},fun:{title:"Test LLM",prompts:["9.11 and 9.8, which is bigger?","What's the longest river in the world?","If a lead ball and a feather are dropped simultaneously from the same height, which will reach the ground first?"]},qaVault:{title:"Vault Q&A",prompts:["What insights can I gather about <topic> from my notes?","Explain <concept> based on my stored notes.","Highlight important details on <topic> from my notes.","Based on my notes on <topic>, what is the question that I should be asking, but am not?"]},copilotPlus:{title:"Copilot Plus",prompts:["Give me a recap of last week @vault","What are the key takeaways from my notes on <topic> @vault","Summarize <url> in under 10 bullet points","@youtube <video_url>","@websearch what are most recent updates in the AI industry","What are the key insights from this paper <arxiv_url>","What new methods are proposed in this paper [[<note_with_embedded_pdf>]]"]}},ifr={llm_chain:["activeNote","quoteNote","fun"],vault_qa:["qaVault","qaVault","quoteNote"],copilot_plus:["copilotPlus","copilotPlus","copilotPlus"],project:["copilotPlus","copilotPlus","copilotPlus"]};function Q8n(t="llm_chain"){let e=ifr[t]||ifr.llm_chain,r={};return e.map(n=>(r[n]||(r[n]=[...o9e[n].prompts].sort(()=>Math.random()-.5)),{title:o9e[n].title,text:r[n].pop()||o9e[n].prompts[0]}))}var afr=({onClick:t})=>{let[e]=Dp(),r=(0,ya.useMemo)(()=>Q8n(e),[e]),o=an().indexVaultToVectorStore;return ya.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},ya.default.createElement(L$,{className:"tw-w-full tw-bg-transparent"},ya.default.createElement(F$,{className:"tw-px-2"},ya.default.createElement(kY,null,"Suggested Prompts")),ya.default.createElement(k$,{className:"tw-p-2 tw-pt-0"},ya.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},r.map((i,a)=>ya.default.createElement("div",{key:a,className:"tw-flex tw-justify-between tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},ya.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},ya.default.createElement("div",{className:"tw-text-muted"},i.title),ya.default.createElement("div",null,i.text)),ya.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},ya.default.createElement(Zn,null,ya.default.createElement(Yn,{asChild:!0},ya.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>t(i.text)},ya.default.createElement(Hh,{className:"tw-size-4"}))),ya.default.createElement(Hn,null,"Add to Chat")))))))),e==="vault_qa"&&ya.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},"Please note that this is a retrieval-based QA. Questions should contain keywords and concepts that exist literally in your vault"),e==="vault_qa"&&o==="NEVER"&&ya.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},ya.default.createElement("div",null,ya.default.createElement($p,{className:"tw-size-4"})," Your auto-index strategy is set to"," ",ya.default.createElement("b",null,"NEVER"),". Before proceeding, click the"," ",ya.default.createElement("span",{className:"tw-text-accent"},"Refresh Index")," button below or run the"," ",ya.default.createElement("span",{className:"tw-text-accent"},"Copilot command: Index (refresh) vault for QA")," ","to update the index.")))};er();er();var cm=j(Z()),sfr=({chatHistory:t})=>{let[e,r]=(0,cm.useState)(0),n=(0,cm.useRef)(null),o=(0,cm.useRef)(null),i=(0,cm.useCallback)((l,c)=>`message-${l.timestamp?.epoch||c}`,[]),a=(0,cm.useCallback)(()=>{if(!n.current)return 0;let l=n.current,c=l.clientHeight,d=t.map((m,h)=>({msg:m,idx:h})).filter(({msg:m})=>m.isVisible&&m.sender===So).pop()?.idx,f=0;if(d!==void 0){let m=i(t[d],d),h=l.querySelector(`[data-message-key="${m}"]`);if(h)f=h.getBoundingClientRect().height;else{let y=t[d].message.length,g=Math.ceil(y/80);f=Math.max(60,g*24)}}return Math.max(100,c-f)},[t,i]),s=(0,cm.useCallback)(l=>{if(l!==n.current&&(o.current&&(o.current.disconnect(),o.current=null),n.current=l,l)){let c=a();r(c);let d=new ResizeObserver(()=>{if(n.current){let f=a();r(f)}});d.observe(l),o.current=d}},[a]);(0,cm.useEffect)(()=>{if(n.current&&t.length>0){let l=a();r(l)}},[t,a]),(0,cm.useEffect)(()=>()=>{o.current&&o.current.disconnect()},[]);let u=(0,cm.useCallback)((l="smooth")=>{n.current&&n.current.scrollTo({top:n.current.scrollHeight,behavior:l})},[]);return(0,cm.useEffect)(()=>{u("instant")},[u]),(0,cm.useEffect)(()=>{if(t.length>0){let l=t[t.length-1];l&&l.sender===So&&u()}},[t.length,t,u]),{containerMinHeight:e,scrollContainerCallbackRef:s,getMessageKey:i}};_t();var mf=j(Z()),ufr=(0,mf.memo)(({chatHistory:t,currentAiMessage:e,loading:r,loadingMessage:n,app:o,onRegenerate:i,onEdit:a,onDelete:s,onInsertToChat:u,onReplaceChat:l,showHelperComponents:c=!0})=>{let[d,f]=(0,mf.useState)(""),p=an(),{containerMinHeight:m,scrollContainerCallbackRef:h,getMessageKey:y}=sfr({chatHistory:t});if((0,mf.useEffect)(()=>{let _;return r?_=setInterval(()=>{f(w=>w.length<6?w+".":"")},200):f(""),()=>clearInterval(_)},[r]),!t.filter(_=>_.isVisible).length&&!e)return mf.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-gap-2 tw-overflow-y-auto"},c&&p.showRelevantNotes&&mf.default.createElement(z_e,{onInsertToChat:u,defaultOpen:!0,key:"relevant-notes-before-chat"}),c&&p.showSuggestedPrompts&&mf.default.createElement(afr,{onClick:l}));let g=()=>n?`${n} ${d}`:d;return mf.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-1 tw-flex-col tw-overflow-hidden"},c&&p.showRelevantNotes&&mf.default.createElement(z_e,{className:"tw-mb-4",onInsertToChat:u,defaultOpen:!1,key:"relevant-notes-in-chat"}),mf.default.createElement("div",{ref:h,"data-testid":"chat-messages",className:"tw-relative tw-flex tw-w-full tw-flex-1 tw-select-text tw-flex-col tw-items-start tw-justify-start tw-overflow-y-auto tw-scroll-smooth tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)]"},t.map((_,w)=>{let S=t.filter(P=>P.isVisible),E=w===S.length-1&&_.sender!==So;return _.isVisible&&mf.default.createElement("div",{key:y(_,w),"data-message-key":y(_,w),className:"tw-w-full",style:{minHeight:E?`${m}px`:"auto"}},mf.default.createElement(NWe,{message:_,app:o,isStreaming:!1,onRegenerate:()=>i(w),onEdit:P=>a(w,P),onDelete:()=>s(w),chatHistory:t}))}),(e||r)&&mf.default.createElement("div",{className:"tw-w-full",style:{minHeight:`${m}px`}},mf.default.createElement(NWe,{key:"ai_message_streaming",message:{sender:"AI",message:e||g(),isVisible:!0,timestamp:null},app:o,isStreaming:!0,onDelete:()=>{},chatHistory:t}))))});ufr.displayName="ChatMessages";var lfr=ufr;Un();kt();var U_e=j(Z());function q_e(t){let[e,r]=(0,U_e.useState)(null);(0,U_e.useEffect)(()=>{(async()=>{let i=await ett();i.version&&r(i.version)})()},[]);let n=e!==null&&Nee(e,t);return{latestVersion:e,hasUpdate:n}}dn();_t();kt();_n();var vb=j(Z());function cfr({currentVersion:t}){let{latestVersion:e,hasUpdate:r}=q_e(t),n=an().lastDismissedVersion,[o,i]=(0,vb.useState)(!0),a=r&&e&&Nee(e,t)&&n!==e,s=()=>{e&&(i(!1),setTimeout(()=>{Xe("lastDismissedVersion",e)},300))};return a?vb.default.createElement("div",{className:he("tw-min-h-14 tw-overflow-hidden",o?"tw-duration-300 tw-animate-in tw-slide-in-from-top":"tw-duration-300 tw-animate-out tw-slide-out-to-top")},vb.default.createElement("div",{className:"tw-mb-1 tw-flex tw-items-center tw-justify-between tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-pl-3 tw-text-xs"},vb.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},vb.default.createElement("span",{className:"tw-font-medium"},"Update available:"),vb.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"tw-text-normal"},"v",e)),vb.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},vb.default.createElement(me,{size:"fit",variant:"ghost2",className:"tw-text-accent hover:tw-text-accent-hover",onClick:()=>{window.open("obsidian://show-plugin?id=copilot","_blank"),s()}},"Update"),vb.default.createElement(me,{variant:"ghost2",size:"icon",onClick:s},vb.default.createElement(_i,{className:"tw-size-4"}))))):null}la();var dfr=require("obsidian");Yp();var PV=class extends dfr.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=fG(this.app);return this.app.vault.getAllLoadedFiles().forEach(o=>{o.parent?.path&&o.parent.path!=="/"&&!n.some(a=>o.parent.path===a||o.parent.path.startsWith(a+"/"))&&r.add(o.parent.path)}),Array.from(r)}getItemText(r){return r}onChooseItem(r,n){this.onChooseFolder(r)}};var i9e=require("obsidian");var $Y=class extends _V{constructor({app:e,onFileSelect:r,excludeFilePaths:n,titleOnly:o=!1}){super(e),this.onFileSelect=r,this.availableNotes=this.getOrderedProjectFiles(n),this.titleOnly=o,this.setTitle("Select File")}getOrderedProjectFiles(e=[]){let r=["mp3","mp4","m4a","wav","webm"],n=this.app.workspace.getLastOpenFiles().map(a=>this.app.vault.getAbstractFileByPath(a)).filter(a=>a instanceof i9e.TFile&&!e.includes(a.path)&&a.path!==this.activeNote?.path&&!r.includes(a.extension.toLowerCase())),i=this.app.vault.getFiles().filter(a=>!r.includes(a.extension.toLowerCase())).filter(a=>!n.some(s=>s.path===a.path)&&!e.includes(a.path)&&a.path!==this.activeNote?.path);return[...this.activeNote?[this.activeNote]:[],...n,...i]}getItems(){if(this.titleOnly){let e=new Map;return this.availableNotes.forEach(r=>{e.set(r.basename,r)}),Array.from(e.values())}return this.availableNotes}getItemText(e){let r=e.path===this.activeNote?.path;return this.formatNoteTitle(e.basename,r,e.extension)}onChooseItem(e,r){this.onFileSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof i9e.TFile){let o=n.createDiv(),i=e.item;o.setText(this.formatNoteTitle(i.basename,i===this.activeNote,i.extension)),this.titleOnly||n.createDiv({cls:"mt-1 text-muted text-xs"}).setText(i.path)}}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n&&(o+=` (${n.toUpperCase()})`),o}};kt();var ffr=require("obsidian"),TV=class extends ffr.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)Fj(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};var AV=j(Z());dn();var H_e=j(Z()),e5n=2;function t5n(t,e){return e&&e>1?t.current?t.current.offsetHeight<t.current.scrollHeight:!1:(t.current&&t.current?.offsetWidth+e5n<t.current?.scrollWidth)??!1}function r5n(t){switch(t){case 2:return"tw-line-clamp-2";case 3:return"tw-line-clamp-3";default:return""}}var Eh=({children:t,className:e,lineClamp:r,tooltipContent:n,...o})=>{let i=(0,H_e.useRef)(null),[a,s]=(0,H_e.useState)(!1);return AV.default.createElement(YO,{delayDuration:0},AV.default.createElement(Zn,{open:a,onOpenChange:l=>{s(l&&t5n(i,r))}},AV.default.createElement(Yn,{asChild:!0},AV.default.createElement("div",{...o,ref:i,className:he("tw-max-w-full tw-text-normal",(!r||r<=1)&&"tw-truncate",r&&r5n(r),e),"data-testid":"truncatedText"},t)),AV.default.createElement(Hn,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},n??t)))};Un();var HY=j(Z());_n();var wfr=j(Z(),1),Pt=j(Z(),1),J_e=(0,Pt.createContext)(null);J_e.displayName="PanelGroupContext";var Ks={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},f9e=10,B$=Pt.useLayoutEffect,pfr=wfr.useId,n5n=typeof pfr=="function"?pfr:()=>null,o5n=0;function p9e(t=null){let e=n5n(),r=(0,Pt.useRef)(t||e||null);return r.current===null&&(r.current=""+o5n++),t??r.current}function xfr({children:t,className:e="",collapsedSize:r,collapsible:n,defaultSize:o,forwardedRef:i,id:a,maxSize:s,minSize:u,onCollapse:l,onExpand:c,onResize:d,order:f,style:p,tagName:m="div",...h}){let y=(0,Pt.useContext)(J_e);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:g,expandPanel:_,getPanelSize:w,getPanelStyle:S,groupId:C,isPanelCollapsed:E,reevaluatePanelConstraints:P,registerPanel:T,resizePanel:I,unregisterPanel:N}=y,M=p9e(a),D=(0,Pt.useRef)({callbacks:{onCollapse:l,onExpand:c,onResize:d},constraints:{collapsedSize:r,collapsible:n,defaultSize:o,maxSize:s,minSize:u},id:M,idIsFromProps:a!==void 0,order:f});(0,Pt.useRef)({didLogMissingDefaultSizeWarning:!1}),B$(()=>{let{callbacks:L,constraints:H}=D.current,K={...H};D.current.id=M,D.current.idIsFromProps=a!==void 0,D.current.order=f,L.onCollapse=l,L.onExpand=c,L.onResize=d,H.collapsedSize=r,H.collapsible=n,H.defaultSize=o,H.maxSize=s,H.minSize=u,(K.collapsedSize!==H.collapsedSize||K.collapsible!==H.collapsible||K.maxSize!==H.maxSize||K.minSize!==H.minSize)&&P(D.current,K)}),B$(()=>{let L=D.current;return T(L),()=>{N(L)}},[f,M,T,N]),(0,Pt.useImperativeHandle)(i,()=>({collapse:()=>{g(D.current)},expand:L=>{_(D.current,L)},getId(){return M},getSize(){return w(D.current)},isCollapsed(){return E(D.current)},isExpanded(){return!E(D.current)},resize:L=>{I(D.current,L)}}),[g,_,w,E,M,I]);let k=S(D.current,o);return(0,Pt.createElement)(m,{...h,children:t,className:e,id:M,style:{...k,...p},[Ks.groupId]:C,[Ks.panel]:"",[Ks.panelCollapsible]:n||void 0,[Ks.panelId]:M,[Ks.panelSize]:parseFloat(""+k.flexGrow).toFixed(1)})}var m9e=(0,Pt.forwardRef)((t,e)=>(0,Pt.createElement)(xfr,{...t,forwardedRef:e}));xfr.displayName="Panel";m9e.displayName="forwardRef(Panel)";var i5n;function a5n(){return i5n}var d9e=null,s5n=!0,W_e=-1,yA=null;function u5n(t,e){if(e){let r=(e&Pfr)!==0,n=(e&Tfr)!==0,o=(e&Afr)!==0,i=(e&Ifr)!==0;if(r)return o?"se-resize":i?"ne-resize":"e-resize";if(n)return o?"sw-resize":i?"nw-resize":"w-resize";if(o)return"s-resize";if(i)return"n-resize"}switch(t){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function l5n(){yA!==null&&(document.head.removeChild(yA),d9e=null,yA=null,W_e=-1)}function a9e(t,e){var r,n;if(!s5n)return;let o=u5n(t,e);if(d9e!==o){if(d9e=o,yA===null){yA=document.createElement("style");let a=a5n();a&&yA.setAttribute("nonce",a),document.head.appendChild(yA)}if(W_e>=0){var i;(i=yA.sheet)===null||i===void 0||i.removeRule(W_e)}W_e=(r=(n=yA.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${o} !important;}`))!==null&&r!==void 0?r:-1}}function Sfr(t){return t.type==="keydown"}function Cfr(t){return t.type.startsWith("pointer")}function Ofr(t){return t.type.startsWith("mouse")}function Z_e(t){if(Cfr(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(Ofr(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function c5n(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function d5n(t,e,r){return r?t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y:t.x<=e.x+e.width&&t.x+t.width>=e.x&&t.y<=e.y+e.height&&t.y+t.height>=e.y}function f5n(t,e){if(t===e)throw new Error("Cannot compare node with itself");let r={a:gfr(t),b:gfr(e)},n;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),n=t;Dn(n,"Stacking order can only be calculated for elements with a common ancestor");let o={a:hfr(mfr(r.a)),b:hfr(mfr(r.b))};if(o.a===o.b){let i=n.childNodes,a={a:r.a.at(-1),b:r.b.at(-1)},s=i.length;for(;s--;){let u=i[s];if(u===a.a)return 1;if(u===a.b)return-1}}return Math.sign(o.a-o.b)}var p5n=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function m5n(t){var e;let r=getComputedStyle((e=Efr(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function h5n(t){let e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||m5n(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||p5n.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function mfr(t){let e=t.length;for(;e--;){let r=t[e];if(Dn(r,"Missing node"),h5n(r))return r}return null}function hfr(t){return t&&Number(getComputedStyle(t).zIndex)||0}function gfr(t){let e=[];for(;t;)e.push(t),t=Efr(t);return e}function Efr(t){let{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}var Pfr=1,Tfr=2,Afr=4,Ifr=8,g5n=c5n()==="coarse",mv=[],NV=!1,EN=new Map,Y_e=new Map,UY=new Set;function y5n(t,e,r,n,o){var i;let{ownerDocument:a}=e,s={direction:r,element:e,hitAreaMargins:n,setResizeHandlerState:o},u=(i=EN.get(a))!==null&&i!==void 0?i:0;return EN.set(a,u+1),UY.add(s),K_e(),function(){var c;Y_e.delete(t),UY.delete(s);let d=(c=EN.get(a))!==null&&c!==void 0?c:1;if(EN.set(a,d-1),K_e(),d===1&&EN.delete(a),mv.includes(s)){let f=mv.indexOf(s);f>=0&&mv.splice(f,1),g9e(),o("up",!0,null)}}}function b5n(t){let{target:e}=t,{x:r,y:n}=Z_e(t);NV=!0,h9e({target:e,x:r,y:n}),K_e(),mv.length>0&&(G_e("down",t),t.preventDefault(),Mfr(e)||t.stopImmediatePropagation())}function s9e(t){let{x:e,y:r}=Z_e(t);if(NV&&t.buttons===0&&(NV=!1,G_e("up",t)),!NV){let{target:n}=t;h9e({target:n,x:e,y:r})}G_e("move",t),g9e(),mv.length>0&&t.preventDefault()}function u9e(t){let{target:e}=t,{x:r,y:n}=Z_e(t);Y_e.clear(),NV=!1,mv.length>0&&(t.preventDefault(),Mfr(e)||t.stopImmediatePropagation()),G_e("up",t),h9e({target:e,x:r,y:n}),g9e(),K_e()}function Mfr(t){let e=t;for(;e;){if(e.hasAttribute(Ks.resizeHandle))return!0;e=e.parentElement}return!1}function h9e({target:t,x:e,y:r}){mv.splice(0);let n=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(n=t),UY.forEach(o=>{let{element:i,hitAreaMargins:a}=o,s=i.getBoundingClientRect(),{bottom:u,left:l,right:c,top:d}=s,f=g5n?a.coarse:a.fine;if(e>=l-f&&e<=c+f&&r>=d-f&&r<=u+f){if(n!==null&&document.contains(n)&&i!==n&&!i.contains(n)&&!n.contains(i)&&f5n(n,i)>0){let m=n,h=!1;for(;m&&!m.contains(i);){if(d5n(m.getBoundingClientRect(),s,!0)){h=!0;break}m=m.parentElement}if(h)return}mv.push(o)}})}function l9e(t,e){Y_e.set(t,e)}function g9e(){let t=!1,e=!1;mv.forEach(n=>{let{direction:o}=n;o==="horizontal"?t=!0:e=!0});let r=0;Y_e.forEach(n=>{r|=n}),t&&e?a9e("intersection",r):t?a9e("horizontal",r):e?a9e("vertical",r):l5n()}var c9e=new AbortController;function K_e(){c9e.abort(),c9e=new AbortController;let t={capture:!0,signal:c9e.signal};UY.size&&(NV?(mv.length>0&&EN.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("contextmenu",u9e,t),n.addEventListener("pointerleave",s9e,t),n.addEventListener("pointermove",s9e,t))}),EN.forEach((e,r)=>{let{body:n}=r;n.addEventListener("pointerup",u9e,t),n.addEventListener("pointercancel",u9e,t)})):EN.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("pointerdown",b5n,t),n.addEventListener("pointermove",s9e,t))}))}function G_e(t,e){UY.forEach(r=>{let{setResizeHandlerState:n}=r,o=mv.includes(r);n(t,o,e)})}function _5n(){let[t,e]=(0,Pt.useState)(0);return(0,Pt.useCallback)(()=>e(r=>r+1),[])}function Dn(t,e){if(!t)throw console.error(e),Error(e)}function z$(t,e,r=f9e){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function bA(t,e,r=f9e){return z$(t,e,r)===0}function Ig(t,e,r){return z$(t,e,r)===0}function v5n(t,e,r){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++){let o=t[n],i=e[n];if(!Ig(o,i,r))return!1}return!0}function RV({panelConstraints:t,panelIndex:e,size:r}){let n=t[e];Dn(n!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=n;if(z$(r,s)<0)if(i){let u=(o+s)/2;z$(r,u)<0?r=o:r=s}else r=s;return r=Math.min(a,r),r=parseFloat(r.toFixed(f9e)),r}function BY({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:n,prevLayout:o,trigger:i}){if(Ig(t,0))return e;let a=[...e],[s,u]=n;Dn(s!=null,"Invalid first pivot index"),Dn(u!=null,"Invalid second pivot index");let l=0;if(i==="keyboard"){{let d=t<0?u:s,f=r[d];Dn(f,`Panel constraints not found for index ${d}`);let{collapsedSize:p=0,collapsible:m,minSize:h=0}=f;if(m){let y=e[d];if(Dn(y!=null,`Previous layout not found for panel index ${d}`),Ig(y,p)){let g=h-y;z$(g,Math.abs(t))>0&&(t=t<0?0-g:g)}}}{let d=t<0?s:u,f=r[d];Dn(f,`No panel constraints found for index ${d}`);let{collapsedSize:p=0,collapsible:m,minSize:h=0}=f;if(m){let y=e[d];if(Dn(y!=null,`Previous layout not found for panel index ${d}`),Ig(y,h)){let g=y-p;z$(g,Math.abs(t))>0&&(t=t<0?0-g:g)}}}}{let d=t<0?1:-1,f=t<0?u:s,p=0;for(;;){let h=e[f];Dn(h!=null,`Previous layout not found for panel index ${f}`);let g=RV({panelConstraints:r,panelIndex:f,size:100})-h;if(p+=g,f+=d,f<0||f>=r.length)break}let m=Math.min(Math.abs(t),Math.abs(p));t=t<0?0-m:m}{let f=t<0?s:u;for(;f>=0&&f<r.length;){let p=Math.abs(t)-Math.abs(l),m=e[f];Dn(m!=null,`Previous layout not found for panel index ${f}`);let h=m-p,y=RV({panelConstraints:r,panelIndex:f,size:h});if(!Ig(m,y)&&(l+=m-y,a[f]=y,l.toPrecision(3).localeCompare(Math.abs(t).toPrecision(3),void 0,{numeric:!0})>=0))break;t<0?f--:f++}}if(v5n(o,a))return o;{let d=t<0?u:s,f=e[d];Dn(f!=null,`Previous layout not found for panel index ${d}`);let p=f+l,m=RV({panelConstraints:r,panelIndex:d,size:p});if(a[d]=m,!Ig(m,p)){let h=p-m,g=t<0?u:s;for(;g>=0&&g<r.length;){let _=a[g];Dn(_!=null,`Previous layout not found for panel index ${g}`);let w=_+h,S=RV({panelConstraints:r,panelIndex:g,size:w});if(Ig(_,S)||(h-=S-_,a[g]=S),Ig(h,0))break;t>0?g--:g++}}}let c=a.reduce((d,f)=>f+d,0);return Ig(c,100)?a:o}function w5n({layout:t,panelsArray:e,pivotIndices:r}){let n=0,o=100,i=0,a=0,s=r[0];Dn(s!=null,"No pivot index found"),e.forEach((d,f)=>{let{constraints:p}=d,{maxSize:m=100,minSize:h=0}=p;f===s?(n=h,o=m):(i+=h,a+=m)});let u=Math.min(o,100-i),l=Math.max(n,100-a),c=t[s];return{valueMax:u,valueMin:l,valueNow:c}}function qY(t,e=document){return Array.from(e.querySelectorAll(`[${Ks.resizeHandleId}][data-panel-group-id="${t}"]`))}function Rfr(t,e,r=document){let o=qY(t,r).findIndex(i=>i.getAttribute(Ks.resizeHandleId)===e);return o??null}function Nfr(t,e,r){let n=Rfr(t,e,r);return n!=null?[n,n+1]:[-1,-1]}function x5n(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function jfr(t,e=document){if(x5n(e)&&e.dataset.panelGroupId==t)return e;let r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function X_e(t,e=document){let r=e.querySelector(`[${Ks.resizeHandleId}="${t}"]`);return r||null}function S5n(t,e,r,n=document){var o,i,a,s;let u=X_e(e,n),l=qY(t,n),c=u?l.indexOf(u):-1,d=(o=(i=r[c])===null||i===void 0?void 0:i.id)!==null&&o!==void 0?o:null,f=(a=(s=r[c+1])===null||s===void 0?void 0:s.id)!==null&&a!==void 0?a:null;return[d,f]}function C5n({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:n,panelDataArray:o,panelGroupElement:i,setLayout:a}){(0,Pt.useRef)({didWarnAboutMissingResizeHandle:!1}),B$(()=>{if(!i)return;let s=qY(r,i);for(let u=0;u<o.length-1;u++){let{valueMax:l,valueMin:c,valueNow:d}=w5n({layout:n,panelsArray:o,pivotIndices:[u,u+1]}),f=s[u];if(f!=null){let p=o[u];Dn(p,`No panel data found for index "${u}"`),f.setAttribute("aria-controls",p.id),f.setAttribute("aria-valuemax",""+Math.round(l)),f.setAttribute("aria-valuemin",""+Math.round(c)),f.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{s.forEach((u,l)=>{u.removeAttribute("aria-controls"),u.removeAttribute("aria-valuemax"),u.removeAttribute("aria-valuemin"),u.removeAttribute("aria-valuenow")})}},[r,n,o,i]),(0,Pt.useEffect)(()=>{if(!i)return;let s=e.current;Dn(s,"Eager values not found");let{panelDataArray:u}=s,l=jfr(r,i);Dn(l!=null,`No group found for id "${r}"`);let c=qY(r,i);Dn(c,`No resize handles found for group id "${r}"`);let d=c.map(f=>{let p=f.getAttribute(Ks.resizeHandleId);Dn(p,"Resize handle element has no handle id attribute");let[m,h]=S5n(r,p,u,i);if(m==null||h==null)return()=>{};let y=g=>{if(!g.defaultPrevented)switch(g.key){case"Enter":{g.preventDefault();let _=u.findIndex(w=>w.id===m);if(_>=0){let w=u[_];Dn(w,`No panel data found for index ${_}`);let S=n[_],{collapsedSize:C=0,collapsible:E,minSize:P=0}=w.constraints;if(S!=null&&E){let T=BY({delta:Ig(S,C)?P-C:C-S,initialLayout:n,panelConstraints:u.map(I=>I.constraints),pivotIndices:Nfr(r,p,i),prevLayout:n,trigger:"keyboard"});n!==T&&a(T)}}break}}};return f.addEventListener("keydown",y),()=>{f.removeEventListener("keydown",y)}});return()=>{d.forEach(f=>f())}},[i,t,e,r,n,o,a])}function yfr(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function Dfr(t,e){let r=t==="horizontal",{x:n,y:o}=Z_e(e);return r?n:o}function O5n(t,e,r,n,o){let i=r==="horizontal",a=X_e(e,o);Dn(a,`No resize handle element found for id "${e}"`);let s=a.getAttribute(Ks.groupId);Dn(s,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=n,l=Dfr(r,t),c=jfr(s,o);Dn(c,`No group element found for id "${s}"`);let d=c.getBoundingClientRect(),f=i?d.width:d.height;return(l-u)/f*100}function E5n(t,e,r,n,o,i){if(Sfr(t)){let a=r==="horizontal",s=0;t.shiftKey?s=100:o!=null?s=o:s=10;let u=0;switch(t.key){case"ArrowDown":u=a?0:s;break;case"ArrowLeft":u=a?-s:0;break;case"ArrowRight":u=a?s:0;break;case"ArrowUp":u=a?0:-s;break;case"End":u=100;break;case"Home":u=-100;break}return u}else return n==null?0:O5n(t,e,r,n,i)}function P5n({panelDataArray:t}){let e=Array(t.length),r=t.map(i=>i.constraints),n=0,o=100;for(let i=0;i<t.length;i++){let a=r[i];Dn(a,`Panel constraints not found for index ${i}`);let{defaultSize:s}=a;s!=null&&(n++,e[i]=s,o-=s)}for(let i=0;i<t.length;i++){let a=r[i];Dn(a,`Panel constraints not found for index ${i}`);let{defaultSize:s}=a;if(s!=null)continue;let u=t.length-n,l=o/u;n++,e[i]=l,o-=l}return e}function IV(t,e,r){e.forEach((n,o)=>{let i=t[o];Dn(i,`Panel data not found for index ${o}`);let{callbacks:a,constraints:s,id:u}=i,{collapsedSize:l=0,collapsible:c}=s,d=r[u];if(d==null||n!==d){r[u]=n;let{onCollapse:f,onExpand:p,onResize:m}=a;m&&m(n,d),c&&(f||p)&&(p&&(d==null||bA(d,l))&&!bA(n,l)&&p(),f&&(d==null||!bA(d,l))&&bA(n,l)&&f())}})}function V_e(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!=e[r])return!1;return!0}function T5n({defaultSize:t,dragState:e,layout:r,panelData:n,panelIndex:o,precision:i=3}){let a=r[o],s;return a==null?s=t!=null?t.toPrecision(i):"1":n.length===1?s="1":s=a.toPrecision(i),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function A5n(t,e=10){let r=null;return(...o)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...o)},e)}}function bfr(t){try{if(typeof localStorage<"u")t.getItem=e=>localStorage.getItem(e),t.setItem=(e,r)=>{localStorage.setItem(e,r)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),t.getItem=()=>null,t.setItem=()=>{}}}function Lfr(t){return`react-resizable-panels:${t}`}function Ffr(t){return t.map(e=>{let{constraints:r,id:n,idIsFromProps:o,order:i}=e;return o?n:i?`${i}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((e,r)=>e.localeCompare(r)).join(",")}function kfr(t,e){try{let r=Lfr(t),n=e.getItem(r);if(n){let o=JSON.parse(n);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function I5n(t,e,r){var n,o;let i=(n=kfr(t,r))!==null&&n!==void 0?n:{},a=Ffr(e);return(o=i[a])!==null&&o!==void 0?o:null}function M5n(t,e,r,n,o){var i;let a=Lfr(t),s=Ffr(e),u=(i=kfr(t,o))!==null&&i!==void 0?i:{};u[s]={expandToSizes:Object.fromEntries(r.entries()),layout:n};try{o.setItem(a,JSON.stringify(u))}catch(l){console.error(l)}}function _fr({layout:t,panelConstraints:e}){let r=[...t],n=r.reduce((i,a)=>i+a,0);if(r.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${r.map(i=>`${i}%`).join(", ")}`);if(!Ig(n,100)&&r.length>0)for(let i=0;i<e.length;i++){let a=r[i];Dn(a!=null,`No layout data found for index ${i}`);let s=100/n*a;r[i]=s}let o=0;for(let i=0;i<e.length;i++){let a=r[i];Dn(a!=null,`No layout data found for index ${i}`);let s=RV({panelConstraints:e,panelIndex:i,size:a});a!=s&&(o+=a-s,r[i]=s)}if(!Ig(o,0))for(let i=0;i<e.length;i++){let a=r[i];Dn(a!=null,`No layout data found for index ${i}`);let s=a+o,u=RV({panelConstraints:e,panelIndex:i,size:s});if(a!==u&&(o-=u-a,r[i]=u,Ig(o,0)))break}return r}var R5n=100,zY={getItem:t=>(bfr(zY),zY.getItem(t)),setItem:(t,e)=>{bfr(zY),zY.setItem(t,e)}},vfr={};function $fr({autoSaveId:t=null,children:e,className:r="",direction:n,forwardedRef:o,id:i=null,onLayout:a=null,keyboardResizeBy:s=null,storage:u=zY,style:l,tagName:c="div",...d}){let f=p9e(i),p=(0,Pt.useRef)(null),[m,h]=(0,Pt.useState)(null),[y,g]=(0,Pt.useState)([]),_=_5n(),w=(0,Pt.useRef)({}),S=(0,Pt.useRef)(new Map),C=(0,Pt.useRef)(0),E=(0,Pt.useRef)({autoSaveId:t,direction:n,dragState:m,id:f,keyboardResizeBy:s,onLayout:a,storage:u}),P=(0,Pt.useRef)({layout:y,panelDataArray:[],panelDataArrayChanged:!1});(0,Pt.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,Pt.useImperativeHandle)(o,()=>({getId:()=>E.current.id,getLayout:()=>{let{layout:z}=P.current;return z},setLayout:z=>{let{onLayout:V}=E.current,{layout:q,panelDataArray:W}=P.current,J=_fr({layout:z,panelConstraints:W.map(se=>se.constraints)});yfr(q,J)||(g(J),P.current.layout=J,V&&V(J),IV(W,J,w.current))}}),[]),B$(()=>{E.current.autoSaveId=t,E.current.direction=n,E.current.dragState=m,E.current.id=f,E.current.onLayout=a,E.current.storage=u}),C5n({committedValuesRef:E,eagerValuesRef:P,groupId:f,layout:y,panelDataArray:P.current.panelDataArray,setLayout:g,panelGroupElement:p.current}),(0,Pt.useEffect)(()=>{let{panelDataArray:z}=P.current;if(t){if(y.length===0||y.length!==z.length)return;let V=vfr[t];V==null&&(V=A5n(M5n,R5n),vfr[t]=V);let q=[...z],W=new Map(S.current);V(t,q,W,y,u)}},[t,y,u]),(0,Pt.useEffect)(()=>{});let T=(0,Pt.useCallback)(z=>{let{onLayout:V}=E.current,{layout:q,panelDataArray:W}=P.current;if(z.constraints.collapsible){let J=W.map(pe=>pe.constraints),{collapsedSize:se=0,panelSize:be,pivotIndices:ce}=$$(W,z,q);if(Dn(be!=null,`Panel size not found for panel "${z.id}"`),!bA(be,se)){S.current.set(z.id,be);let Me=MV(W,z)===W.length-1?be-se:se-be,Ue=BY({delta:Me,initialLayout:q,panelConstraints:J,pivotIndices:ce,prevLayout:q,trigger:"imperative-api"});V_e(q,Ue)||(g(Ue),P.current.layout=Ue,V&&V(Ue),IV(W,Ue,w.current))}}},[]),I=(0,Pt.useCallback)((z,V)=>{let{onLayout:q}=E.current,{layout:W,panelDataArray:J}=P.current;if(z.constraints.collapsible){let se=J.map(Et=>Et.constraints),{collapsedSize:be=0,panelSize:ce=0,minSize:pe=0,pivotIndices:Me}=$$(J,z,W),Ue=V??pe;if(bA(ce,be)){let Et=S.current.get(z.id),pr=Et!=null&&Et>=Ue?Et:Ue,On=MV(J,z)===J.length-1?ce-pr:pr-ce,Br=BY({delta:On,initialLayout:W,panelConstraints:se,pivotIndices:Me,prevLayout:W,trigger:"imperative-api"});V_e(W,Br)||(g(Br),P.current.layout=Br,q&&q(Br),IV(J,Br,w.current))}}},[]),N=(0,Pt.useCallback)(z=>{let{layout:V,panelDataArray:q}=P.current,{panelSize:W}=$$(q,z,V);return Dn(W!=null,`Panel size not found for panel "${z.id}"`),W},[]),M=(0,Pt.useCallback)((z,V)=>{let{panelDataArray:q}=P.current,W=MV(q,z);return T5n({defaultSize:V,dragState:m,layout:y,panelData:q,panelIndex:W})},[m,y]),D=(0,Pt.useCallback)(z=>{let{layout:V,panelDataArray:q}=P.current,{collapsedSize:W=0,collapsible:J,panelSize:se}=$$(q,z,V);return Dn(se!=null,`Panel size not found for panel "${z.id}"`),J===!0&&bA(se,W)},[]),k=(0,Pt.useCallback)(z=>{let{layout:V,panelDataArray:q}=P.current,{collapsedSize:W=0,collapsible:J,panelSize:se}=$$(q,z,V);return Dn(se!=null,`Panel size not found for panel "${z.id}"`),!J||z$(se,W)>0},[]),L=(0,Pt.useCallback)(z=>{let{panelDataArray:V}=P.current;V.push(z),V.sort((q,W)=>{let J=q.order,se=W.order;return J==null&&se==null?0:J==null?-1:se==null?1:J-se}),P.current.panelDataArrayChanged=!0,_()},[_]);B$(()=>{if(P.current.panelDataArrayChanged){P.current.panelDataArrayChanged=!1;let{autoSaveId:z,onLayout:V,storage:q}=E.current,{layout:W,panelDataArray:J}=P.current,se=null;if(z){let ce=I5n(z,J,q);ce&&(S.current=new Map(Object.entries(ce.expandToSizes)),se=ce.layout)}se==null&&(se=P5n({panelDataArray:J}));let be=_fr({layout:se,panelConstraints:J.map(ce=>ce.constraints)});yfr(W,be)||(g(be),P.current.layout=be,V&&V(be),IV(J,be,w.current))}}),B$(()=>{let z=P.current;return()=>{z.layout=[]}},[]);let H=(0,Pt.useCallback)(z=>{let V=!1,q=p.current;return q&&window.getComputedStyle(q,null).getPropertyValue("direction")==="rtl"&&(V=!0),function(J){J.preventDefault();let se=p.current;if(!se)return()=>null;let{direction:be,dragState:ce,id:pe,keyboardResizeBy:Me,onLayout:Ue}=E.current,{layout:Et,panelDataArray:pr}=P.current,{initialLayout:$r}=ce??{},On=Nfr(pe,z,se),Br=E5n(J,z,be,ce,Me,se),Tr=be==="horizontal";Tr&&V&&(Br=-Br);let Ie=pr.map(le=>le.constraints),Ge=BY({delta:Br,initialLayout:$r??Et,panelConstraints:Ie,pivotIndices:On,prevLayout:Et,trigger:Sfr(J)?"keyboard":"mouse-or-touch"}),Ne=!V_e(Et,Ge);(Cfr(J)||Ofr(J))&&C.current!=Br&&(C.current=Br,!Ne&&Br!==0?Tr?l9e(z,Br<0?Pfr:Tfr):l9e(z,Br<0?Afr:Ifr):l9e(z,0)),Ne&&(g(Ge),P.current.layout=Ge,Ue&&Ue(Ge),IV(pr,Ge,w.current))}},[]),K=(0,Pt.useCallback)((z,V)=>{let{onLayout:q}=E.current,{layout:W,panelDataArray:J}=P.current,se=J.map(Et=>Et.constraints),{panelSize:be,pivotIndices:ce}=$$(J,z,W);Dn(be!=null,`Panel size not found for panel "${z.id}"`);let Me=MV(J,z)===J.length-1?be-V:V-be,Ue=BY({delta:Me,initialLayout:W,panelConstraints:se,pivotIndices:ce,prevLayout:W,trigger:"imperative-api"});V_e(W,Ue)||(g(Ue),P.current.layout=Ue,q&&q(Ue),IV(J,Ue,w.current))},[]),G=(0,Pt.useCallback)((z,V)=>{let{layout:q,panelDataArray:W}=P.current,{collapsedSize:J=0,collapsible:se}=V,{collapsedSize:be=0,collapsible:ce,maxSize:pe=100,minSize:Me=0}=z.constraints,{panelSize:Ue}=$$(W,z,q);Ue!=null&&(se&&ce&&bA(Ue,J)?bA(J,be)||K(z,be):Ue<Me?K(z,Me):Ue>pe&&K(z,pe))},[K]),X=(0,Pt.useCallback)((z,V)=>{let{direction:q}=E.current,{layout:W}=P.current;if(!p.current)return;let J=X_e(z,p.current);Dn(J,`Drag handle element not found for id "${z}"`);let se=Dfr(q,V);h({dragHandleId:z,dragHandleRect:J.getBoundingClientRect(),initialCursorPosition:se,initialLayout:W})},[]),F=(0,Pt.useCallback)(()=>{h(null)},[]),Q=(0,Pt.useCallback)(z=>{let{panelDataArray:V}=P.current,q=MV(V,z);q>=0&&(V.splice(q,1),delete w.current[z.id],P.current.panelDataArrayChanged=!0,_())},[_]),ee=(0,Pt.useMemo)(()=>({collapsePanel:T,direction:n,dragState:m,expandPanel:I,getPanelSize:N,getPanelStyle:M,groupId:f,isPanelCollapsed:D,isPanelExpanded:k,reevaluatePanelConstraints:G,registerPanel:L,registerResizeHandle:H,resizePanel:K,startDragging:X,stopDragging:F,unregisterPanel:Q,panelGroupElement:p.current}),[T,m,n,I,N,M,f,D,k,G,L,H,K,X,F,Q]),U={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return(0,Pt.createElement)(J_e.Provider,{value:ee},(0,Pt.createElement)(c,{...d,children:e,className:r,id:i,ref:p,style:{...U,...l},[Ks.group]:"",[Ks.groupDirection]:n,[Ks.groupId]:f}))}var y9e=(0,Pt.forwardRef)((t,e)=>(0,Pt.createElement)($fr,{...t,forwardedRef:e}));$fr.displayName="PanelGroup";y9e.displayName="forwardRef(PanelGroup)";function MV(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function $$(t,e,r){let n=MV(t,e),i=n===t.length-1?[n-1,n]:[n,n+1],a=r[n];return{...e.constraints,panelSize:a,pivotIndices:i}}function N5n({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:n}){(0,Pt.useEffect)(()=>{if(t||r==null||n==null)return;let o=X_e(e,n);if(o==null)return;let i=a=>{if(!a.defaultPrevented)switch(a.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{a.preventDefault(),r(a);break}case"F6":{a.preventDefault();let s=o.getAttribute(Ks.groupId);Dn(s,`No group element found for id "${s}"`);let u=qY(s,n),l=Rfr(s,e,n);Dn(l!==null,`No resize element found for id "${e}"`);let c=a.shiftKey?l>0?l-1:u.length-1:l+1<u.length?l+1:0;u[c].focus();break}}};return o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}},[n,t,e,r])}function b9e({children:t=null,className:e="",disabled:r=!1,hitAreaMargins:n,id:o,onBlur:i,onClick:a,onDragging:s,onFocus:u,onPointerDown:l,onPointerUp:c,style:d={},tabIndex:f=0,tagName:p="div",...m}){var h,y;let g=(0,Pt.useRef)(null),_=(0,Pt.useRef)({onClick:a,onDragging:s,onPointerDown:l,onPointerUp:c});(0,Pt.useEffect)(()=>{_.current.onClick=a,_.current.onDragging=s,_.current.onPointerDown=l,_.current.onPointerUp=c});let w=(0,Pt.useContext)(J_e);if(w===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:S,groupId:C,registerResizeHandle:E,startDragging:P,stopDragging:T,panelGroupElement:I}=w,N=p9e(o),[M,D]=(0,Pt.useState)("inactive"),[k,L]=(0,Pt.useState)(!1),[H,K]=(0,Pt.useState)(null),G=(0,Pt.useRef)({state:M});B$(()=>{G.current.state=M}),(0,Pt.useEffect)(()=>{if(r)K(null);else{let ee=E(N);K(()=>ee)}},[r,N,E]);let X=(h=n?.coarse)!==null&&h!==void 0?h:15,F=(y=n?.fine)!==null&&y!==void 0?y:5;return(0,Pt.useEffect)(()=>{if(r||H==null)return;let ee=g.current;Dn(ee,"Element ref not attached");let U=!1;return y5n(N,ee,S,{coarse:X,fine:F},(V,q,W)=>{if(!q){D("inactive");return}switch(V){case"down":{D("drag"),U=!1,Dn(W,'Expected event to be defined for "down" action'),P(N,W);let{onDragging:J,onPointerDown:se}=_.current;J?.(!0),se?.();break}case"move":{let{state:J}=G.current;U=!0,J!=="drag"&&D("hover"),Dn(W,'Expected event to be defined for "move" action'),H(W);break}case"up":{D("hover"),T();let{onClick:J,onDragging:se,onPointerUp:be}=_.current;se?.(!1),be?.(),U||J?.();break}}})},[X,S,r,F,E,N,H,P,T]),N5n({disabled:r,handleId:N,resizeHandler:H,panelGroupElement:I}),(0,Pt.createElement)(p,{...m,children:t,className:e,id:o,onBlur:()=>{L(!1),i?.()},onFocus:()=>{L(!0),u?.()},ref:g,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...d},tabIndex:f,[Ks.groupDirection]:S,[Ks.groupId]:C,[Ks.resizeHandle]:"",[Ks.resizeHandleActive]:M==="drag"?"pointer":k?"keyboard":void 0,[Ks.resizeHandleEnabled]:!r,[Ks.resizeHandleId]:N,[Ks.resizeHandleState]:M})}b9e.displayName="PanelResizeHandle";dn();var Bfr=({className:t,...e})=>HY.createElement(y9e,{className:he("tw-flex tw-size-full data-[panel-group-direction=vertical]:tw-flex-col",t),...e}),_9e=m9e,zfr=({withHandle:t,className:e,...r})=>HY.createElement(b9e,{className:he("tw-relative tw-flex tw-w-px tw-items-center tw-justify-center tw-bg-[var(--background-modifier-border)] after:tw-absolute after:tw-inset-y-0 after:tw-left-1/2 after:tw-w-1 after:tw--translate-x-1/2 focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring focus-visible:tw-ring-offset-1 data-[panel-group-direction=vertical]:tw-h-px data-[panel-group-direction=vertical]:tw-w-full data-[panel-group-direction=vertical]:after:tw-left-0 data-[panel-group-direction=vertical]:after:tw-h-1 data-[panel-group-direction=vertical]:after:tw-w-full data-[panel-group-direction=vertical]:after:tw--translate-y-1/2 data-[panel-group-direction=vertical]:after:tw-translate-x-0 [&[data-panel-group-direction=vertical]>div]:tw-rotate-90",e),...r},t&&HY.createElement("div",{className:"tw-z-sidedock tw-flex tw-h-4 tw-w-3 tw-items-center tw-justify-center tw-rounded-sm tw-border tw-border-solid tw-border-border"},HY.createElement(Yb,{className:"tw-size-2.5"})));var eE=j(Z());var sr=j(Z(),1);var Ufr=j(Z(),1),D5n=j(qa(),1);Wv();var qfr=j(at(),1),L5n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],jV=L5n.reduce((t,e)=>{let r=zf(`Primitive.${e}`),n=Ufr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,qfr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Ph=j(Z(),1);var Vfr=j(Z(),1);function Hfr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function F5n(...t){return e=>{let r=!1,n=t.map(o=>{let i=Hfr(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():Hfr(t[o],null)}}}}function _A(...t){return Vfr.useCallback(F5n(...t),t)}var Wfr=j(Z(),1),VY=globalThis?.document?Wfr.useLayoutEffect:()=>{};var Kfr=j(Z(),1);function k5n(t,e){return Kfr.useReducer((r,n)=>e[r][n]??r,t)}var DV=t=>{let{present:e,children:r}=t,n=$5n(e),o=typeof r=="function"?r({present:n.isPresent}):Ph.Children.only(r),i=_A(n.ref,B5n(o));return typeof r=="function"||n.isPresent?Ph.cloneElement(o,{ref:i}):null};DV.displayName="Presence";function $5n(t){let[e,r]=Ph.useState(),n=Ph.useRef(null),o=Ph.useRef(t),i=Ph.useRef("none"),a=t?"mounted":"unmounted",[s,u]=k5n(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Ph.useEffect(()=>{let l=Q_e(n.current);i.current=s==="mounted"?l:"none"},[s]),VY(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Q_e(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),VY(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Q_e(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=Q_e(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{c.clearTimeout(l),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:Ph.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function Q_e(t){return t?.animationName||"none"}function B5n(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var vA=j(Z(),1),Gfr=j(at(),1);function Jfr(t,e=[]){let r=[];function n(i,a){let s=vA.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=vA.useMemo(()=>m,Object.values(m));return(0,Gfr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=vA.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>vA.createContext(a));return function(s){let u=s?.[t]||i;return vA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,z5n(o,...e)]}function z5n(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return vA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var LV=j(Z(),1);function PN(t){let e=LV.useRef(t);return LV.useEffect(()=>{e.current=t}),LV.useMemo(()=>(...r)=>e.current?.(...r),[])}var eve=j(Z(),1),U5n=j(at(),1),q5n=eve.createContext(void 0);function Zfr(t){let e=eve.useContext(q5n);return t||e||"ltr"}function Yfr(t,[e,r]){return Math.min(r,Math.max(e,t))}function TN(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Qfr=j(Z(),1),Ai=j(at(),1);function H5n(t,e){return Qfr.useReducer((r,n)=>e[r][n]??r,t)}var v9e="ScrollArea",[epr,wGi]=Jfr(v9e),[V5n,wb]=epr(v9e),tpr=sr.forwardRef((t,e)=>{let{__scopeScrollArea:r,type:n="hover",dir:o,scrollHideDelay:i=600,...a}=t,[s,u]=sr.useState(null),[l,c]=sr.useState(null),[d,f]=sr.useState(null),[p,m]=sr.useState(null),[h,y]=sr.useState(null),[g,_]=sr.useState(0),[w,S]=sr.useState(0),[C,E]=sr.useState(!1),[P,T]=sr.useState(!1),I=_A(e,M=>u(M)),N=Zfr(o);return(0,Ai.jsx)(V5n,{scope:r,type:n,dir:N,scrollHideDelay:i,scrollArea:s,viewport:l,onViewportChange:c,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:C,onScrollbarXEnabledChange:E,scrollbarY:h,onScrollbarYChange:y,scrollbarYEnabled:P,onScrollbarYEnabledChange:T,onCornerWidthChange:_,onCornerHeightChange:S,children:(0,Ai.jsx)(jV.div,{dir:N,...a,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});tpr.displayName=v9e;var rpr="ScrollAreaViewport",npr=sr.forwardRef((t,e)=>{let{__scopeScrollArea:r,children:n,nonce:o,...i}=t,a=wb(rpr,r),s=sr.useRef(null),u=_A(e,s,a.onViewportChange);return(0,Ai.jsxs)(Ai.Fragment,{children:[(0,Ai.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),(0,Ai.jsx)(jV.div,{"data-radix-scroll-area-viewport":"",...i,ref:u,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:(0,Ai.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});npr.displayName=rpr;var QO="ScrollAreaScrollbar",nve=sr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=wb(QO,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,s=t.orientation==="horizontal";return sr.useEffect(()=>(s?i(!0):a(!0),()=>{s?i(!1):a(!1)}),[s,i,a]),o.type==="hover"?(0,Ai.jsx)(W5n,{...n,ref:e,forceMount:r}):o.type==="scroll"?(0,Ai.jsx)(K5n,{...n,ref:e,forceMount:r}):o.type==="auto"?(0,Ai.jsx)(opr,{...n,ref:e,forceMount:r}):o.type==="always"?(0,Ai.jsx)(w9e,{...n,ref:e}):null});nve.displayName=QO;var W5n=sr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=wb(QO,t.__scopeScrollArea),[i,a]=sr.useState(!1);return sr.useEffect(()=>{let s=o.scrollArea,u=0;if(s){let l=()=>{window.clearTimeout(u),a(!0)},c=()=>{u=window.setTimeout(()=>a(!1),o.scrollHideDelay)};return s.addEventListener("pointerenter",l),s.addEventListener("pointerleave",c),()=>{window.clearTimeout(u),s.removeEventListener("pointerenter",l),s.removeEventListener("pointerleave",c)}}},[o.scrollArea,o.scrollHideDelay]),(0,Ai.jsx)(DV,{present:r||i,children:(0,Ai.jsx)(opr,{"data-state":i?"visible":"hidden",...n,ref:e})})}),K5n=sr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=wb(QO,t.__scopeScrollArea),i=t.orientation==="horizontal",a=ive(()=>u("SCROLL_END"),100),[s,u]=H5n("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return sr.useEffect(()=>{if(s==="idle"){let l=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(l)}},[s,o.scrollHideDelay,u]),sr.useEffect(()=>{let l=o.viewport,c=i?"scrollLeft":"scrollTop";if(l){let d=l[c],f=()=>{let p=l[c];d!==p&&(u("SCROLL"),a()),d=p};return l.addEventListener("scroll",f),()=>l.removeEventListener("scroll",f)}},[o.viewport,i,u,a]),(0,Ai.jsx)(DV,{present:r||s!=="hidden",children:(0,Ai.jsx)(w9e,{"data-state":s==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:TN(t.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:TN(t.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),opr=sr.forwardRef((t,e)=>{let r=wb(QO,t.__scopeScrollArea),{forceMount:n,...o}=t,[i,a]=sr.useState(!1),s=t.orientation==="horizontal",u=ive(()=>{if(r.viewport){let l=r.viewport.offsetWidth<r.viewport.scrollWidth,c=r.viewport.offsetHeight<r.viewport.scrollHeight;a(s?l:c)}},10);return FV(r.viewport,u),FV(r.content,u),(0,Ai.jsx)(DV,{present:n||i,children:(0,Ai.jsx)(w9e,{"data-state":i?"visible":"hidden",...o,ref:e})})}),w9e=sr.forwardRef((t,e)=>{let{orientation:r="vertical",...n}=t,o=wb(QO,t.__scopeScrollArea),i=sr.useRef(null),a=sr.useRef(0),[s,u]=sr.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=upr(s.viewport,s.content),c={...n,sizes:s,onSizesChange:u,hasThumb:l>0&&l<1,onThumbChange:f=>i.current=f,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:f=>a.current=f};function d(f,p){return Q5n(f,a.current,s,p)}return r==="horizontal"?(0,Ai.jsx)(G5n,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollLeft,p=Xfr(f,s,o.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:f=>{o.viewport&&(o.viewport.scrollLeft=f)},onDragScroll:f=>{o.viewport&&(o.viewport.scrollLeft=d(f,o.dir))}}):r==="vertical"?(0,Ai.jsx)(J5n,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollTop,p=Xfr(f,s);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:f=>{o.viewport&&(o.viewport.scrollTop=f)},onDragScroll:f=>{o.viewport&&(o.viewport.scrollTop=d(f))}}):null}),G5n=sr.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=wb(QO,t.__scopeScrollArea),[a,s]=sr.useState(),u=sr.useRef(null),l=_A(e,u,i.onScrollbarXChange);return sr.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,Ai.jsx)(apr,{"data-orientation":"horizontal",...o,ref:l,sizes:r,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ove(r)+"px",...t.style},onThumbPointerDown:c=>t.onThumbPointerDown(c.x),onDragScroll:c=>t.onDragScroll(c.x),onWheelScroll:(c,d)=>{if(i.viewport){let f=i.viewport.scrollLeft+c.deltaX;t.onWheelScroll(f),cpr(f,d)&&c.preventDefault()}},onResize:()=>{u.current&&i.viewport&&a&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:rve(a.paddingLeft),paddingEnd:rve(a.paddingRight)}})}})}),J5n=sr.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=wb(QO,t.__scopeScrollArea),[a,s]=sr.useState(),u=sr.useRef(null),l=_A(e,u,i.onScrollbarYChange);return sr.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,Ai.jsx)(apr,{"data-orientation":"vertical",...o,ref:l,sizes:r,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ove(r)+"px",...t.style},onThumbPointerDown:c=>t.onThumbPointerDown(c.y),onDragScroll:c=>t.onDragScroll(c.y),onWheelScroll:(c,d)=>{if(i.viewport){let f=i.viewport.scrollTop+c.deltaY;t.onWheelScroll(f),cpr(f,d)&&c.preventDefault()}},onResize:()=>{u.current&&i.viewport&&a&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:rve(a.paddingTop),paddingEnd:rve(a.paddingBottom)}})}})}),[Z5n,ipr]=epr(QO),apr=sr.forwardRef((t,e)=>{let{__scopeScrollArea:r,sizes:n,hasThumb:o,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:s,onThumbPositionChange:u,onDragScroll:l,onWheelScroll:c,onResize:d,...f}=t,p=wb(QO,r),[m,h]=sr.useState(null),y=_A(e,I=>h(I)),g=sr.useRef(null),_=sr.useRef(""),w=p.viewport,S=n.content-n.viewport,C=PN(c),E=PN(u),P=ive(d,10);function T(I){if(g.current){let N=I.clientX-g.current.left,M=I.clientY-g.current.top;l({x:N,y:M})}}return sr.useEffect(()=>{let I=N=>{let M=N.target;m?.contains(M)&&C(N,S)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[w,m,S,C]),sr.useEffect(E,[n,E]),FV(m,P),FV(p.content,P),(0,Ai.jsx)(Z5n,{scope:r,scrollbar:m,hasThumb:o,onThumbChange:PN(i),onThumbPointerUp:PN(a),onThumbPositionChange:E,onThumbPointerDown:PN(s),children:(0,Ai.jsx)(jV.div,{...f,ref:y,style:{position:"absolute",...f.style},onPointerDown:TN(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),g.current=m.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),T(I))}),onPointerMove:TN(t.onPointerMove,T),onPointerUp:TN(t.onPointerUp,I=>{let N=I.target;N.hasPointerCapture(I.pointerId)&&N.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=_.current,p.viewport&&(p.viewport.style.scrollBehavior=""),g.current=null})})})}),tve="ScrollAreaThumb",x9e=sr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=ipr(tve,t.__scopeScrollArea);return(0,Ai.jsx)(DV,{present:r||o.hasThumb,children:(0,Ai.jsx)(Y5n,{ref:e,...n})})}),Y5n=sr.forwardRef((t,e)=>{let{__scopeScrollArea:r,style:n,...o}=t,i=wb(tve,r),a=ipr(tve,r),{onThumbPositionChange:s}=a,u=_A(e,d=>a.onThumbChange(d)),l=sr.useRef(void 0),c=ive(()=>{l.current&&(l.current(),l.current=void 0)},100);return sr.useEffect(()=>{let d=i.viewport;if(d){let f=()=>{if(c(),!l.current){let p=eWn(d,s);l.current=p,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,c,s]),(0,Ai.jsx)(jV.div,{"data-state":a.hasThumb?"visible":"hidden",...o,ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:TN(t.onPointerDownCapture,d=>{let p=d.target.getBoundingClientRect(),m=d.clientX-p.left,h=d.clientY-p.top;a.onThumbPointerDown({x:m,y:h})}),onPointerUp:TN(t.onPointerUp,a.onThumbPointerUp)})});x9e.displayName=tve;var S9e="ScrollAreaCorner",spr=sr.forwardRef((t,e)=>{let r=wb(S9e,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?(0,Ai.jsx)(X5n,{...t,ref:e}):null});spr.displayName=S9e;var X5n=sr.forwardRef((t,e)=>{let{__scopeScrollArea:r,...n}=t,o=wb(S9e,r),[i,a]=sr.useState(0),[s,u]=sr.useState(0),l=!!(i&&s);return FV(o.scrollbarX,()=>{let c=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(c),u(c)}),FV(o.scrollbarY,()=>{let c=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(c),a(c)}),l?(0,Ai.jsx)(jV.div,{...n,ref:e,style:{width:i,height:s,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function rve(t){return t?parseInt(t,10):0}function upr(t,e){let r=t/e;return isNaN(r)?0:r}function ove(t){let e=upr(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function Q5n(t,e,r,n="ltr"){let o=ove(r),i=o/2,a=e||i,s=o-a,u=r.scrollbar.paddingStart+a,l=r.scrollbar.size-r.scrollbar.paddingEnd-s,c=r.content-r.viewport,d=n==="ltr"?[0,c]:[c*-1,0];return lpr([u,l],d)(t)}function Xfr(t,e,r="ltr"){let n=ove(e),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-o,a=e.content-e.viewport,s=i-n,u=r==="ltr"?[0,a]:[a*-1,0],l=Yfr(t,u);return lpr([0,a],[0,s])(l)}function lpr(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];let n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function cpr(t,e){return t>0&&t<e}var eWn=(t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return function o(){let i={left:t.scrollLeft,top:t.scrollTop},a=r.left!==i.left,s=r.top!==i.top;(a||s)&&e(),r=i,n=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(n)};function ive(t,e){let r=PN(t),n=sr.useRef(0);return sr.useEffect(()=>()=>window.clearTimeout(n.current),[]),sr.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function FV(t,e){let r=PN(e);VY(()=>{let n=0;if(t){let o=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return o.observe(t),()=>{window.cancelAnimationFrame(n),o.unobserve(t)}}},[t,r])}var C9e=tpr,dpr=npr;var fpr=spr;dn();var ave=eE.forwardRef(({className:t,children:e,...r},n)=>eE.createElement(C9e,{ref:n,className:he("tw-relative tw-overflow-hidden",t),...r},eE.createElement(dpr,{className:"tw-size-full tw-rounded-[inherit] [&>div:first-child]:!tw-block"},e),eE.createElement(ppr,null),eE.createElement(fpr,null)));ave.displayName=C9e.displayName;var ppr=eE.forwardRef(({className:t,orientation:e="vertical",...r},n)=>eE.createElement(nve,{ref:n,orientation:e,className:he("tw-flex tw-touch-none tw-select-none tw-transition-colors",e==="vertical"&&"tw-h-full tw-w-2.5 tw-border-l tw-border-l-transparent tw-p-px",e==="horizontal"&&"tw-h-2.5 tw-flex-col tw-border-t tw-border-t-transparent tw-p-px",t),...r},eE.createElement(x9e,{className:"tw-relative tw-flex-1 tw-rounded-full tw-bg-[var(--background-modifier-border)]"})));ppr.displayName=nve.displayName;var kV=j(Z());Un();_n();var sve=({value:t,onChange:e,placeholder:r="Search..."})=>kV.default.createElement("div",{className:"tw-relative"},kV.default.createElement(gi,{type:"text",placeholder:r,value:t,onChange:n=>e(n.target.value),className:"tw-pr-10"}),t&&kV.default.createElement(me,{variant:"secondary",onClick:()=>e(""),className:"tw-absolute tw-right-8 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-rounded-full tw-p-0 tw-transition-colors","aria-label":"Clear search"},kV.default.createElement(LI,{className:"tw-size-4 tw-text-muted/60 hover:tw-text-accent-hover"})),kV.default.createElement(dD,{className:"tw-absolute tw-right-3 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-text-muted"}));dn();Yp();kt();_n();var $V=require("obsidian"),je=j(Z()),gpr=j(Bc());function rWn({extension:t,size:e="tw-size-4"}){let r=t.toLowerCase().replace("*.","");return["jpg","jpeg","png","gif","svg"].includes(r)?je.default.createElement(L5,{className:`tw-text-context-manager-blue ${e}`}):["mp3","wav","ogg"].includes(r)?je.default.createElement(D5,{className:`tw-text-context-manager-purple ${e}`}):["mp4","mov","avi"].includes(r)?je.default.createElement($5,{className:`tw-text-context-manager-orange ${e}`}):["md","txt","mdx","markdown"].includes(r)?je.default.createElement(zm,{className:`${e}`}):je.default.createElement(zm,{className:`tw-text-faint ${e}`})}var O9e=({IconComponent:t,title:e,iconColorClassName:r,onAddClick:n,tooltip:o})=>je.default.createElement("div",{className:"tw-mb-3 tw-flex tw-items-center tw-justify-between"},je.default.createElement("div",{className:"tw-flex tw-items-center"},je.default.createElement(t,{className:`tw-mr-2 tw-size-4 ${r}`}),je.default.createElement("h3",{className:`tw-text-sm tw-font-semibold ${r}`},e),o&&je.default.createElement(jn,{buttonClassName:"tw-ml-2 tw-size-4 tw-text-muted",content:je.default.createElement("div",{className:"tw-max-w-80"},o)})),je.default.createElement(me,{variant:"ghost",size:"fit",className:"tw-text-muted hover:tw-bg-secondary",title:`Add new ${e.toLowerCase()}`,onClick:n},je.default.createElement(Hh,{className:`tw-size-4 ${r}`}))),mpr=({title:t,IconComponent:e,iconColorClassName:r,items:n,activeItem:o,activeSection:i,sectionType:a,renderIcon:s,onItemClick:u,onAddClick:l,onDeleteItem:c,tooltip:d})=>je.default.createElement("div",null,je.default.createElement(O9e,{IconComponent:e,title:t,iconColorClassName:r,onAddClick:l,tooltip:d}),je.default.createElement("div",{className:"tw-space-y-1"},n.map(f=>je.default.createElement("div",{key:f.id,className:he("tw-group tw-flex tw-cursor-pointer tw-items-center tw-justify-between tw-rounded-md tw-p-2 hover:tw-bg-secondary/50",i===a&&o===f.id&&"tw-bg-secondary tw-text-normal"),onClick:()=>u(f.id,f.name)},je.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-items-center"},s?s(f):je.default.createElement(e,{className:`tw-mr-2 tw-size-4 ${r}`}),je.default.createElement(Eh,{className:"tw-flex-1 tw-text-sm"},f.name)),je.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},je.default.createElement("span",{className:"tw-text-xs tw-text-muted group-hover:tw-hidden"},f.count||0),je.default.createElement(_i,{className:"tw-hidden tw-size-4 tw-shrink-0 tw-text-muted hover:tw-text-warning group-hover:tw-block group-hover:tw-flex-none",onClick:p=>c(p,f)}))))));function nWn({item:t,viewMode:e,onDelete:r}){let n=t.id.split(".").pop()||"",o=t.isIgnored?Wh:_i;return je.default.createElement("div",{className:"tw-group tw-flex tw-cursor-pointer tw-items-center tw-rounded-lg tw-border tw-border-solid tw-border-border tw-p-2 tw-transition-shadow hover:tw-shadow-md"},je.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},je.default.createElement(rWn,{extension:n,size:"tw-size-8"})),je.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},je.default.createElement(Eh,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.isIgnored&&je.default.createElement("span",{className:"tw-text-sm tw-text-error"}," (Ignored files)"),t.name),t.id&&je.default.createElement(Eh,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.id)),je.default.createElement("div",{className:"tw-ml-auto tw-flex tw-min-w-[24px] tw-items-center tw-justify-end tw-gap-2"},je.default.createElement(o,{className:"tw-hidden tw-size-4 tw-shrink-0 tw-text-muted hover:tw-text-warning group-hover:tw-block group-hover:tw-flex-none",onClick:i=>r(i,t)})))}function oWn({item:t,onClick:e}){let r,n;switch(t.type){case"tag":r=$I,n="tw-text-context-manager-orange";break;case"folder":r=cy,n="tw-text-context-manager-yellow";break;case"files":r=zm,n="tw-text-context-manager-blue";break;case"ignoreFiles":r=_i,n="tw-text-context-manager-red";break}return je.default.createElement("div",{className:"tw-group tw-flex tw-cursor-pointer tw-items-center tw-rounded-lg tw-border tw-border-solid tw-border-border tw-p-2 tw-transition-shadow hover:tw-shadow-md",onClick:()=>e(t)},je.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},je.default.createElement(r,{className:`tw-size-6 ${n}`})),je.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},je.default.createElement(Eh,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.type==="tag"&&je.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),t.name),je.default.createElement(Eh,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.count," ",t.count===1?"item":"items")))}function hpr(t){return"type"in t}function iWn({initialProject:t,onSave:e,onCancel:r,app:n}){let o=$V.Platform.isMobile,{inclusions:i,exclusions:a}=(0,je.useMemo)(()=>mu({inclusions:t?.contextSource.inclusions,exclusions:t?.contextSource.exclusions,isProject:!0}),[t.contextSource]),s=(0,je.useMemo)(()=>n.vault.getFiles(),[n.vault]),u=(0,je.useCallback)((U,z,V)=>{let q=U.filter(pe=>Ma(pe,z,V,!0)),W=(pe,Me,Ue,Et)=>{Me&&Me.forEach(pr=>{let $r={[Ue]:[pr]};Ma(pe,$r,null,!0)&&!Et[pr].some(On=>On.id===pe.path)&&Et[pr].push({id:pe.path,name:pe.basename})})},J={},se={},be={},ce=[];return(z?.tagPatterns??[]).forEach(pe=>{J[pe]=[]}),(z?.folderPatterns??[]).forEach(pe=>{se[pe]=[]}),(z?.extensionPatterns??[]).forEach(pe=>{be[pe]=[]}),q.forEach(pe=>{W(pe,z?.tagPatterns,"tagPatterns",J),W(pe,z?.folderPatterns,"folderPatterns",se),W(pe,z?.extensionPatterns,"extensionPatterns",be),z?.notePatterns&&Ma(pe,{notePatterns:z.notePatterns},null,!0)&&!ce.some(Me=>Me.id===pe.path)&&ce.push({id:pe.path,name:pe.basename})}),{tags:J,folders:se,extensions:be,notes:ce}},[]),[l,c]=(0,je.useState)(()=>u(s,i,a)),[d,f]=(0,je.useState)(()=>{let U=s.filter(z=>a&&Ma(z,a,null,!0));return{files:new Set(U)}}),p=(0,je.useRef)(l),m=(0,je.useRef)(d),[h,y]=(0,je.useState)(""),[g,_]=(0,je.useState)(null),[w,S]=(0,je.useState)(null),C=(0,je.useCallback)((U,z)=>{let V=Object.keys(U.tags),q=Object.keys(U.folders),W=Object.keys(U.extensions),J=U.notes.map(se=>{let be=z.find(ce=>ce.path===se.id);if(be)return h4(be)}).filter(Boolean);return m4({tagPatterns:V,folderPatterns:q,extensionPatterns:W,notePatterns:J})},[]),E=(0,je.useCallback)(U=>{let z=new Array(...U.files).map(V=>h4(V));return m4({notePatterns:z})||""},[]);(0,je.useEffect)(()=>{p.current=l,m.current=d},[l,d]);let P=(0,je.useMemo)(()=>{let U=[],z=(q,W)=>{W.forEach(J=>{q.some(se=>se.id===J.id)||q.push({id:J.id,name:J.name})})};return[l.tags,l.folders,l.extensions,{notes:l.notes}].forEach(q=>{Object.values(q).forEach(W=>{z(U,W)})}),U},[l]),T=(0,je.useCallback)(U=>{let z=[],V=[],q=[];return U.split(",").map(J=>J.trim()).filter(J=>J).forEach(J=>{J.startsWith("#")?z.push(J.substring(1)):J.startsWith(".")||J.startsWith("*.")?q.push(J.replace("*","")):V.push(J)}),{tags:z,titles:V,extensions:q}},[]),I=(0,je.useCallback)(U=>[...U].sort((z,V)=>z.name.toLowerCase().localeCompare(V.name.toLowerCase())),[]),N=(0,je.useMemo)(()=>{if(h){let U=T(h);return P.filter(z=>{let V=s.find(ce=>ce.path===z.id);if(!V)return!1;let q=V.extension==="md",W=U.tags.length>0&&q&&U.tags.some(ce=>Fj(V).some(Me=>(Me.startsWith("#")?Me.substring(1):Me).toLowerCase().includes(ce.toLowerCase()))),J=U.titles.length>0&&U.titles.some(ce=>V.basename.toLowerCase().includes(ce.toLowerCase())),se=U.extensions.length>0&&U.extensions.some(ce=>`.${V.extension}`.toLowerCase()===ce.toLowerCase());return U.tags.length>0||U.titles.length>0||U.extensions.length>0?W||J||se:!1}).map(z=>({id:z.id,name:z.name}))}if(g==="tags"&&w){let U=l.tags[w];return U||[]}if(g==="folders"&&w){let U=l.folders[w];return U||[]}if(g==="files")return l.notes;if(g==="extensions"&&w){let U=l.extensions[w];return U||[]}if(g==="ignoreFiles")return Array.from(d.files).map(U=>({id:U.path,name:U.basename}));if(!g){let U=I(Object.entries(l.tags).map(([W,J])=>({id:`tag:${W}`,name:W.slice(1),type:"tag",originalId:W,count:J.length}))),z=I(Object.entries(l.folders).map(([W,J])=>({id:`folder:${W}`,name:W,type:"folder",originalId:W,count:J.length}))),V=l.notes.length>0?[{id:"files:all",name:"Files",type:"files",count:l.notes.length}]:[],q=d.files.size>0?[{id:"ignoreFiles:all",name:"Ignore Files",type:"ignoreFiles",count:d.files.size}]:[];return[...U,...z,...V,...q]}return[]},[h,g,w,T,P,s,l.tags,l.folders,l.notes,l.extensions,d.files,I]),M=(0,je.useCallback)((U,z)=>Object.entries(U).sort(([V],[q])=>V.localeCompare(q)).map(([V,q])=>({id:V,name:z?z(V):V,count:q.length})),[]),D=(0,je.useCallback)((U,z,V)=>{let q=se=>s.filter(be=>Ma(be,se,null,!0)).map(be=>({id:be.path,name:be.basename})),W=[...m.current.files],J=q(V).map(se=>({...se,isIgnored:W.some(be=>be.path===se.id)}));c(se=>({...se,[U]:{...se[U],[z]:J}}))},[s]),k=(0,je.useCallback)((U,z)=>{let V={tags:{...U.tags},folders:{...U.folders},extensions:{...U.extensions},notes:[...U.notes]},q=W=>{Object.keys(W).forEach(J=>{W[J]=W[J].filter(se=>se.id!==z)})};return q(V.tags),q(V.folders),q(V.extensions),V.notes=V.notes.filter(W=>W.id!==z),V},[]),L=(0,je.useCallback)((U,z=null,V=!0)=>{_(U),S(z),V&&y("")},[]),H=(0,je.useMemo)(()=>{let U=z=>(V,q)=>{V.stopPropagation(),c(W=>{let J={...W[z]};return delete J[q.id],{...W,[z]:J}})};return{delete:{tag:U("tags"),folder:U("folders"),extension:U("extensions")},add:{tag:()=>{new TV(n,z=>{let V=pG(z);D("tags",V,{tagPatterns:[V]})}).open()},folder:()=>{new PV(n,z=>{D("folders",z,{folderPatterns:[z]})}).open()},file:()=>{new $Y({app:n,onFileSelect:z=>{l.notes.find(q=>q.id===z.path)||(f(q=>{let W=new Set(q.files);return W.delete(z),{...q,files:W}}),c(q=>({...q,notes:[...q.notes,{id:z.path,name:z.basename}]})))},excludeFilePaths:[],titleOnly:!1}).open()},extension:()=>{new $V.Notice("Adding extension is temporarily not supported.")},ignoreFile:()=>{new $Y({app:n,onFileSelect:z=>{d.files.has(z)||(f(q=>{let W=new Set(q.files);return W.add(z),{...q,files:W}}),c(q=>k(q,z.path)))},excludeFilePaths:[],titleOnly:!1}).open()}},click:{tag:z=>{L("tags",z)},folder:z=>{L("folders",z)},extension:z=>{L("extensions",z)},files:()=>{L("files")},ignoreFiles:()=>{L("ignoreFiles")}}}},[n,l.notes,d.files,D,k,L]),K=(0,je.useCallback)(U=>{U.type==="tag"&&U.originalId?H.click.tag(U.originalId):U.type==="folder"&&U.originalId?H.click.folder(U.originalId):U.type==="files"?H.click.files():U.type==="ignoreFiles"&&H.click.ignoreFiles()},[H]),G=()=>h?`Search Results for: "${h}"`:g==="tags"&&w?`Tag: ${w}`:g==="folders"&&w?`Folder: ${w}`:g==="files"?"Files":g==="extensions"&&w?`Extension: ${w}`:g==="ignoreFiles"?"Ignore Files":"All Categories",X=(U,z)=>{U.stopPropagation();let V=s.find(q=>q.path===z.id);V&&(f(q=>{let W=new Set(q.files);return W.add(V),{...q,files:W}}),c(q=>k(q,z.id)))},F=(0,je.useCallback)(()=>{let U=C(p.current,s),z=E(m.current),{inclusions:V,exclusions:q}=mu({inclusions:U,exclusions:z,isProject:!0}),W=u(s,V,q);c(W)},[s,E,C,u]),Q=(U,z)=>{U.stopPropagation();let V=s.find(q=>q.path===z.id);V&&(f(q=>{let W=new Set(q.files);return W.delete(V),{...q,files:W}}),F())},ee=()=>{let U=C(l,s),z=E(d);e({...t,contextSource:{...t.contextSource,inclusions:U,exclusions:z}})};return je.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},je.default.createElement(Bfr,{direction:"horizontal",className:"tw-flex-1"},je.default.createElement(_9e,{defaultSize:o?35:30,minSize:20,maxSize:40},je.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},je.default.createElement("div",{className:"tw-border-b tw-p-4"},je.default.createElement("h2",{className:"tw-text-lg tw-font-semibold"},"File Context")),je.default.createElement(ave,{className:"tw-max-h-[500px] tw-flex-1"},je.default.createElement("div",{className:"tw-space-y-6 tw-p-4"},je.default.createElement(mpr,{title:"Tags",IconComponent:$I,iconColorClassName:"tw-text-context-manager-orange",items:M(l.tags,U=>U.slice(1)),activeItem:w,activeSection:g,sectionType:"tags",renderIcon:U=>je.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),onItemClick:H.click.tag,onAddClick:H.add.tag,onDeleteItem:(U,z)=>H.delete.tag(U,z),tooltip:"must be in note property"}),je.default.createElement(R$,null),je.default.createElement(mpr,{title:"Folders",IconComponent:cy,iconColorClassName:"tw-text-context-manager-yellow",items:M(l.folders),activeItem:w,activeSection:g,sectionType:"folders",onItemClick:H.click.folder,onAddClick:H.add.folder,onDeleteItem:(U,z)=>H.delete.folder(U,z)}),je.default.createElement(R$,null),je.default.createElement("div",null,je.default.createElement(O9e,{IconComponent:zm,title:"Files",iconColorClassName:"tw-text-context-manager-blue",onAddClick:H.add.file}),je.default.createElement("div",{className:he("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",g==="files"&&"tw-bg-secondary tw-text-normal"),onClick:H.click.files},"Files (",l.notes.length,")")),je.default.createElement(R$,null),je.default.createElement("div",null,je.default.createElement(O9e,{IconComponent:_i,title:"Ignore Files",iconColorClassName:"tw-text-context-manager-red",onAddClick:H.add.ignoreFile}),je.default.createElement("div",{className:he("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",g==="ignoreFiles"&&"tw-bg-secondary tw-text-normal"),onClick:H.click.ignoreFiles},"Files (",d.files.size,")")))))),je.default.createElement(zfr,{withHandle:!0}),je.default.createElement(_9e,{defaultSize:o?65:70},je.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},je.default.createElement("div",{className:"tw-border-b tw-p-4"},je.default.createElement(sve,{placeholder:"Custom search: title, #tag1, .jpg",value:h,onChange:U=>{y(U),U&&L("search",null,!1)}})),je.default.createElement("div",{className:"tw-p-4"},je.default.createElement("h3",{className:"tw-text-lg tw-font-medium tw-text-muted"},G())),je.default.createElement(ave,{className:"tw-max-h-[400px] tw-flex-1 tw-p-4 tw-pt-0"},N.length===0?je.default.createElement("div",{className:"tw-mt-10 tw-text-center tw-text-muted"},g?"No items found.":"No categories found. Add tags, folders, or files using the sidebar."):je.default.createElement("div",{className:"tw-space-y-2",style:{display:"block"}},g||h?I(N).map(U=>hpr(U)?null:je.default.createElement(nWn,{key:U.id,item:U,viewMode:"list",onDelete:g==="ignoreFiles"||U.isIgnored?Q:X})).filter(Boolean):N.map(U=>hpr(U)?je.default.createElement(oWn,{key:U.id,item:U,onClick:K}):null).filter(Boolean)))))),je.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2 tw-border-t tw-p-1"},je.default.createElement(me,{variant:"ghost",onClick:r},"Cancel"),je.default.createElement(me,{onClick:ee},"Save")))}var uve=class extends $V.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r,modalEl:n}=this;this.root=(0,gpr.createRoot)(r),n.style.minWidth="50vw";let o=a=>{this.onSave(a),this.close()},i=()=>{this.close()};this.root.render(je.default.createElement(iWn,{initialProject:this.initialProject,onSave:o,onCancel:i,app:this.app}))}onClose(){this.root&&this.root.unmount()}};Un();var BV=j(Z());var Xn=({label:t,required:e=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>BV.default.createElement("div",{className:"tw-space-y-2"},t&&BV.default.createElement(om,{className:r?"tw-text-error":""},t," ",e&&BV.default.createElement("span",{className:"tw-text-error"},"*")),n&&BV.default.createElement("p",{className:"tw-text-sm tw-text-muted"},n),i,r&&BV.default.createElement("p",{className:"tw-text-xs tw-text-error"},o));var U$=j(Z());dn();_n();function lve({options:t,placeholder:e,containerClassName:r,className:n,...o}){return U$.default.createElement("div",{className:he("tw-group tw-relative tw-w-full",r)},U$.default.createElement("select",{className:he("tw-w-full tw-appearance-none","tw-flex tw-h-9 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-dropdown tw-px-3 tw-py-1 tw-pr-8","tw-text-sm tw-shadow tw-transition-colors","focus:tw-outline-none focus:tw-ring-1 focus:tw-ring-ring","disabled:tw-cursor-not-allowed disabled:tw-opacity-50","hover:tw-bg-interactive-hover hover:tw-text-normal",n),...o},e&&U$.default.createElement("option",{value:"",disabled:!0},e),t.map(i=>U$.default.createElement("option",{key:i.value,value:i.value},i.label))),U$.default.createElement("div",{className:he("tw-pointer-events-none tw-absolute tw-inset-y-0 tw-right-0 tw-flex tw-items-center tw-pr-2","tw-transition-colors group-hover:[&>svg]:tw-text-normal",o.disabled&&"tw-opacity-50")},U$.default.createElement($i,{className:"tw-size-4"})))}var IN=j(Z());dn();var H$=j(Z());var ta=j(Z(),1);function E9e(t,[e,r]){return Math.min(r,Math.max(e,t))}function q$(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var bpr=j(Z(),1);function ypr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function aWn(...t){return e=>{let r=!1,n=t.map(o=>{let i=ypr(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():ypr(t[o],null)}}}}function tE(...t){return bpr.useCallback(aWn(...t),t)}var wA=j(Z(),1),_pr=j(at(),1);function cve(t,e=[]){let r=[];function n(i,a){let s=wA.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=wA.useMemo(()=>m,Object.values(m));return(0,_pr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=wA.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>wA.createContext(a));return function(s){let u=s?.[t]||i;return wA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,sWn(o,...e)]}function sWn(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return wA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var xb=j(Z(),1);var vpr=j(Z(),1),dve=globalThis?.document?vpr.useLayoutEffect:()=>{};var fve=j(Z(),1);var uWn=xb[" useInsertionEffect ".trim().toString()]||dve;function wpr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=lWn({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=xb.useRef(t!==void 0);xb.useEffect(()=>{let d=c.current;d!==s&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}let l=xb.useCallback(c=>{if(s){let d=cWn(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function lWn({defaultProp:t,onChange:e}){let[r,n]=xb.useState(t),o=xb.useRef(r),i=xb.useRef(e);return uWn(()=>{i.current=e},[e]),xb.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function cWn(t){return typeof t=="function"}var oJi=Symbol("RADIX:SYNC_STATE");var pve=j(Z(),1),dWn=j(at(),1),fWn=pve.createContext(void 0);function xpr(t){let e=pve.useContext(fWn);return t||e||"ltr"}var mve=j(Z(),1);function Spr(t){let e=mve.useRef({value:t,previous:t});return mve.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Cpr=j(Z(),1);function Opr(t){let[e,r]=Cpr.useState(void 0);return dve(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});let n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;let i=o[0],a,s;if("borderBoxSize"in i){let u=i.borderBoxSize,l=Array.isArray(u)?u[0]:u;a=l.inlineSize,s=l.blockSize}else a=t.offsetWidth,s=t.offsetHeight;r({width:a,height:s})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}var Epr=j(Z(),1),pWn=j(qa(),1);Wv();var Ppr=j(at(),1),mWn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zV=mWn.reduce((t,e)=>{let r=zf(`Primitive.${e}`),n=Epr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Ppr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var AN=j(Z(),1);Wv();var hve=j(at(),1),hWn=j(Z(),1);var gWn=j(at(),1);function Tpr(t){let e=t+"CollectionProvider",[r,n]=cve(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=h=>{let{scope:y,children:g}=h,_=AN.default.useRef(null),w=AN.default.useRef(new Map).current;return(0,hve.jsx)(o,{scope:y,itemMap:w,collectionRef:_,children:g})};a.displayName=e;let s=t+"CollectionSlot",u=zf(s),l=AN.default.forwardRef((h,y)=>{let{scope:g,children:_}=h,w=i(s,g),S=tE(y,w.collectionRef);return(0,hve.jsx)(u,{ref:S,children:_})});l.displayName=s;let c=t+"CollectionItemSlot",d="data-radix-collection-item",f=zf(c),p=AN.default.forwardRef((h,y)=>{let{scope:g,children:_,...w}=h,S=AN.default.useRef(null),C=tE(y,S),E=i(c,g);return AN.default.useEffect(()=>(E.itemMap.set(S,{ref:S,...w}),()=>void E.itemMap.delete(S))),(0,hve.jsx)(f,{[d]:"",ref:C,children:_})});p.displayName=c;function m(h){let y=i(t+"CollectionConsumer",h);return AN.default.useCallback(()=>{let _=y.collectionRef.current;if(!_)return[];let w=Array.from(_.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((E,P)=>w.indexOf(E.ref.current)-w.indexOf(P.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:l,ItemSlot:p},m,n]}var Mc=j(at(),1),Apr=["PageUp","PageDown"],Ipr=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Mpr={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},UV="Slider",[P9e,yWn,bWn]=Tpr(UV),[Rpr,AJi]=cve(UV,[bWn]),[_Wn,gve]=Rpr(UV),Npr=ta.forwardRef((t,e)=>{let{name:r,min:n=0,max:o=100,step:i=1,orientation:a="horizontal",disabled:s=!1,minStepsBetweenThumbs:u=0,defaultValue:l=[n],value:c,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:p=!1,form:m,...h}=t,y=ta.useRef(new Set),g=ta.useRef(0),w=a==="horizontal"?vWn:wWn,[S=[],C]=wpr({prop:c,defaultProp:l,onChange:M=>{[...y.current][g.current]?.focus(),d(M)}}),E=ta.useRef(S);function P(M){let D=EWn(S,M);N(M,D)}function T(M){N(M,g.current)}function I(){let M=E.current[g.current];S[g.current]!==M&&f(S)}function N(M,D,{commit:k}={commit:!1}){let L=IWn(i),H=MWn(Math.round((M-n)/i)*i+n,L),K=E9e(H,[n,o]);C((G=[])=>{let X=CWn(G,K,D);if(AWn(X,u*i)){g.current=X.indexOf(K);let F=String(X)!==String(G);return F&&k&&f(X),F?X:G}else return G})}return(0,Mc.jsx)(_Wn,{scope:t.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:g,thumbs:y.current,values:S,orientation:a,form:m,children:(0,Mc.jsx)(P9e.Provider,{scope:t.__scopeSlider,children:(0,Mc.jsx)(P9e.Slot,{scope:t.__scopeSlider,children:(0,Mc.jsx)(w,{"aria-disabled":s,"data-disabled":s?"":void 0,...h,ref:e,onPointerDown:q$(h.onPointerDown,()=>{s||(E.current=S)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:P,onSlideMove:s?void 0:T,onSlideEnd:s?void 0:I,onHomeKeyDown:()=>!s&&N(n,0,{commit:!0}),onEndKeyDown:()=>!s&&N(o,S.length-1,{commit:!0}),onStepKeyDown:({event:M,direction:D})=>{if(!s){let H=Apr.includes(M.key)||M.shiftKey&&Ipr.includes(M.key)?10:1,K=g.current,G=S[K],X=i*H*D;N(G+X,K,{commit:!0})}}})})})})});Npr.displayName=UV;var[jpr,Dpr]=Rpr(UV,{startEdge:"left",endEdge:"right",size:"width",direction:1}),vWn=ta.forwardRef((t,e)=>{let{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:u,onStepKeyDown:l,...c}=t,[d,f]=ta.useState(null),p=tE(e,w=>f(w)),m=ta.useRef(void 0),h=xpr(o),y=h==="ltr",g=y&&!i||!y&&i;function _(w){let S=m.current||d.getBoundingClientRect(),C=[0,S.width],P=I9e(C,g?[r,n]:[n,r]);return m.current=S,P(w-S.left)}return(0,Mc.jsx)(jpr,{scope:t.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:(0,Mc.jsx)(Lpr,{dir:h,"data-orientation":"horizontal",...c,ref:p,style:{...c.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{let S=_(w.clientX);a?.(S)},onSlideMove:w=>{let S=_(w.clientX);s?.(S)},onSlideEnd:()=>{m.current=void 0,u?.()},onStepKeyDown:w=>{let C=Mpr[g?"from-left":"from-right"].includes(w.key);l?.({event:w,direction:C?-1:1})}})})}),wWn=ta.forwardRef((t,e)=>{let{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:u,...l}=t,c=ta.useRef(null),d=tE(e,c),f=ta.useRef(void 0),p=!o;function m(h){let y=f.current||c.current.getBoundingClientRect(),g=[0,y.height],w=I9e(g,p?[n,r]:[r,n]);return f.current=y,w(h-y.top)}return(0,Mc.jsx)(jpr,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,Mc.jsx)(Lpr,{"data-orientation":"vertical",...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{let y=m(h.clientY);i?.(y)},onSlideMove:h=>{let y=m(h.clientY);a?.(y)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:h=>{let g=Mpr[p?"from-bottom":"from-top"].includes(h.key);u?.({event:h,direction:g?-1:1})}})})}),Lpr=ta.forwardRef((t,e)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=t,c=gve(UV,r);return(0,Mc.jsx)(zV.span,{...l,ref:e,onKeyDown:q$(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):Apr.concat(Ipr).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:q$(t.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:q$(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:q$(t.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),Fpr="SliderTrack",kpr=ta.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=gve(Fpr,r);return(0,Mc.jsx)(zV.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:e})});kpr.displayName=Fpr;var T9e="SliderRange",$pr=ta.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=gve(T9e,r),i=Dpr(T9e,r),a=ta.useRef(null),s=tE(e,a),u=o.values.length,l=o.values.map(f=>Upr(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,Mc.jsx)(zV.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...t.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});$pr.displayName=T9e;var A9e="SliderThumb",Bpr=ta.forwardRef((t,e)=>{let r=yWn(t.__scopeSlider),[n,o]=ta.useState(null),i=tE(e,s=>o(s)),a=ta.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,Mc.jsx)(xWn,{...t,ref:i,index:a})}),xWn=ta.forwardRef((t,e)=>{let{__scopeSlider:r,index:n,name:o,...i}=t,a=gve(A9e,r),s=Dpr(A9e,r),[u,l]=ta.useState(null),c=tE(e,_=>l(_)),d=u?a.form||!!u.closest("form"):!0,f=Opr(u),p=a.values[n],m=p===void 0?0:Upr(p,a.min,a.max),h=OWn(n,a.values.length),y=f?.[s.size],g=y?PWn(y,m,s.direction):0;return ta.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,Mc.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${m}% + ${g}px)`},children:[(0,Mc.jsx)(P9e.ItemSlot,{scope:t.__scopeSlider,children:(0,Mc.jsx)(zV.span,{role:"slider","aria-label":t["aria-label"]||h,"aria-valuemin":a.min,"aria-valuenow":p,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:c,style:p===void 0?{display:"none"}:t.style,onFocus:q$(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,Mc.jsx)(zpr,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});Bpr.displayName=A9e;var SWn="RadioBubbleInput",zpr=ta.forwardRef(({__scopeSlider:t,value:e,...r},n)=>{let o=ta.useRef(null),i=tE(o,n),a=Spr(e);return ta.useEffect(()=>{let s=o.current;if(!s)return;let u=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(u,"value").set;if(a!==e&&c){let d=new Event("input",{bubbles:!0});c.call(s,e),s.dispatchEvent(d)}},[a,e]),(0,Mc.jsx)(zV.input,{style:{display:"none"},...r,ref:i,defaultValue:e})});zpr.displayName=SWn;function CWn(t=[],e,r){let n=[...t];return n[r]=e,n.sort((o,i)=>o-i)}function Upr(t,e,r){let i=100/(r-e)*(t-e);return E9e(i,[0,100])}function OWn(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function EWn(t,e){if(t.length===1)return 0;let r=t.map(o=>Math.abs(o-e)),n=Math.min(...r);return r.indexOf(n)}function PWn(t,e,r){let n=t/2,i=I9e([0,50],[0,n]);return(n-i(e)*r)*r}function TWn(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function AWn(t,e){if(e>0){let r=TWn(t);return Math.min(...r)>=e}return!0}function I9e(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];let n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function IWn(t){return(String(t).split(".")[1]||"").length}function MWn(t,e){let r=Math.pow(10,e);return Math.round(t*r)/r}var M9e=Npr,qpr=kpr,Hpr=$pr,Vpr=Bpr;dn();var WY=H$.forwardRef(({className:t,...e},r)=>H$.createElement(M9e,{ref:r,className:he("tw-relative tw-flex tw-w-full tw-touch-none tw-select-none tw-items-center",t),...e},H$.createElement(qpr,{className:"tw-relative tw-h-1.5 tw-w-full tw-grow tw-overflow-hidden tw-rounded-full tw-border tw-border-solid tw-bg-interactive-accent/20 tw-border-interactive-accent/30"},H$.createElement(Hpr,{className:"tw-absolute tw-h-full tw-bg-interactive-accent"})),H$.createElement(Vpr,{className:"tw-block tw-size-4 tw-rounded-full tw-border tw-bg-toggle-thumb tw-shadow tw-transition-colors focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring disabled:tw-pointer-events-none disabled:tw-opacity-50"})));WY.displayName=M9e.displayName;function KY({value:t,onChange:e,min:r,max:n,step:o,disabled:i,className:a,suffix:s}){let[u,l]=(0,IN.useState)(t);return(0,IN.useEffect)(()=>{l(t)},[t]),IN.default.createElement("div",{className:he("tw-flex tw-items-center tw-gap-4",a)},IN.default.createElement(WY,{value:[u],onValueChange:([c])=>l(c),onValueCommit:([c])=>e?.(c),min:r,max:n,step:o,disabled:i,className:"tw-flex-1"}),IN.default.createElement("div",{className:"tw-min-w-[40px] tw-text-right tw-text-sm"},u,s))}er();Yp();_t();kt();var qV=require("obsidian"),gr=j(Z()),Wpr=j(Bc());function NWn({initialProject:t,onSave:e,onCancel:r}){let n=an(),[o,i]=(0,gr.useState)(!1),[a,s]=(0,gr.useState)({name:!1,systemPrompt:!1,projectModelKey:!1,inclusions:!1}),[u,l]=(0,gr.useState)(t||{id:ttt(),name:"",description:"",systemPrompt:"",projectModelKey:"",modelConfigs:{temperature:Df.TEMPERATURE,maxTokens:Df.MAX_TOKENS},contextSource:{inclusions:"",exclusions:"",webUrls:"",youtubeUrls:""},created:Date.now(),UsageTimestamps:Date.now()}),c=ah(u.contextSource.inclusions||u.contextSource.exclusions||"nothing").reverse().join(","),d=h=>{new uve(app,async g=>{l(g)},h).open()},f=()=>u.name&&u.projectModelKey,p=(h,y)=>{l(g=>{if(typeof y=="string"&&h==="projectModelKey"&&(y=y.trim()),Array.isArray(y)&&y.every(_=>typeof _=="string")&&(y=y.map(_=>_.trim()).filter(Boolean)),h.includes(".")){let[_,w]=h.split("."),C=g[_];if(typeof C=="object"&&C!==null)return{...g,[_]:{...C,[w]:y}}}return{...g,[h]:y}})},m=async()=>{u.name&&(u.name=u.name.trim());let y=["name","projectModelKey"].filter(g=>!u[g]);if(y.length>0){s(g=>({...g,...Object.fromEntries(y.map(_=>[_,!0]))})),new qV.Notice("Please fill in all required fields");return}try{i(!0),await e(u)}catch(g){new qV.Notice(Fn(g)),s(_=>({..._,name:!0}))}finally{i(!1)}};return gr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-p-4"},gr.default.createElement("div",{className:"tw-mb-2 tw-text-xl tw-font-bold tw-text-normal"},t?"Edit Project":"New Project"),gr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},gr.default.createElement(Xn,{label:"Project Name",required:!0,error:a.name&&!u.name,errorMessage:"Project name is required"},gr.default.createElement(gi,{type:"text",value:u.name,onChange:h=>p("name",h.target.value),onBlur:()=>s(h=>({...h,name:!0})),className:"tw-w-full"})),gr.default.createElement(Xn,{label:"Description",description:"Briefly describe the purpose and goals of the project"},gr.default.createElement(gi,{type:"text",value:u.description,onChange:h=>p("description",h.target.value),className:"tw-w-full"})),gr.default.createElement(Xn,{label:"Project System Prompt",description:"Custom instructions for how the AI should behave in this project context"},gr.default.createElement(ev,{value:u.systemPrompt,onChange:h=>p("systemPrompt",h.target.value),onBlur:()=>s(h=>({...h,systemPrompt:!0})),className:"tw-min-h-32"})),gr.default.createElement(Xn,{label:"Default Model",required:!0,error:a.projectModelKey&&!u.projectModelKey,errorMessage:"Default model is required"},gr.default.createElement(lve,{value:u.projectModelKey,onChange:h=>{let y=h.target.value,g=n.activeModels.find(S=>S.enabled&&Qr(S)===y);if(!g)return;let{hasApiKey:_,errorNotice:w}=sz(g,n);if(!_&&w){new qV.Notice(w);return}p("projectModelKey",y)},onBlur:()=>s(h=>({...h,projectModelKey:!0})),placeholder:"Select a model",options:n.activeModels.filter(h=>h.enabled&&h.projectEnabled).map(h=>({label:YH(h),value:Qr(h)}))})),gr.default.createElement("div",{className:"tw-space-y-4"},gr.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Model Configuration"),gr.default.createElement("div",{className:"tw-grid tw-grid-cols-1 tw-gap-4"},gr.default.createElement(Xn,{label:"Temperature"},gr.default.createElement(KY,{value:u.modelConfigs?.temperature??Df.TEMPERATURE,onChange:h=>p("modelConfigs.temperature",h),min:0,max:2,step:.01,className:"tw-w-full"})),gr.default.createElement(Xn,{label:"Token Limit"},gr.default.createElement(KY,{value:u.modelConfigs?.maxTokens??Df.MAX_TOKENS,onChange:h=>p("modelConfigs.maxTokens",h),min:1,max:65e3,step:1,className:"tw-w-full"})))),gr.default.createElement("div",{className:"tw-space-y-4"},gr.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Context Sources"),gr.default.createElement(Xn,{label:gr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},gr.default.createElement("span",null,"File Context"),gr.default.createElement(jn,{buttonClassName:"tw-size-4 tw-text-muted",content:gr.default.createElement("div",{className:"tw-max-w-80"},gr.default.createElement("strong",null,"Supported File Types:"),gr.default.createElement("br",null),gr.default.createElement("strong",null,"\u2022 Documents:")," pdf, doc, docx, ppt, pptx, epub, txt, rtf and many more",gr.default.createElement("br",null),gr.default.createElement("strong",null,"\u2022 Images:")," jpg, png, svg, gif, bmp, webp, tiff",gr.default.createElement("br",null),gr.default.createElement("strong",null,"\u2022 Spreadsheets:")," xlsx, xls, csv, numbers",gr.default.createElement("br",null),gr.default.createElement("br",null),"Non-markdown files are converted to markdown in the background.",gr.default.createElement("br",null),gr.default.createElement("strong",null,"Rate limit:")," 50 files or 100MB per 3 hours, whichever is reached first.")})),description:"Define patterns to include specific files, folders or tags (specified in the note property) in the project context."},gr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},gr.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-row"},gr.default.createElement(Eh,{className:"tw-max-w-[100px] tw-text-sm tw-text-accent"},c)),gr.default.createElement(me,{variant:"secondary",onClick:()=>{d(u)}},"Manage Context"))),gr.default.createElement(Xn,{label:"Web URLs"},gr.default.createElement(ev,{value:u.contextSource?.webUrls,onChange:h=>{let g=h.target.value.split(`
`).map(_=>{if(!_.trim())return _;try{return new URL(_.trim()),_}catch{return _}});p("contextSource.webUrls",g.join(`
`))},placeholder:"Enter web URLs, one per line",className:"tw-min-h-20 tw-w-full"})),gr.default.createElement(Xn,{label:"YouTube URLs"},gr.default.createElement(ev,{value:u.contextSource?.youtubeUrls,onChange:h=>{let g=h.target.value.split(`
`).map(_=>{if(!_.trim())return _;try{let w=new URL(_.trim());return w.hostname.includes("youtube.com")||w.hostname.includes("youtu.be"),_}catch{return _}});p("contextSource.youtubeUrls",g.join(`
`))},placeholder:"Enter YouTube URLs, one per line",className:"tw-min-h-20 tw-w-full"})))),gr.default.createElement("div",{className:"tw-mt-4 tw-flex tw-items-center tw-justify-end tw-gap-2"},gr.default.createElement(me,{variant:"ghost",onClick:r,disabled:o},"Cancel"),gr.default.createElement(me,{onClick:m,disabled:o||!f()},o?"Saving...":"Save")))}var GY=class extends qV.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r}=this;this.root=(0,Wpr.createRoot)(r);let n=async i=>{await this.onSave(i),this.close()},o=()=>{this.close()};this.root.render(gr.default.createElement(NWn,{initialProject:this.initialProject,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};Un();var ra=j(Z());var pt=j(Z(),1),rKe=j(qa(),1);function R9e(t,[e,r]){return Math.min(r,Math.max(e,t))}function Gs(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var MN=j(Z(),1);var xA=j(Z(),1),Kpr=j(at(),1);function Gpr(t,e=[]){let r=[];function n(i,a){let s=xA.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,y=xA.useMemo(()=>m,Object.values(m));return(0,Kpr.jsx)(h.Provider,{value:y,children:p})}function c(d,f){let p=f?.[t][u]||s,m=xA.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>xA.createContext(a));return function(s){let u=s?.[t]||i;return xA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,jWn(o,...e)]}function jWn(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return xA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var hf=j(Z(),1);var HV=j(at(),1),yve=hf.forwardRef((t,e)=>{let{children:r,...n}=t,o=hf.Children.toArray(r),i=o.find(LWn);if(i){let a=i.props.children,s=o.map(u=>u===i?hf.Children.count(a)>1?hf.Children.only(null):hf.isValidElement(a)?a.props.children:null:u);return(0,HV.jsx)(N9e,{...n,ref:e,children:hf.isValidElement(a)?hf.cloneElement(a,void 0,s):null})}return(0,HV.jsx)(N9e,{...n,ref:e,children:r})});yve.displayName="Slot";var N9e=hf.forwardRef((t,e)=>{let{children:r,...n}=t;if(hf.isValidElement(r)){let o=kWn(r);return hf.cloneElement(r,{...FWn(n,r.props),ref:e?l$(e,o):o})}return hf.Children.count(r)>1?hf.Children.only(null):null});N9e.displayName="SlotClone";var DWn=({children:t})=>(0,HV.jsx)(HV.Fragment,{children:t});function LWn(t){return hf.isValidElement(t)&&t.type===DWn}function FWn(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function kWn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var bve=j(at(),1);function Jpr(t){let e=t+"CollectionProvider",[r,n]=Gpr(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,y=MN.default.useRef(null),g=MN.default.useRef(new Map).current;return(0,bve.jsx)(o,{scope:m,itemMap:g,collectionRef:y,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=MN.default.forwardRef((p,m)=>{let{scope:h,children:y}=p,g=i(s,h),_=Ws(m,g.collectionRef);return(0,bve.jsx)(yve,{ref:_,children:y})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=MN.default.forwardRef((p,m)=>{let{scope:h,children:y,...g}=p,_=MN.default.useRef(null),w=Ws(m,_),S=i(l,h);return MN.default.useEffect(()=>(S.itemMap.set(_,{ref:_,...g}),()=>void S.itemMap.delete(_))),(0,bve.jsx)(yve,{[c]:"",ref:w,children:y})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return MN.default.useCallback(()=>{let y=m.collectionRef.current;if(!y)return[];let g=Array.from(y.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((S,C)=>g.indexOf(S.ref.current)-g.indexOf(C.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var As=j(Z(),1);var D9e=j(at(),1),$Wn="DismissableLayer",j9e="dismissableLayer.update",BWn="dismissableLayer.pointerDownOutside",zWn="dismissableLayer.focusOutside",Zpr,Xpr=As.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),L9e=As.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=As.useContext(Xpr),[c,d]=As.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=As.useState({}),m=Ws(e,P=>d(P)),h=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(y),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=g,C=HWn(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=VWn(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return nN(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),As.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Zpr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),Ypr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Zpr)}},[c,f,r,l]),As.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),Ypr())},[c,l]),As.useEffect(()=>{let P=()=>p({});return document.addEventListener(j9e,P),()=>document.removeEventListener(j9e,P)},[]),(0,D9e.jsx)(qi.div,{...u,ref:m,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:Gs(t.onFocusCapture,E.onFocusCapture),onBlurCapture:Gs(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Gs(t.onPointerDownCapture,C.onPointerDownCapture)})});L9e.displayName=$Wn;var UWn="DismissableLayerBranch",qWn=As.forwardRef((t,e)=>{let r=As.useContext(Xpr),n=As.useRef(null),o=Ws(e,n);return As.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,D9e.jsx)(qi.div,{...t,ref:o})});qWn.displayName=UWn;function HWn(t,e=globalThis?.document){let r=un(t),n=As.useRef(!1),o=As.useRef(()=>{});return As.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Qpr(BWn,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function VWn(t,e=globalThis?.document){let r=un(t),n=As.useRef(!1);return As.useEffect(()=>{let o=i=>{i.target&&!n.current&&Qpr(zWn,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Ypr(){let t=new CustomEvent(j9e);document.dispatchEvent(t)}function Qpr(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?lir(o,i):o.dispatchEvent(i)}var Sb=j(Z(),1);var omr=j(at(),1),F9e="focusScope.autoFocusOnMount",k9e="focusScope.autoFocusOnUnmount",emr={bubbles:!1,cancelable:!0},WWn="FocusScope",$9e=Sb.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Sb.useState(null),l=un(o),c=un(i),d=Sb.useRef(null),f=Ws(e,h=>u(h)),p=Sb.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Sb.useEffect(()=>{if(n){let _=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:RN(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||RN(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let T of E)T.removedNodes.length>0&&RN(s)};var h=_,y=w,g=S;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(S);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),Sb.useEffect(()=>{if(s){rmr.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(F9e,emr);s.addEventListener(F9e,l),s.dispatchEvent(g),g.defaultPrevented||(KWn(XWn(imr(s)),{select:!0}),document.activeElement===h&&RN(s))}return()=>{s.removeEventListener(F9e,l),setTimeout(()=>{let g=new CustomEvent(k9e,emr);s.addEventListener(k9e,c),s.dispatchEvent(g),g.defaultPrevented||RN(h??document.body,{select:!0}),s.removeEventListener(k9e,c),rmr.remove(p)},0)}}},[s,l,c,p]);let m=Sb.useCallback(h=>{if(!r&&!n||p.paused)return;let y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(y&&g){let _=h.currentTarget,[w,S]=GWn(_);w&&S?!h.shiftKey&&g===S?(h.preventDefault(),r&&RN(w,{select:!0})):h.shiftKey&&g===w&&(h.preventDefault(),r&&RN(S,{select:!0})):g===_&&h.preventDefault()}},[r,n,p.paused]);return(0,omr.jsx)(qi.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});$9e.displayName=WWn;function KWn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(RN(n,{select:e}),document.activeElement!==r)return}function GWn(t){let e=imr(t),r=tmr(e,t),n=tmr(e.reverse(),t);return[r,n]}function imr(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{let o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function tmr(t,e){for(let r of t)if(!JWn(r,{upTo:e}))return r}function JWn(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function ZWn(t){return t instanceof HTMLInputElement&&"select"in t}function RN(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&ZWn(t)&&e&&t.select()}}var rmr=YWn();function YWn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=nmr(t,e),t.unshift(e)},remove(e){t=nmr(t,e),t[0]?.resume()}}}function nmr(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function XWn(t){return t.filter(e=>e.tagName!=="A")}var Mg=j(Z(),1);var amr=j(Z(),1);var B9e=j(at(),1),QWn="Arrow",smr=amr.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,B9e.jsx)(qi.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,B9e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});smr.displayName=QWn;var umr=smr;var SA=j(Z(),1),lmr=j(at(),1);function cmr(t,e=[]){let r=[];function n(i,a){let s=SA.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,y=SA.useMemo(()=>m,Object.values(m));return(0,lmr.jsx)(h.Provider,{value:y,children:p})}function c(d,f){let p=f?.[t][u]||s,m=SA.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>SA.createContext(a));return function(s){let u=s?.[t]||i;return SA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,t9n(o,...e)]}function t9n(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return SA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var NN=j(at(),1);var z9e="Popper",[dmr,U9e]=cmr(z9e),[r9n,fmr]=dmr(z9e),pmr=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Mg.useState(null);return(0,NN.jsx)(r9n,{scope:e,anchor:n,onAnchorChange:o,children:r})};pmr.displayName=z9e;var mmr="PopperAnchor",hmr=Mg.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=fmr(mmr,r),a=Mg.useRef(null),s=Ws(e,a);return Mg.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,NN.jsx)(qi.div,{...o,ref:s})});hmr.displayName=mmr;var q9e="PopperContent",[n9n,o9n]=dmr(q9e),gmr=Mg.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,y=fmr(q9e,r),[g,_]=Mg.useState(null),w=Ws(e,J=>_(J)),[S,C]=Mg.useState(null),E=J1(S),P=E?.width??0,T=E?.height??0,I=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},M=Array.isArray(l)?l:[l],D=M.length>0,k={padding:N,boundary:M.filter(a9n),altBoundary:D},{refs:L,floatingStyles:H,placement:K,isPositioned:G,middlewareData:X}=aN({strategy:"fixed",placement:I,whileElementsMounted:(...J)=>pA(...J,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[sN({mainAxis:o+T,alignmentAxis:a}),u&&uN({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?lN():void 0,...k}),u&&cN({...k}),dN({...k,apply:({elements:J,rects:se,availableWidth:be,availableHeight:ce})=>{let{width:pe,height:Me}=se.reference,Ue=J.floating.style;Ue.setProperty("--radix-popper-available-width",`${be}px`),Ue.setProperty("--radix-popper-available-height",`${ce}px`),Ue.setProperty("--radix-popper-anchor-width",`${pe}px`),Ue.setProperty("--radix-popper-anchor-height",`${Me}px`)}}),S&&pN({element:S,padding:s}),s9n({arrowWidth:P,arrowHeight:T}),f&&fN({strategy:"referenceHidden",...k})]}),[F,Q]=_mr(K),ee=un(m);vo(()=>{G&&ee?.()},[G,ee]);let U=X.arrow?.x,z=X.arrow?.y,V=X.arrow?.centerOffset!==0,[q,W]=Mg.useState();return vo(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,NN.jsx)("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:G?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:q,"--radix-popper-transform-origin":[X.transformOrigin?.x,X.transformOrigin?.y].join(" "),...X.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,NN.jsx)(n9n,{scope:r,placedSide:F,onArrowChange:C,arrowX:U,arrowY:z,shouldHideArrow:V,children:(0,NN.jsx)(qi.div,{"data-side":F,"data-align":Q,...h,ref:w,style:{...h.style,animation:G?void 0:"none"}})})})});gmr.displayName=q9e;var ymr="PopperArrow",i9n={top:"bottom",right:"left",bottom:"top",left:"right"},bmr=Mg.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=o9n(ymr,n),a=i9n[i.placedSide];return(0,NN.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,NN.jsx)(umr,{...o,ref:r,style:{...o.style,display:"block"}})})});bmr.displayName=ymr;function a9n(t){return t!==null}var s9n=t=>({name:"transformOrigin",options:t,fn(e){let{placement:r,rects:n,middlewareData:o}=e,a=o.arrow?.centerOffset!==0,s=a?0:t.arrowWidth,u=a?0:t.arrowHeight,[l,c]=_mr(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function _mr(t){let[e,r="center"]=t.split("-");return[e,r]}var vmr=pmr,wmr=hmr,xmr=gmr,Smr=bmr;var _ve=j(Z(),1),Cmr=j(qa(),1);var Omr=j(at(),1),l9n="Portal",H9e=_ve.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=_ve.useState(!1);vo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Cmr.default.createPortal((0,Omr.jsx)(qi.div,{...n,ref:e}),a):null});H9e.displayName=l9n;var gf=j(Z(),1);var VV=j(at(),1),W9e=gf.forwardRef((t,e)=>{let{children:r,...n}=t,o=gf.Children.toArray(r),i=o.find(d9n);if(i){let a=i.props.children,s=o.map(u=>u===i?gf.Children.count(a)>1?gf.Children.only(null):gf.isValidElement(a)?a.props.children:null:u);return(0,VV.jsx)(V9e,{...n,ref:e,children:gf.isValidElement(a)?gf.cloneElement(a,void 0,s):null})}return(0,VV.jsx)(V9e,{...n,ref:e,children:r})});W9e.displayName="Slot";var V9e=gf.forwardRef((t,e)=>{let{children:r,...n}=t;if(gf.isValidElement(r)){let o=p9n(r);return gf.cloneElement(r,{...f9n(n,r.props),ref:e?l$(e,o):o})}return gf.Children.count(r)>1?gf.Children.only(null):null});V9e.displayName="SlotClone";var c9n=({children:t})=>(0,VV.jsx)(VV.Fragment,{children:t});function d9n(t){return gf.isValidElement(t)&&t.type===c9n}function f9n(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function p9n(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Emr=j(Z(),1);var Pmr=j(at(),1),m9n="VisuallyHidden",K9e=Emr.forwardRef((t,e)=>(0,Pmr.jsx)(qi.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));K9e.displayName=m9n;var xve=j(Z());var hp=j(Z());var vve=C$();var G9e=function(){},JY=hp.forwardRef(function(t,e){var r=hp.useRef(null),n=hp.useState({onScrollCapture:G9e,onWheelCapture:G9e,onTouchMoveCapture:G9e}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,y=t.as,g=y===void 0?"div":y,_=t.gapMode,w=bN(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,C=S$([r,e]),E=Di(Di({},w),o);return hp.createElement(hp.Fragment,null,c&&hp.createElement(S,{sideCar:vve,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:_}),a?hp.cloneElement(hp.Children.only(s),Di(Di({},E),{ref:C})):hp.createElement(g,Di({},E,{className:u,ref:C}),s))});JY.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};JY.classNames={fullWidth:av,zeroRight:iv};var Fa=j(Z());var J9e=!1;if(typeof window<"u")try{ZY=Object.defineProperty({},"passive",{get:function(){return J9e=!0,!0}}),window.addEventListener("test",ZY,ZY),window.removeEventListener("test",ZY,ZY)}catch{J9e=!1}var ZY,V$=J9e?{passive:!1}:!1;var h9n=function(t){return t.tagName==="TEXTAREA"},Tmr=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!h9n(t)&&r[e]==="visible")},g9n=function(t){return Tmr(t,"overflowY")},y9n=function(t){return Tmr(t,"overflowX")},Z9e=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=Amr(t,n);if(o){var i=Imr(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},b9n=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},_9n=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},Amr=function(t,e){return t==="v"?g9n(e):y9n(e)},Imr=function(t,e){return t==="v"?b9n(e):_9n(e)},v9n=function(t,e){return t==="h"&&e==="rtl"?-1:1},Mmr=function(t,e,r,n,o){var i=v9n(t,window.getComputedStyle(e).direction),a=i*n,s=r.target,u=e.contains(s),l=!1,c=a>0,d=0,f=0;do{var p=Imr(t,s),m=p[0],h=p[1],y=p[2],g=h-y-i*m;(m||g)&&Amr(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var wve=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Rmr=function(t){return[t.deltaX,t.deltaY]},Nmr=function(t){return t&&"current"in t?t.current:t},w9n=function(t,e){return t[0]===e[0]&&t[1]===e[1]},x9n=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},S9n=0,WV=[];function jmr(t){var e=Fa.useRef([]),r=Fa.useRef([0,0]),n=Fa.useRef(),o=Fa.useState(S9n++)[0],i=Fa.useState(mA)[0],a=Fa.useRef(t);Fa.useEffect(function(){a.current=t},[t]),Fa.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=fV([t.lockRef.current],(t.shards||[]).map(Nmr),!0).filter(Boolean);return h.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Fa.useCallback(function(h,y){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=wve(h),_=r.current,w="deltaX"in h?h.deltaX:_[0]-g[0],S="deltaY"in h?h.deltaY:_[1]-g[1],C,E=h.target,P=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in h&&P==="h"&&E.type==="range")return!1;var T=Z9e(P,E);if(!T)return!0;if(T?C=P:(C=P==="v"?"h":"v",T=Z9e(P,E)),!T)return!1;if(!n.current&&"changedTouches"in h&&(w||S)&&(n.current=C),!C)return!0;var I=n.current||C;return Mmr(I,y,h,I==="h"?w:S,!0)},[]),u=Fa.useCallback(function(h){var y=h;if(!(!WV.length||WV[WV.length-1]!==i)){var g="deltaY"in y?Rmr(y):wve(y),_=e.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&w9n(C.delta,g)})[0];if(_&&_.should){y.cancelable&&y.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(Nmr).filter(Boolean).filter(function(C){return C.contains(y.target)}),S=w.length>0?s(y,w[0]):!a.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),l=Fa.useCallback(function(h,y,g,_){var w={name:h,delta:y,target:g,should:_,shadowParent:C9n(g)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),c=Fa.useCallback(function(h){r.current=wve(h),n.current=void 0},[]),d=Fa.useCallback(function(h){l(h.type,Rmr(h),h.target,s(h,t.lockRef.current))},[]),f=Fa.useCallback(function(h){l(h.type,wve(h),h.target,s(h,t.lockRef.current))},[]);Fa.useEffect(function(){return WV.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,V$),document.addEventListener("touchmove",u,V$),document.addEventListener("touchstart",c,V$),function(){WV=WV.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,V$),document.removeEventListener("touchmove",u,V$),document.removeEventListener("touchstart",c,V$)}},[]);var p=t.removeScrollBar,m=t.inert;return Fa.createElement(Fa.Fragment,null,m?Fa.createElement(i,{styles:x9n(o)}):null,p?Fa.createElement(E$,{gapMode:t.gapMode}):null)}function C9n(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var Dmr=O$(vve,jmr);var Lmr=xve.forwardRef(function(t,e){return xve.createElement(JY,Di({},t,{ref:e,sideCar:Dmr}))});Lmr.classNames=JY.classNames;var YY=Lmr;var br=j(at(),1),O9n=[" ","Enter","ArrowUp","ArrowDown"],E9n=[" ","Enter"],QY="Select",[Cve,Ove,P9n]=Jpr(QY),[KV,OZi]=ts(QY,[P9n,U9e]),Eve=U9e(),[T9n,jN]=KV(QY),[A9n,I9n]=KV(QY),Fmr=t=>{let{__scopeSelect:e,children:r,open:n,defaultOpen:o,onOpenChange:i,value:a,defaultValue:s,onValueChange:u,dir:l,name:c,autoComplete:d,disabled:f,required:p,form:m}=t,h=Eve(e),[y,g]=pt.useState(null),[_,w]=pt.useState(null),[S,C]=pt.useState(!1),E=iV(l),[P=!1,T]=im({prop:n,defaultProp:o,onChange:i}),[I,N]=im({prop:a,defaultProp:s,onChange:u}),M=pt.useRef(null),D=y?m||!!y.closest("form"):!0,[k,L]=pt.useState(new Set),H=Array.from(k).map(K=>K.props.value).join(";");return(0,br.jsx)(vmr,{...h,children:(0,br.jsxs)(T9n,{required:p,scope:e,trigger:y,onTriggerChange:g,valueNode:_,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Xl(),value:I,onValueChange:N,open:P,onOpenChange:T,dir:E,triggerPointerDownPosRef:M,disabled:f,children:[(0,br.jsx)(Cve.Provider,{scope:e,children:(0,br.jsx)(A9n,{scope:t.__scopeSelect,onNativeOptionAdd:pt.useCallback(K=>{L(G=>new Set(G).add(K))},[]),onNativeOptionRemove:pt.useCallback(K=>{L(G=>{let X=new Set(G);return X.delete(K),X})},[]),children:r})}),D?(0,br.jsxs)(uhr,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:I,onChange:K=>N(K.target.value),disabled:f,form:m,children:[I===void 0?(0,br.jsx)("option",{value:""}):null,Array.from(k)]},H):null]})})};Fmr.displayName=QY;var kmr="SelectTrigger",$mr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,disabled:n=!1,...o}=t,i=Eve(r),a=jN(kmr,r),s=a.disabled||n,u=Ws(e,a.onTriggerChange),l=Ove(r),c=pt.useRef("touch"),[d,f,p]=lhr(h=>{let y=l().filter(w=>!w.disabled),g=y.find(w=>w.value===a.value),_=chr(y,h,g);_!==void 0&&a.onValueChange(_.value)}),m=h=>{s||(a.onOpenChange(!0),p()),h&&(a.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return(0,br.jsx)(wmr,{asChild:!0,...i,children:(0,br.jsx)(qi.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":shr(a.value)?"":void 0,...o,ref:u,onClick:Gs(o.onClick,h=>{h.currentTarget.focus(),c.current!=="mouse"&&m(h)}),onPointerDown:Gs(o.onPointerDown,h=>{c.current=h.pointerType;let y=h.target;y.hasPointerCapture(h.pointerId)&&y.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(m(h),h.preventDefault())}),onKeyDown:Gs(o.onKeyDown,h=>{let y=d.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(y&&h.key===" ")&&O9n.includes(h.key)&&(m(),h.preventDefault())})})})});$mr.displayName=kmr;var Bmr="SelectValue",zmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=t,u=jN(Bmr,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=Ws(e,u.onValueNodeChange);return vo(()=>{l(c)},[l,c]),(0,br.jsx)(qi.span,{...s,ref:d,style:{pointerEvents:"none"},children:shr(u.value)?(0,br.jsx)(br.Fragment,{children:a}):i})});zmr.displayName=Bmr;var M9n="SelectIcon",Umr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,children:n,...o}=t;return(0,br.jsx)(qi.span,{"aria-hidden":!0,...o,ref:e,children:n||"\u25BC"})});Umr.displayName=M9n;var R9n="SelectPortal",qmr=t=>(0,br.jsx)(H9e,{asChild:!0,...t});qmr.displayName=R9n;var W$="SelectContent",Hmr=pt.forwardRef((t,e)=>{let r=jN(W$,t.__scopeSelect),[n,o]=pt.useState();if(vo(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?rKe.createPortal((0,br.jsx)(Vmr,{scope:t.__scopeSelect,children:(0,br.jsx)(Cve.Slot,{scope:t.__scopeSelect,children:(0,br.jsx)("div",{children:t.children})})}),i):null}return(0,br.jsx)(Wmr,{...t,ref:e})});Hmr.displayName=W$;var hv=10,[Vmr,DN]=KV(W$),N9n="SelectContentImpl",Wmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:a,side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:y,...g}=t,_=jN(W$,r),[w,S]=pt.useState(null),[C,E]=pt.useState(null),P=Ws(e,J=>S(J)),[T,I]=pt.useState(null),[N,M]=pt.useState(null),D=Ove(r),[k,L]=pt.useState(!1),H=pt.useRef(!1);pt.useEffect(()=>{if(w)return yN(w)},[w]),oN();let K=pt.useCallback(J=>{let[se,...be]=D().map(Me=>Me.ref.current),[ce]=be.slice(-1),pe=document.activeElement;for(let Me of J)if(Me===pe||(Me?.scrollIntoView({block:"nearest"}),Me===se&&C&&(C.scrollTop=0),Me===ce&&C&&(C.scrollTop=C.scrollHeight),Me?.focus(),document.activeElement!==pe))return},[D,C]),G=pt.useCallback(()=>K([T,w]),[K,T,w]);pt.useEffect(()=>{k&&G()},[k,G]);let{onOpenChange:X,triggerPointerDownPosRef:F}=_;pt.useEffect(()=>{if(w){let J={x:0,y:0},se=ce=>{J={x:Math.abs(Math.round(ce.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(ce.pageY)-(F.current?.y??0))}},be=ce=>{J.x<=10&&J.y<=10?ce.preventDefault():w.contains(ce.target)||X(!1),document.removeEventListener("pointermove",se),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",be,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",be,{capture:!0})}}},[w,X,F]),pt.useEffect(()=>{let J=()=>X(!1);return window.addEventListener("blur",J),window.addEventListener("resize",J),()=>{window.removeEventListener("blur",J),window.removeEventListener("resize",J)}},[X]);let[Q,ee]=lhr(J=>{let se=D().filter(pe=>!pe.disabled),be=se.find(pe=>pe.ref.current===document.activeElement),ce=chr(se,J,be);ce&&setTimeout(()=>ce.ref.current.focus())}),U=pt.useCallback((J,se,be)=>{let ce=!H.current&&!be;(_.value!==void 0&&_.value===se||ce)&&(I(J),ce&&(H.current=!0))},[_.value]),z=pt.useCallback(()=>w?.focus(),[w]),V=pt.useCallback((J,se,be)=>{let ce=!H.current&&!be;(_.value!==void 0&&_.value===se||ce)&&M(J)},[_.value]),q=n==="popper"?Y9e:Kmr,W=q===Y9e?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:y}:{};return(0,br.jsx)(Vmr,{scope:r,content:w,viewport:C,onViewportChange:E,itemRefCallback:U,selectedItem:T,onItemLeave:z,itemTextRefCallback:V,focusSelectedItem:G,selectedItemText:N,position:n,isPositioned:k,searchRef:Q,children:(0,br.jsx)(YY,{as:W9e,allowPinchZoom:!0,children:(0,br.jsx)($9e,{asChild:!0,trapped:_.open,onMountAutoFocus:J=>{J.preventDefault()},onUnmountAutoFocus:Gs(o,J=>{_.trigger?.focus({preventScroll:!0}),J.preventDefault()}),children:(0,br.jsx)(L9e,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:J=>J.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:(0,br.jsx)(q,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:J=>J.preventDefault(),...g,...W,onPlaced:()=>L(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:Gs(g.onKeyDown,J=>{let se=J.ctrlKey||J.altKey||J.metaKey;if(J.key==="Tab"&&J.preventDefault(),!se&&J.key.length===1&&ee(J.key),["ArrowUp","ArrowDown","Home","End"].includes(J.key)){let ce=D().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);if(["ArrowUp","End"].includes(J.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(J.key)){let pe=J.target,Me=ce.indexOf(pe);ce=ce.slice(Me+1)}setTimeout(()=>K(ce)),J.preventDefault()}})})})})})})});Wmr.displayName=N9n;var j9n="SelectItemAlignedPosition",Kmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,onPlaced:n,...o}=t,i=jN(W$,r),a=DN(W$,r),[s,u]=pt.useState(null),[l,c]=pt.useState(null),d=Ws(e,P=>c(P)),f=Ove(r),p=pt.useRef(!1),m=pt.useRef(!0),{viewport:h,selectedItem:y,selectedItemText:g,focusSelectedItem:_}=a,w=pt.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&h&&y&&g){let P=i.trigger.getBoundingClientRect(),T=l.getBoundingClientRect(),I=i.valueNode.getBoundingClientRect(),N=g.getBoundingClientRect();if(i.dir!=="rtl"){let pe=N.left-T.left,Me=I.left-pe,Ue=P.left-Me,Et=P.width+Ue,pr=Math.max(Et,T.width),$r=window.innerWidth-hv,On=R9e(Me,[hv,Math.max(hv,$r-pr)]);s.style.minWidth=Et+"px",s.style.left=On+"px"}else{let pe=T.right-N.right,Me=window.innerWidth-I.right-pe,Ue=window.innerWidth-P.right-Me,Et=P.width+Ue,pr=Math.max(Et,T.width),$r=window.innerWidth-hv,On=R9e(Me,[hv,Math.max(hv,$r-pr)]);s.style.minWidth=Et+"px",s.style.right=On+"px"}let M=f(),D=window.innerHeight-hv*2,k=h.scrollHeight,L=window.getComputedStyle(l),H=parseInt(L.borderTopWidth,10),K=parseInt(L.paddingTop,10),G=parseInt(L.borderBottomWidth,10),X=parseInt(L.paddingBottom,10),F=H+K+k+X+G,Q=Math.min(y.offsetHeight*5,F),ee=window.getComputedStyle(h),U=parseInt(ee.paddingTop,10),z=parseInt(ee.paddingBottom,10),V=P.top+P.height/2-hv,q=D-V,W=y.offsetHeight/2,J=y.offsetTop+W,se=H+K+J,be=F-se;if(se<=V){let pe=M.length>0&&y===M[M.length-1].ref.current;s.style.bottom="0px";let Me=l.clientHeight-h.offsetTop-h.offsetHeight,Ue=Math.max(q,W+(pe?z:0)+Me+G),Et=se+Ue;s.style.height=Et+"px"}else{let pe=M.length>0&&y===M[0].ref.current;s.style.top="0px";let Ue=Math.max(V,H+h.offsetTop+(pe?U:0)+W)+be;s.style.height=Ue+"px",h.scrollTop=se-V+h.offsetTop}s.style.margin=`${hv}px 0`,s.style.minHeight=Q+"px",s.style.maxHeight=D+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,h,y,g,i.dir,n]);vo(()=>w(),[w]);let[S,C]=pt.useState();vo(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]);let E=pt.useCallback(P=>{P&&m.current===!0&&(w(),_?.(),m.current=!1)},[w,_]);return(0,br.jsx)(L9n,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:E,children:(0,br.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:(0,br.jsx)(qi.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Kmr.displayName=j9n;var D9n="SelectPopperPosition",Y9e=pt.forwardRef((t,e)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=hv,...i}=t,a=Eve(r);return(0,br.jsx)(xmr,{...a,...i,ref:e,align:n,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Y9e.displayName=D9n;var[L9n,nKe]=KV(W$,{}),X9e="SelectViewport",Gmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,nonce:n,...o}=t,i=DN(X9e,r),a=nKe(X9e,r),s=Ws(e,i.onViewportChange),u=pt.useRef(0);return(0,br.jsxs)(br.Fragment,{children:[(0,br.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),(0,br.jsx)(Cve.Slot,{scope:r,children:(0,br.jsx)(qi.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Gs(o.onScroll,l=>{let c=l.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=a;if(f?.current&&d){let p=Math.abs(u.current-c.scrollTop);if(p>0){let m=window.innerHeight-hv*2,h=parseFloat(d.style.minHeight),y=parseFloat(d.style.height),g=Math.max(h,y);if(g<m){let _=g+p,w=Math.min(m,_),S=_-w;d.style.height=w+"px",d.style.bottom==="0px"&&(c.scrollTop=S>0?S:0,d.style.justifyContent="flex-end")}}}u.current=c.scrollTop})})})]})});Gmr.displayName=X9e;var Jmr="SelectGroup",[F9n,k9n]=KV(Jmr),$9n=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=Xl();return(0,br.jsx)(F9n,{scope:r,id:o,children:(0,br.jsx)(qi.div,{role:"group","aria-labelledby":o,...n,ref:e})})});$9n.displayName=Jmr;var Zmr="SelectLabel",Ymr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=k9n(Zmr,r);return(0,br.jsx)(qi.div,{id:o.id,...n,ref:e})});Ymr.displayName=Zmr;var Sve="SelectItem",[B9n,Xmr]=KV(Sve),Qmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=t,s=jN(Sve,r),u=DN(Sve,r),l=s.value===n,[c,d]=pt.useState(i??""),[f,p]=pt.useState(!1),m=Ws(e,_=>u.itemRefCallback?.(_,n,o)),h=Xl(),y=pt.useRef("touch"),g=()=>{o||(s.onValueChange(n),s.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,br.jsx)(B9n,{scope:r,value:n,disabled:o,textId:h,isSelected:l,onItemTextChange:pt.useCallback(_=>{d(w=>w||(_?.textContent??"").trim())},[]),children:(0,br.jsx)(Cve.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,br.jsx)(qi.div,{role:"option","aria-labelledby":h,"data-highlighted":f?"":void 0,"aria-selected":l&&f,"data-state":l?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:m,onFocus:Gs(a.onFocus,()=>p(!0)),onBlur:Gs(a.onBlur,()=>p(!1)),onClick:Gs(a.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:Gs(a.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:Gs(a.onPointerDown,_=>{y.current=_.pointerType}),onPointerMove:Gs(a.onPointerMove,_=>{y.current=_.pointerType,o?u.onItemLeave?.():y.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Gs(a.onPointerLeave,_=>{_.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:Gs(a.onKeyDown,_=>{u.searchRef?.current!==""&&_.key===" "||(E9n.includes(_.key)&&g(),_.key===" "&&_.preventDefault())})})})})});Qmr.displayName=Sve;var XY="SelectItemText",ehr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,...i}=t,a=jN(XY,r),s=DN(XY,r),u=Xmr(XY,r),l=I9n(XY,r),[c,d]=pt.useState(null),f=Ws(e,g=>d(g),u.onItemTextChange,g=>s.itemTextRefCallback?.(g,u.value,u.disabled)),p=c?.textContent,m=pt.useMemo(()=>(0,br.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:y}=l;return vo(()=>(h(m),()=>y(m)),[h,y,m]),(0,br.jsxs)(br.Fragment,{children:[(0,br.jsx)(qi.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?rKe.createPortal(i.children,a.valueNode):null]})});ehr.displayName=XY;var thr="SelectItemIndicator",rhr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return Xmr(thr,r).isSelected?(0,br.jsx)(qi.span,{"aria-hidden":!0,...n,ref:e}):null});rhr.displayName=thr;var Q9e="SelectScrollUpButton",nhr=pt.forwardRef((t,e)=>{let r=DN(Q9e,t.__scopeSelect),n=nKe(Q9e,t.__scopeSelect),[o,i]=pt.useState(!1),a=Ws(e,n.onScrollButtonChange);return vo(()=>{if(r.viewport&&r.isPositioned){let u=function(){let c=l.scrollTop>0;i(c)};var s=u;let l=r.viewport;return u(),l.addEventListener("scroll",u),()=>l.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),o?(0,br.jsx)(ihr,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});nhr.displayName=Q9e;var eKe="SelectScrollDownButton",ohr=pt.forwardRef((t,e)=>{let r=DN(eKe,t.__scopeSelect),n=nKe(eKe,t.__scopeSelect),[o,i]=pt.useState(!1),a=Ws(e,n.onScrollButtonChange);return vo(()=>{if(r.viewport&&r.isPositioned){let u=function(){let c=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<c;i(d)};var s=u;let l=r.viewport;return u(),l.addEventListener("scroll",u),()=>l.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),o?(0,br.jsx)(ihr,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});ohr.displayName=eKe;var ihr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=t,i=DN("SelectScrollButton",r),a=pt.useRef(null),s=Ove(r),u=pt.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return pt.useEffect(()=>()=>u(),[u]),vo(()=>{s().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,br.jsx)(qi.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:Gs(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:Gs(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:Gs(o.onPointerLeave,()=>{u()})})}),z9n="SelectSeparator",ahr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return(0,br.jsx)(qi.div,{"aria-hidden":!0,...n,ref:e})});ahr.displayName=z9n;var tKe="SelectArrow",U9n=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=Eve(r),i=jN(tKe,r),a=DN(tKe,r);return i.open&&a.position==="popper"?(0,br.jsx)(Smr,{...o,...n,ref:e}):null});U9n.displayName=tKe;function shr(t){return t===""||t===void 0}var uhr=pt.forwardRef((t,e)=>{let{value:r,...n}=t,o=pt.useRef(null),i=Ws(e,o),a=Pbe(r);return pt.useEffect(()=>{let s=o.current,u=window.HTMLSelectElement.prototype,c=Object.getOwnPropertyDescriptor(u,"value").set;if(a!==r&&c){let d=new Event("change",{bubbles:!0});c.call(s,r),s.dispatchEvent(d)}},[a,r]),(0,br.jsx)(K9e,{asChild:!0,children:(0,br.jsx)("select",{...n,ref:i,defaultValue:r})})});uhr.displayName="BubbleSelect";function lhr(t){let e=un(t),r=pt.useRef(""),n=pt.useRef(0),o=pt.useCallback(a=>{let s=r.current+a;e(s),function u(l){r.current=l,window.clearTimeout(n.current),l!==""&&(n.current=window.setTimeout(()=>u(""),1e3))}(s)},[e]),i=pt.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return pt.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function chr(t,e,r){let o=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,i=r?t.indexOf(r):-1,a=q9n(t,Math.max(i,0));o.length===1&&(a=a.filter(l=>l!==r));let u=a.find(l=>l.textValue.toLowerCase().startsWith(o.toLowerCase()));return u!==r?u:void 0}function q9n(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var dhr=Fmr,oKe=$mr,fhr=zmr,phr=Umr,mhr=qmr,iKe=Hmr,hhr=Gmr;var aKe=Ymr,sKe=Qmr,ghr=ehr,yhr=rhr,uKe=nhr,lKe=ohr,cKe=ahr;_n();dn();var LN=dhr;var FN=fhr,CA=ra.forwardRef(({className:t,children:e,...r},n)=>ra.createElement(oKe,{ref:n,className:he("tw-border-solid !tw-bg-dropdown !tw-shadow-sm tw-transition-colors","focus-visible:tw-shadow-sm focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring","hover:data-[state=closed]:!tw-bg-interactive-accent hover:data-[state=closed]:!tw-text-on-accent","tw-flex tw-h-9 tw-w-full tw-items-center tw-justify-between tw-whitespace-nowrap tw-rounded-md tw-border tw-border-border tw-px-3 tw-py-1 tw-text-sm tw-ring-offset-ring placeholder:tw-text-muted focus:tw-outline-none focus:tw-ring-1 focus:tw-ring-ring disabled:tw-cursor-not-allowed disabled:tw-opacity-50 [&>span]:tw-line-clamp-1",t),...r},e,ra.createElement(phr,{asChild:!0},ra.createElement($i,{className:"tw-size-4"}))));CA.displayName=oKe.displayName;var bhr=ra.forwardRef(({className:t,...e},r)=>ra.createElement(uKe,{ref:r,className:he("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},ra.createElement(Gb,{className:"tw-size-4"})));bhr.displayName=uKe.displayName;var _hr=ra.forwardRef(({className:t,...e},r)=>ra.createElement(lKe,{ref:r,className:he("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},ra.createElement($i,{className:"tw-size-4"})));_hr.displayName=lKe.displayName;var OA=ra.forwardRef(({className:t,children:e,position:r="popper",container:n,...o},i)=>ra.createElement(mhr,{container:n},ra.createElement(iKe,{ref:i,className:he("tw-relative tw-z-modal tw-max-h-96 tw-min-w-32 tw-overflow-hidden tw-rounded-md tw-border tw-bg-primary tw-text-normal tw-shadow-md data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:tw-translate-y-1 data-[side=left]:-tw-translate-x-1 data-[side=right]:tw-translate-x-1 data-[side=top]:-tw-translate-y-1",t),position:r,...o},ra.createElement(bhr,null),ra.createElement(hhr,{className:he("tw-p-1",r==="popper"&&"tw-h-[var(--radix-select-trigger-height)] tw-w-full tw-min-w-[var(--radix-select-trigger-width)]")},e),ra.createElement(_hr,null))));OA.displayName=iKe.displayName;var V9n=ra.forwardRef(({className:t,...e},r)=>ra.createElement(aKe,{ref:r,className:he("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",t),...e}));V9n.displayName=aKe.displayName;var EA=ra.forwardRef(({className:t,children:e,...r},n)=>ra.createElement(sKe,{ref:n,className:he("tw-relative tw-flex tw-w-full tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-py-1.5 tw-pl-2 tw-pr-8 tw-text-sm tw-outline-none focus:tw-bg-interactive-accent focus:tw-text-on-accent data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",t),...r},ra.createElement("span",{className:"tw-absolute tw-right-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},ra.createElement(yhr,null,ra.createElement(ds,{className:"tw-size-4"}))),ra.createElement(ghr,null,e)));EA.displayName=sKe.displayName;var W9n=ra.forwardRef(({className:t,...e},r)=>ra.createElement(cKe,{ref:r,className:he("-tw-mx-1 tw-my-1 tw-h-px tw-bg-primary-alt",t),...e}));W9n.displayName=cKe.displayName;dn();$t();_t();_n();var whr=require("obsidian"),Fe=j(Z());function K9n(t,e,r={}){let{caseSensitive:n=!1,searchInName:o=!0,searchInDescription:i=!0}=r;if(!e.trim())return!0;let a=n?e:e.toLowerCase();return!!(o&&(n?t.name:t.name.toLowerCase()).includes(a)||i&&t.description&&(n?t.description:t.description.toLowerCase()).includes(a))}function vhr(t,e,r={}){return!t||t.length===0?[]:e.trim()?t.filter(n=>K9n(n,e,r)):t}function G9n({project:t,loadContext:e,onEdit:r,onDelete:n}){return Fe.default.createElement("div",{className:"tw-group tw-flex tw-cursor-pointer tw-items-center tw-justify-between tw-gap-2 tw-rounded-lg tw-border tw-border-solid tw-border-border tw-p-3 tw-transition-all tw-duration-200 tw-bg-secondary/40 hover:tw-border-interactive-accent hover:tw-text-accent hover:tw-shadow-[0_2px_12px_rgba(0,0,0,0.1)] active:tw-scale-[0.98]",onClick:()=>e(t)},Fe.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2 tw-overflow-hidden"},Fe.default.createElement("div",{className:"tw-text-accent"},Fe.default.createElement(cy,{className:"tw-size-4"})),Fe.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-col tw-gap-1.5 tw-overflow-hidden"},Fe.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[13px] tw-font-medium tw-text-normal"},t.name),t.description&&Fe.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[12px] tw-text-muted/80"},t.description))),Fe.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-1 tw-opacity-100 tw-transition-opacity tw-duration-200"},Fe.default.createElement(Zn,null,Fe.default.createElement(Yn,{asChild:!0},Fe.default.createElement(me,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),r(t)}},Fe.default.createElement(Vh,{className:"tw-size-4"}))),Fe.default.createElement(Hn,{side:"bottom"},"Edit Project")),Fe.default.createElement(Zn,null,Fe.default.createElement(Yn,{asChild:!0},Fe.default.createElement(me,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),e(t)}},Fe.default.createElement(Xz,{className:"tw-size-4"}))),Fe.default.createElement(Hn,{side:"bottom"},"Start Chat")),Fe.default.createElement(Zn,null,Fe.default.createElement(Yn,{asChild:!0},Fe.default.createElement(me,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),new Yl(app,()=>n(t),`Are you sure you want to delete project "${t.name}"?`,"Delete Project").open()}},Fe.default.createElement(qm,{className:"tw-size-4"}))),Fe.default.createElement(Hn,{side:"bottom"},"Delete Project"))))}var dKe=(0,Fe.memo)(({className:t,projects:e,defaultOpen:r=!1,app:n,onProjectAdded:o,onEditProject:i,hasMessages:a=!1,showChatUI:s,onClose:u,inputRef:l,onProjectClose:c})=>{let[d,f]=(0,Fe.useState)(r),[p,m]=(0,Fe.useState)(!1),[h,y]=(0,Fe.useState)(null),[g,_]=(0,Fe.useState)("");(0,Fe.useEffect)(()=>{a&&f(!1)},[a]);let w=(0,Fe.useMemo)(()=>vhr(e,g),[e,g]),S=()=>{new GY(n,async N=>{o(N)}).open()},C=I=>{new GY(n,async M=>{i(I,M),h&&h.name===I.name&&y(M)},I).open()},E=I=>{let M=(e||[]).filter(D=>D.name!==I.name);h?.name===I.name&&P(!1),Xe("projectList",M),new whr.Notice(`Project "${I.name}" deleted successfully`)},P=(I,N)=>{if(I){if(!N){ie("Must be exist one project.");return}y(N),m(!0),f(!1)}else{y(null),m(!1),f(!0),s(!1),Vj(null);return}},T=I=>{y(I),m(!0),f(!1),s(!0),Vj(I),setTimeout(()=>{l.current&&l.current.focus()},0)};return Fe.default.createElement("div",{className:he("tw-flex tw-flex-col",t)},Fe.default.createElement("div",{className:"tw-overflow-y-auto"},Fe.default.createElement("div",{className:"tw-flex tw-flex-col"},p&&h?Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-2 tw-py-3"},Fe.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},Fe.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),Fe.default.createElement(LN,{value:h.name,onValueChange:I=>{let N=e.find(M=>M.name===I);N&&T(N)}},Fe.default.createElement(CA,{className:"tw-truncate"},Fe.default.createElement(FN,null,Fe.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},Fe.default.createElement(cy,{className:"tw-size-4 tw-shrink-0 tw-text-accent/70"}),Fe.default.createElement("span",{className:"tw-flex-1 tw-truncate"},h.name)))),Fe.default.createElement(OA,{className:"tw-truncate"},e.map(I=>Fe.default.createElement(EA,{key:I.name,value:I.name,className:"tw-flex tw-items-center tw-gap-2"},Fe.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},Fe.default.createElement(cy,{className:"tw-size-4 tw-shrink-0"}),Fe.default.createElement("span",{className:"tw-truncate"},I.name))))))),Fe.default.createElement("div",{className:"tw-ml-1 tw-flex tw-items-center tw-gap-2"},Fe.default.createElement(me,{variant:"secondary",onClick:()=>C(h),className:"hover:tw-text-on-accent hover:tw-bg-accent/50"},Fe.default.createElement(Vh,{className:"tw-mr-1 tw-size-4"}),"Edit"),Fe.default.createElement(Zn,null,Fe.default.createElement(Yn,{asChild:!0},Fe.default.createElement(me,{variant:"ghost2",size:"icon",onClick:()=>{P(!1),c()},"aria-label":"Close Current Project"},Fe.default.createElement(_i,{className:"tw-size-4"}))),Fe.default.createElement(Hn,{side:"bottom"},"Close Current Project")))):Fe.default.createElement(cv,{open:d,onOpenChange:f,className:"tw-transition-all tw-duration-200 tw-ease-in-out"},Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-4 tw-py-3"},Fe.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},Fe.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),Fe.default.createElement(jn,{content:"Manage your projects with different contexts and configurations.",contentClassName:"tw-w-64",buttonClassName:"tw-size-4 tw-text-muted"})),Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Fe.default.createElement(me,{className:"tw-px-2",variant:"secondary",onClick:S},"Create",Fe.default.createElement(Wh,{className:"tw-size-3"})),e.length>0&&Fe.default.createElement(gA,{asChild:!0},Fe.default.createElement(me,{variant:"ghost2",size:"icon"},d?Fe.default.createElement(Gb,{className:"tw-size-5"}):Fe.default.createElement($i,{className:"tw-size-5"}))),Fe.default.createElement(Zn,null,Fe.default.createElement(Yn,{asChild:!0},Fe.default.createElement(me,{variant:"ghost2",size:"icon",onClick:()=>u(),"aria-label":"close project mode"},Fe.default.createElement(_i,{className:"tw-size-4"}))),Fe.default.createElement(Hn,{side:"bottom"},"Close Project Mode")))),e.length===0&&Fe.default.createElement("div",{className:"tw-px-4 tw-py-2 tw-text-xs tw-text-muted tw-bg-secondary/30"},"No projects available"),Fe.default.createElement(dv,{className:"tw-transition-all tw-duration-200 tw-ease-in-out"},Fe.default.createElement("div",{className:"tw-relative tw-bg-secondary/30"},e.length>0&&Fe.default.createElement("div",{className:"tw-px-4 tw-pb-2 tw-pt-3"},Fe.default.createElement("div",{className:"tw-relative"},Fe.default.createElement(sve,{value:g,onChange:_,placeholder:"Search projects..."}))),Fe.default.createElement("div",{className:"tw-max-h-[calc(3*5.7rem)] tw-overflow-y-auto tw-px-4 tw-pb-6 tw-pt-3"},Fe.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 @2xl:tw-grid @2xl:tw-grid-cols-2 @4xl:tw-grid-cols-3"},w.map(I=>Fe.default.createElement(G9n,{key:I.name,project:I,loadContext:T,onEdit:C,onDelete:E}))),g.trim()&&w.length===0&&Fe.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-py-8 tw-text-muted"},Fe.default.createElement(dD,{className:"tw-mb-3 tw-size-12 tw-text-muted/50"}),Fe.default.createElement("p",{className:"tw-text-base tw-font-medium"},"No matching projects found"),Fe.default.createElement("p",{className:"tw-mt-1 tw-text-sm"},"Try searching with different keywords"))),e.length>0&&Fe.default.createElement("div",{className:"tw-pointer-events-none tw-absolute tw-inset-x-0 tw-bottom-0 tw-h-8 tw-bg-[linear-gradient(to_top,var(--background-primary)_0%,var(--background-primary)_30%,transparent_100%)]"}))))),!p&&Fe.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-4 tw-p-8 tw-text-muted tw-bg-secondary/30"},Fe.default.createElement("div",{className:"tw-max-w-[600px] tw-space-y-4"},Fe.default.createElement("p",{className:"tw-text-center tw-text-base"},"Create your project-based AI assistants with custom instructions, context, and model configurations."),Fe.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 tw-text-sm"},Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Fe.default.createElement(Xz,{className:"tw-size-4"}),Fe.default.createElement("span",null,"Click a project card to start chatting")))))))});dKe.displayName="ProjectList";var kr=j(Z()),bKe=j(Z());var eX=j(Z());var pKe=j(Z(),1);var PA=j(Z(),1),xhr=j(at(),1);function Shr(t,e=[]){let r=[];function n(i,a){let s=PA.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=PA.useMemo(()=>m,Object.values(m));return(0,xhr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=PA.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>PA.createContext(a));return function(s){let u=s?.[t]||i;return PA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,J9n(o,...e)]}function J9n(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return PA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Chr=j(Z(),1),Z9n=j(qa(),1);Wv();var Ohr=j(at(),1),Y9n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fKe=Y9n.reduce((t,e)=>{let r=zf(`Primitive.${e}`),n=Chr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Ohr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Pve=j(at(),1),mKe="Progress",hKe=100,[X9n,QZi]=Shr(mKe),[Q9n,eKn]=X9n(mKe),Thr=pKe.forwardRef((t,e)=>{let{__scopeProgress:r,value:n=null,max:o,getValueLabel:i=tKn,...a}=t;(o||o===0)&&!Ehr(o)&&console.error(rKn(`${o}`,"Progress"));let s=Ehr(o)?o:hKe;n!==null&&!Phr(n,s)&&console.error(nKn(`${n}`,"Progress"));let u=Phr(n,s)?n:null,l=Tve(u)?i(u,s):void 0;return(0,Pve.jsx)(Q9n,{scope:r,value:u,max:s,children:(0,Pve.jsx)(fKe.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":Tve(u)?u:void 0,"aria-valuetext":l,role:"progressbar","data-state":Mhr(u,s),"data-value":u??void 0,"data-max":s,...a,ref:e})})});Thr.displayName=mKe;var Ahr="ProgressIndicator",Ihr=pKe.forwardRef((t,e)=>{let{__scopeProgress:r,...n}=t,o=eKn(Ahr,r);return(0,Pve.jsx)(fKe.div,{"data-state":Mhr(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...n,ref:e})});Ihr.displayName=Ahr;function tKn(t,e){return`${Math.round(t/e*100)}%`}function Mhr(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function Tve(t){return typeof t=="number"}function Ehr(t){return Tve(t)&&!isNaN(t)&&t>0}function Phr(t,e){return Tve(t)&&!isNaN(t)&&t<=e&&t>=0}function rKn(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${hKe}\`.`}function nKn(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
- a positive number
- less than the value passed to \`max\` (or ${hKe} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`}var gKe=Thr,Rhr=Ihr;dn();var yKe=eX.forwardRef(({className:t,value:e,...r},n)=>eX.createElement(gKe,{ref:n,className:he("tw-relative tw-h-2 tw-w-full tw-overflow-hidden tw-rounded-full tw-bg-interactive-accent/20 tw-border-interactive-accent/30",t),...r},eX.createElement(Rhr,{className:"tw-size-full tw-flex-1 tw-bg-interactive-accent tw-transition-all",style:{transform:`translateX(-${100-Math.min(Math.max(e||0,0),100)}%)`}})));yKe.displayName=gKe.displayName;_n();la();Un();$t();function _Ke({plugin:t,setHiddenCard:e}){let[r]=Kee(),n=r.total,o=r.success,i=r.failed,a=r.processingFiles,[s,u]=(0,bKe.useState)(!1),[l,c]=(0,bKe.useState)(!1),d=o.length+i.length,f=n.length>0?Math.round(d/n.length*100):0,p=h=>h.path,m=async h=>{if(!t?.projectManager){ie("ProjectManager not available");return}try{await t.projectManager.retryFailedItem(h)}catch(y){ie(`Error retrying failed item: ${y}`)}};return kr.createElement(L$,{className:"tw-w-full tw-border tw-border-solid tw-border-border tw-bg-transparent tw-shadow-none"},kr.createElement(F$,null,kr.createElement(kY,{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},kr.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},kr.createElement(zm,{className:"tw-size-5"}),"Context Loading"),kr.createElement(me,{size:"sm",variant:"ghost2",className:"tw-size-6 tw-p-0 tw-text-muted",title:"Close Progress Bar",onClick:()=>e(!0)},kr.createElement(_i,{className:"tw-size-4"})))),kr.createElement(k$,{className:"tw-space-y-6"},kr.createElement("div",{className:"tw-space-y-2"},kr.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-text-sm"},kr.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},kr.createElement("span",{className:"tw-text-muted"},"Total progress"),kr.createElement("span",{className:"tw-text-xs tw-text-muted"},"(Success:"," ",kr.createElement("span",{className:"tw-font-medium tw-text-success"},o.length),", Failed: ",kr.createElement("span",{className:"tw-font-medium tw-text-error"},i.length),")")),kr.createElement("span",{className:"tw-font-medium"},d,"/",n.length," (",f,"%)")),kr.createElement(yKe,{value:f,className:"tw-h-2"})),a.length>0&&kr.createElement("div",{className:"tw-space-y-3"},kr.createElement("div",{className:"tw--m-1 tw-flex tw-cursor-pointer tw-items-center tw-gap-2 tw-rounded-md tw-p-1 tw-transition-colors hover:tw-bg-muted/10",onClick:()=>u(!s)},kr.createElement(iu,{className:"tw-size-4 tw-animate-spin tw-text-accent"}),kr.createElement("span",{className:"tw-text-sm tw-font-medium"},"Processing"),s?kr.createElement($i,{className:"tw-ml-auto tw-size-4"}):kr.createElement($m,{className:"tw-ml-auto tw-size-4"})),s&&kr.createElement("div",{className:"tw-max-h-32 tw-space-y-2 tw-overflow-y-auto"},a.map((h,y)=>kr.createElement("div",{key:y,className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2 tw-text-sm tw-bg-faint/10"},kr.createElement("div",{className:"tw-size-2 tw-animate-pulse tw-rounded-full tw-bg-interactive-accent"}),kr.createElement(Eh,{className:"tw-flex-1",title:h},h))))),i.length>0&&kr.createElement("div",{className:"tw-space-y-3"},kr.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},kr.createElement("div",{className:"-tw-m-1 tw-flex tw-flex-1 tw-cursor-pointer tw-items-center tw-gap-2 tw-rounded-md tw-p-1 tw-transition-colors hover:tw-bg-muted/10",onClick:()=>c(!l)},kr.createElement(Kv,{className:"tw-size-4 tw-text-error"}),kr.createElement("span",{className:"tw-text-sm tw-font-medium"},"Failed"),kr.createElement(pp,{variant:"destructive",className:"tw-text-xs"},i.length," files"),l?kr.createElement($i,{className:"tw-ml-auto tw-size-4"}):kr.createElement($m,{className:"tw-ml-auto tw-size-4"}))),l&&kr.createElement("div",{className:"tw-max-h-32 tw-space-y-2 tw-overflow-y-auto"},i.map((h,y)=>kr.createElement("div",{key:y,className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2 tw-text-sm tw-bg-faint/10"},kr.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col tw-gap-1"},kr.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},kr.createElement("div",{className:"tw-size-2 tw-rounded-full tw-bg-error/80"}),kr.createElement(Eh,{className:"tw-flex-1 tw-font-bold",title:h.path},p(h))),kr.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},kr.createElement("div",{className:"tw-size-2 tw-rounded-full"}),h.error&&kr.createElement(Eh,{className:"tw-flex-1 tw-text-xs tw-text-error/80",title:h.error},kr.createElement("span",{className:"tw-text-sm tw-text-error"},"Loading Error: "),h.error))),kr.createElement(me,{size:"sm",variant:"ghost",className:"tw-size-5 tw-p-0",title:`Retry ${h.type} item`,onClick:async g=>{g.stopPropagation(),await m(h)}},kr.createElement(W5,{className:"tw-size-3"}))))))))}er();var md=j(Z());function Nhr(t){let[e,r]=(0,md.useState)([]);(0,md.useEffect)(()=>(r([...t.getMessages()]),t.subscribe(()=>{r([...t.getMessages()])})),[t]);let n=(0,md.useCallback)(async(y,g,_,w=!1)=>await t.sendMessage(y,g,_,w),[t]),o=(0,md.useCallback)(async(y,g,_,w=!1)=>await t.editMessage(y,g,_,w),[t]),i=(0,md.useCallback)(async(y,g,_)=>await t.regenerateMessage(y,g,_),[t]),a=(0,md.useCallback)(async y=>await t.deleteMessage(y),[t]),s=(0,md.useCallback)((y,g,_)=>t.addDisplayMessage(y,g,_),[t]),u=(0,md.useCallback)(y=>t.addFullMessage(y),[t]),l=(0,md.useCallback)(()=>{t.clearMessages()},[t]),c=(0,md.useCallback)(async y=>{await t.truncateAfterMessageId(y)},[t]),d=(0,md.useCallback)(y=>{t.addMessage(y)},[t]),f=(0,md.useCallback)(y=>{t.loadMessages(y)},[t]),p=(0,md.useCallback)(y=>t.getMessage(y),[t]),m=(0,md.useCallback)(()=>t.getLLMMessages(),[t]),h=(0,md.useCallback)(()=>t.getDebugInfo(),[t]);return{messages:e,sendMessage:n,editMessage:o,regenerateMessage:i,deleteMessage:a,addDisplayMessage:s,addFullMessage:u,clearMessages:l,truncateAfterMessageId:c,addMessage:d,loadMessages:f,getMessage:p,getLLMMessages:m,getDebugInfo:h}}er();kt();$t();ZN();var vKe=async(t,e,r,n,o,i={})=>{let a=new AbortController;o(a);try{await e.runChain(t,a,n,r,i)}catch(s){ie("Model request failed:",s);let u="Model request failed: "+Fn(s);r({id:mm(),sender:Yg,isErrorMessage:!0,message:`Error: ${u}`,isVisible:!0,timestamp:nu(new Date)})}};Ude();fy();_t();kt();Bde();var rc=require("obsidian"),Qt=j(Z()),iKn=({chainManager:t,onSaveChat:e,updateUserMessageHistory:r,fileParserManager:n,plugin:o,chatUIState:i})=>{let a=an(),s=(0,Qt.useContext)(OV),{messages:u,addMessage:l}=Nhr(i),[c]=lI(),[d]=Dp(),[f,p]=(0,Qt.useState)(""),[m,h]=(0,Qt.useState)(""),y=(0,Qt.useRef)(null),g=(0,Qt.useCallback)(le=>{y.current=le},[]),[_,w]=(0,Qt.useState)(!1),[S,C]=(0,Qt.useState)(Dv.DEFAULT),[E,P]=(0,Qt.useState)([]),[T,I]=(0,Qt.useState)(!1),[N,M]=(0,Qt.useState)([]),[D,k]=(0,Qt.useState)(!1),[L,H]=(0,Qt.useState)(null),K=(0,Qt.useRef)(!1),G=(0,Qt.useMemo)(()=>({setCurrentAiMessage:le=>K.current&&p(le),setLoadingMessage:le=>K.current&&C(le),setLoading:le=>K.current&&w(le)}),[]),[X]=Ftt(),F=kbe(),Q=()=>z!=="project"?!1:L!==null?L:F==="loading"||F==="error";(0,Qt.useEffect)(()=>{H(null)},[F]);let[ee,U]=(0,Qt.useState)(null),[z,V]=Dp(),q=_4(),W=_R.getInstance(),J=(0,Qt.useRef)(null);(0,Qt.useEffect)(()=>{let le=()=>{J.current&&J.current.focus()};return s?.addEventListener(Qg.CHAT_IS_VISIBLE,le),()=>{s?.removeEventListener(Qg.CHAT_IS_VISIBLE,le)}},[s]);let se=(0,Qt.useContext)(B_e),be=o.app||se,ce=async({toolCalls:le,urls:oe,contextNotes:fe}={})=>{if(!m&&N.length===0)return;let _e=oe&&oe.length>0,ge=m&&W.extractAllUrls(m).length>0;(_e||ge)&&!Fh(d)&&new rc.Notice(dz.URL_PROCESSING_RESTRICTED);try{let Le=[];m&&Le.push({type:"text",text:m});for(let gd of N){let yd=await gd.arrayBuffer(),vf=yR(yd);Le.push({type:"image_url",image_url:{url:`data:${gd.type};base64,${vf}`}})}let Ii=[...fe||[],...E].filter((gd,yd,vf)=>vf.findIndex(Wn=>Wn.path===gd.path)===yd),bi=m;le&&(bi+=" "+le.join(`
`));let _f={notes:Ii,urls:Fh(d)?oe||[]:[],selectedTextContexts:X};h(""),M([]),G.setLoading(!0),G.setLoadingMessage(Dv.DEFAULT);let yp=await i.sendMessage(bi,_f,d,T,Le.length>0?Le:void 0);m&&r(m),a.autosaveChat&&pe();let Vi=i.getLLMMessage(yp);Vi&&await vKe(Vi,t,l,G.setCurrentAiMessage,g,{debug:a.debug,updateLoadingMessage:G.setLoadingMessage}),a.autosaveChat&&pe()}catch(Le){console.error("Error sending message:",Le),new rc.Notice("Failed to send message. Please try again.")}finally{G.setLoading(!1),G.setLoadingMessage(Dv.DEFAULT)}},pe=(0,Qt.useCallback)(async()=>{if(!be){console.error("App instance is not available.");return}try{await i.saveChat(c)}catch(le){console.error("Error saving chat as note:",Fn(le)),new rc.Notice("Failed to save chat as note. Check console for details.")}},[be,i,c]),Me=(0,Qt.useCallback)(le=>{y.current&&(B(`stopping generation..., reason: ${le}`),y.current.abort(le),G.setLoading(!1),G.setLoadingMessage(Dv.DEFAULT))},[G]);(0,Qt.useEffect)(()=>(K.current=!0,()=>{K.current=!1,y.current&&y.current.abort("component-unmount")}),[]);let Ue=(0,Qt.useCallback)(async le=>{if(le<=0){new rc.Notice("Cannot regenerate the first message.");return}let oe=u[le];if(!oe){new rc.Notice("Message not found.");return}G.setCurrentAiMessage(""),G.setLoading(!0);try{await i.regenerateMessage(oe.id,G.setCurrentAiMessage,l)?a.debug&&console.log("Message regenerated successfully"):new rc.Notice("Failed to regenerate message. Please try again."),a.autosaveChat&&pe()}catch(fe){console.error("Error regenerating message:",fe),new rc.Notice("Failed to regenerate message. Please try again.")}finally{G.setLoading(!1)}},[u,i,a.debug,a.autosaveChat,pe,l,G]),Et=(0,Qt.useCallback)(async(le,oe)=>{let fe=u[le];if(!(!fe||fe.message===oe))try{if(!await i.editMessage(fe.id,oe,d,T)){new rc.Notice("Failed to edit message. Please try again.");return}if(fe.sender===So){let ge=le<u.length-1;if(await i.truncateAfterMessageId(fe.id),ge){G.setLoading(!0);try{let Le=i.getLLMMessage(fe.id);Le&&await vKe(Le,t,l,G.setCurrentAiMessage,g,{debug:a.debug,updateLoadingMessage:G.setLoadingMessage})}catch(Le){console.error("Error regenerating AI response:",Le),new rc.Notice("Failed to regenerate AI response. Please try again.")}finally{G.setLoading(!1)}}}a.autosaveChat&&pe()}catch(_e){console.error("Error editing message:",_e),new rc.Notice("Failed to edit message. Please try again.")}},[u,i,d,T,l,t,a.debug,a.autosaveChat,pe,G,g]);(0,Qt.useEffect)(()=>{e&&e(pe)},[e,pe]);let pr=(0,Qt.useCallback)(le=>{let oe=a.projectList||[];if(oe.findIndex(Le=>Le.name===le.name)>=0)throw new Error(`Project "${le.name}" already exists, please use a different name`);let _e=[...oe,le];return Xe("projectList",_e),Su()?.id===le.id?S_e().then(()=>{new rc.Notice(`${le.name} added and context loaded`)}).catch(Le=>{console.error("Error loading project context:",Le),new rc.Notice(`${le.name} added but context loading failed`)}):new rc.Notice(`${le.name} added successfully`),!0},[a.projectList]),$r=(0,Qt.useCallback)((le,oe)=>{let fe=a.projectList||[];if(!fe.find(dr=>dr.name===le.name))throw new Error(`Project "${le.name}" does not exist`);let ge=fe.map(dr=>dr.name===le.name?oe:dr);return Xe("projectList",ge),Su()?.id===le.id?(Vj(oe),S_e().then(()=>{new rc.Notice(`${le.name} updated and context reloaded`)}).catch(dr=>{console.error("Error reloading project context:",dr),new rc.Notice(`${le.name} updated but context reload failed`)})):new rc.Notice(`${le.name} updated successfully`),!0},[a.projectList]),On=(0,Qt.useCallback)(le=>{h(oe=>`${oe} ${le} `)},[]),Br=(0,Qt.useCallback)(le=>{Dtt(le)},[]),Tr=(0,Qt.useCallback)(async le=>{let oe=u[le];if(!oe){new rc.Notice("Message not found.");return}try{await i.deleteMessage(oe.id)||new rc.Notice("Failed to delete message. Please try again.")}catch(fe){console.error("Error deleting message:",fe),new rc.Notice("Failed to delete message. Please try again.")}},[u,i]),Ie=(0,Qt.useCallback)(async()=>{Me("new-chat"),a.autosaveChat&&await pe(),i.clearMessages(),G.setCurrentAiMessage(""),P([]),Ltt(),z==="project"?I(!1):I(a.includeActiveNoteAsContext)},[Me,i,a.autosaveChat,a.includeActiveNoteAsContext,z,pe,G]),Ge=(0,Qt.useCallback)(()=>{o.loadCopilotChatHistory()},[o]);(0,Qt.useEffect)(()=>{let le=oe=>{let fe=oe.detail?.reason||"new-chat";Me(fe)};return s?.addEventListener(Qg.ABORT_STREAM,le),()=>{s?.removeEventListener(Qg.ABORT_STREAM,le)}},[s,Me]),(0,Qt.useEffect)(()=>{a.includeActiveNoteAsContext!==void 0&&(z==="project"?I(!1):I(a.includeActiveNoteAsContext))},[a.includeActiveNoteAsContext,z]);let Ne=()=>Qt.default.createElement(Qt.default.Fragment,null,Qt.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},Qt.default.createElement(cfr,{currentVersion:o.manifest.version}),Qt.default.createElement(lfr,{chatHistory:u,currentAiMessage:f,loading:_,loadingMessage:S,app:be,onRegenerate:Ue,onEdit:Et,onDelete:Tr,onInsertToChat:On,onReplaceChat:h,showHelperComponents:z!=="project"}),Q()?Qt.default.createElement("div",{className:"tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-rounded-xl"},Qt.default.createElement(_Ke,{plugin:o,setHiddenCard:()=>{H(!1)}})):Qt.default.createElement(Qt.default.Fragment,null,Qt.default.createElement(Vlr,{onNewChat:Ie,onSaveAsNote:()=>pe(),onLoadHistory:Ge,onModeChange:le=>{U(z),le==="project"&&k(!1)}}),Qt.default.createElement(zcr,{ref:J,inputMessage:m,setInputMessage:h,handleSendMessage:ce,isGenerating:_,onStopGenerating:()=>Me("user-stopped"),app:be,contextNotes:E,setContextNotes:P,includeActiveNote:T,setIncludeActiveNote:I,mention:W,selectedImages:N,onAddImage:le=>M(oe=>[...oe,...le]),setSelectedImages:M,disableModelSwitch:z==="project",selectedTextContexts:X,onRemoveSelectedText:Br,showProgressCard:()=>{H(!0)}}))));return Qt.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},Qt.default.createElement("div",{className:"tw-h-full"},Qt.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},z==="project"&&Qt.default.createElement("div",{className:`${z==="project"?"tw-z-modal":""}`},Qt.default.createElement(dKe,{projects:a.projectList||[],defaultOpen:!0,app:be,hasMessages:!1,onProjectAdded:pr,onEditProject:$r,inputRef:J,onClose:()=>{ee?(V(ee),U(null)):V(q?"copilot_plus":"llm_chain")},showChatUI:le=>k(le),onProjectClose:()=>{H(null)}})),(z!=="project"||z==="project"&&D)&&Ne())))},jhr=iKn;er();var Dhr=require("obsidian"),kN=j(Z()),Lhr=j(Bc()),$N=class extends Dhr.ItemView{constructor(r,n){super(r);this.plugin=n;this.root=null;this.handleSaveAsNote=null;this.app=n.app,this.fileParserManager=n.fileParserManager,this.eventTarget=new EventTarget,this.plugin=n}get chainManager(){return this.plugin.projectManager.getCurrentChainManager()}getViewType(){return js}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){this.root=(0,Lhr.createRoot)(this.containerEl.children[1]);let r=o=>{this.handleSaveAsNote=o},n=o=>{this.plugin.updateUserMessageHistory(o)};this.renderView(r,n)}renderView(r,n){this.root&&this.root.render(kN.createElement(B_e.Provider,{value:this.app},kN.createElement(OV.Provider,{value:this.eventTarget},kN.createElement(kN.StrictMode,null,kN.createElement(x_e,{delayDuration:0},kN.createElement(jhr,{chainManager:this.chainManager,updateUserMessageHistory:n,fileParserManager:this.fileParserManager,plugin:this.plugin,onSaveChat:r,chatUIState:this.plugin.chatUIState}))))))}async saveChat(){this.handleSaveAsNote&&await this.handleSaveAsNote()}updateView(){let r=o=>{this.handleSaveAsNote=o},n=o=>{this.plugin.updateUserMessageHistory(o)};this.renderView(r,n)}async onClose(){this.root&&(this.root.unmount(),this.root=null)}};SVe();kt();var Fhr=require("obsidian"),Ave=class extends Fhr.FuzzySuggestModal{constructor(r,n,o){super(r);this.chatFiles=n;this.onChooseFile=o}getItems(){return this.chatFiles.sort((r,n)=>{let o=s=>{let u=this.app.metadataCache.getFileCache(s)?.frontmatter;return u&&u.epoch?u.epoch:s.stat.ctime},i=o(r);return o(n)-i})}getItemText(r){let n=this.app.metadataCache.getFileCache(r)?.frontmatter,o;n?.topic&&typeof n.topic=="string"&&n.topic.trim()?o=n.topic.trim():o=r.basename.replace(/^[a-zA-Z0-9-]+__/,"").replace(/\{\$date}|\d{8}/g,"").replace(/\{\$time}|\d{6}/g,"").replace(/[@_]/g," ").replace(/\s+/g," ").trim();let i;return n&&n.epoch?i=nu(new Date(n.epoch)):i=nu(new Date(r.stat.ctime)),`${o} - ${i.display}`}onChooseItem(r,n){this.onChooseFile(r)}};er();function khr(t){t.addItem(e=>{e.setTitle("Copilot"),e.setSubmenu();let r=e.submenu;if(!r)return;r.addItem(i=>{i.setTitle("Add selection to chat context").onClick(()=>{app.commands.executeCommandById(`copilot:${zr.ADD_SELECTION_TO_CHAT_CONTEXT}`)})}),r.addItem(i=>{i.setTitle("Trigger quick command").onClick(()=>{app.commands.executeCommandById(`copilot:${zr.TRIGGER_QUICK_COMMAND}`)})});let o=cp().filter(i=>i.showInContextMenu);o.length>0&&r.addSeparator(),oY(o).forEach(i=>{r.addItem(a=>{a.setTitle(i.title).onClick(()=>{app.commands.executeCommandById(`copilot:${eV(i.title)}`)})})})})}var $hr=j(Aze());$t();var Ive=class{constructor(e,r){this.handleFileModify=(0,$hr.default)(async e=>{if(!rV(e)||tY(e.path))return;let r=await nY(e);this.registerCommand(r),m$(r,r.title)},1e3,{leading:!1,trailing:!0});this.handleFileCreation=async e=>{if(!(!rV(e)||tY(e.path)))try{let r=await nY(e);if(!Nir(e)){let n=jbe();r={...r,order:n}}await $8e(e,r),m$(r,r.title),this.registerCommand(r)}catch(r){ie(`Error processing custom command creation: ${e.path}`,r)}};this.handleFileDeletion=async e=>{if(!rV(e)||tY(e.path))return;let r=eV(e.basename);this.plugin.removeCommand(r),rY(e.basename)};this.handleFileRename=async(e,r)=>{if(tY(e.path))return;let n=r.split("/").pop()?.replace(/\.md$/,"");if(n){let o=eV(n);this.plugin.removeCommand(o),rY(n)}if(rV(e)){let o=await nY(e);this.registerCommand(o),m$(o,o.title),await $8e(e,o)}};this.plugin=e,this.vault=r,this.initializeEventListeners()}async initialize(){await Rbe(),this.registerCommands()}async registerCommands(){cp().forEach(r=>{this.registerCommand(r)})}cleanup(){this.vault.off("create",this.handleFileCreation),this.vault.off("delete",this.handleFileDeletion),this.vault.off("rename",this.handleFileRename),this.vault.off("modify",this.handleFileModify)}initializeEventListeners(){this.vault.on("create",this.handleFileCreation),this.vault.on("delete",this.handleFileDeletion),this.vault.on("rename",this.handleFileRename),this.vault.on("modify",this.handleFileModify)}registerCommand(e){let r=eV(e.title);this.plugin.removeCommand(r),this.plugin.addCommand({id:r,name:e.title,editorCallback:n=>{new eN(this.plugin.app,{selectedText:n.getSelection(),command:e}).open(),Ac.getInstance().recordUsage(e)}})}};_t();kt();async function aKn(t){let r=`${X1()}/unsupported`;return await Mm(r),Promise.all(t.map(async n=>{let o=`${r}/${n.title}.md`,i=await app.vault.create(o,n.content);await app.fileManager.processFrontMatter(i,a=>{a[sA]=n.showInContextMenu,a[uA]=n.showInSlashMenu,a[VO]=n.order,a[lA]=n.modelKey,a[cA]=0})}))}async function Bhr(){let t=ne().inlineEditCommands;if(!t||t.length===0)return;let e=[],r=[],n=cp(),o=t.map((a,s)=>({title:a.name,content:a.prompt,showInContextMenu:a.showInContextMenu,showInSlashMenu:!1,order:s*10,modelKey:a.modelKey??"",lastUsedMs:0}));for(let a of o){let s=Mbe(a.title,n);s?r.push({...a,title:encodeURIComponent(a.title),content:`> ${s}
Original name: ${a.title}
${a.content}`}):e.push(a)}await Ac.getInstance().updateCommands([...n.map(a=>({...a,showInSlashMenu:!0})),...e]);let i=`We have upgraded your commands to the new format. They are now also stored as notes in ${X1()}.`;r.length>0&&(await aKn(r),i+=`
We found ${r.length} unsupported commands. They are saved in ${X1()}/unsupported. To fix them, please resolve the errors and move the note file out of the unsupported folder.`),Xe("inlineEditCommands",[]),new Yl(app,()=>{},i,"\u{1F680} New Copilot Custom Commands","OK","").open()}async function wKe(){let t=cp(),e=Mir.filter(n=>!t.some(o=>o.title===n.title)),r=[...t,...e];Ac.getInstance().updateCommands(r)}async function zhr(){if(ne().suggestedDefaultCommands)return;cp().length===0&&(new Yl(app,()=>{wKe()},"Would you like to add Copilot recommended commands in your custom prompts folder? These commands will be available through the right-click context menu and slash commands in chat.","Welcome to Copilot","Confirm","Skip").open(),Xe("suggestedDefaultCommands",!0))}var os=j(Z()),tX=require("obsidian"),Uhr=j(Bc());Un();la();function sKn({plugin:t,onRemove:e}){let[r,n]=(0,os.useState)(""),[o,i]=(0,os.useState)(!0),[a,s]=(0,os.useState)(""),[u]=lI(),[l,c]=(0,os.useState)(u),d=(0,os.useRef)(null);(0,os.useEffect)(()=>{let h=t.app.workspace.getActiveViewOfType(tX.MarkdownView);if(h&&h.editor){let y=h.editor.getSelection();s(y)}},[t.app]),(0,os.useEffect)(()=>{d.current&&d.current.focus()},[]);let f=async()=>{if(!r.trim()){new tX.Notice("Please enter a prompt");return}let h=`
You are an AI assistant designed to execute user instructions with precision. Your responses should be:
- Direct and focused: Address only what is explicitly requested
- Concise: Avoid unnecessary elaboration unless the user asks for details
- Context-aware: When text is selected or highlighted, treat it as the primary target for any requested action
- Action-oriented: Prioritize completing the task over explaining the process
Key principles:
- Follow instructions literally and completely
- Assume selected/highlighted text is the focus unless told otherwise
- Use all provided context: Consider any additional information, examples, or constraints the user provides to better complete the task
- Add explanations only when explicitly requested or when clarification is essential
- Maintain the user's preferred format and style
Response format: Match the format implied by the user's request (e.g., if they ask for a list, provide a list; if they ask for a rewrite, provide only the rewritten text).
`,y=r;if(o){let w=y.includes("{}"),S=/\{activenote\}/i.test(y),C=[];w||C.push("{}"),S||C.push("{activeNote}"),C.length>0&&(y+=`
${C.join(`
`)}`)}let g={title:"Quick Command",content:y,showInContextMenu:!1,showInSlashMenu:!1,order:0,modelKey:l,lastUsedMs:Date.now()};new eN(t.app,{selectedText:a,command:g,systemPrompt:h}).open(),e()},p=()=>{e()};return os.default.createElement("div",{className:"tw-rounded-lg tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-4",onKeyDown:h=>{h.key==="Escape"?(h.preventDefault(),p()):h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),f())}},os.default.createElement("div",{className:"tw-space-y-4"},os.default.createElement(ev,{ref:d,value:r,onChange:h=>n(h.target.value),placeholder:"Ask me anything...",className:"tw-min-h-24 tw-resize-none",rows:3}),os.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-4"},os.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},os.default.createElement(P_e,{size:"sm",variant:"ghost",value:l,onChange:c}),os.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},os.default.createElement(hu,{id:"includeActiveNote",checked:o,onCheckedChange:h=>i(!!h)}),os.default.createElement("label",{htmlFor:"includeActiveNote",className:"tw-cursor-pointer tw-text-sm tw-text-muted"},"Include note context"))),os.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},os.default.createElement(me,{variant:"secondary",onClick:p,size:"sm"},"Cancel"),os.default.createElement(me,{onClick:f,size:"sm"},"Submit")))))}function qhr({plugin:t,element:e}){let r=document.createElement("div");e.appendChild(r);let n=(0,Uhr.createRoot)(r),o=()=>{let i=t.app.workspace.getActiveViewOfType(tX.MarkdownView);i&&i.editor&&Dbe(i.editor),n.unmount(),r.remove()};return n.render(os.default.createElement(sKn,{plugin:t,onRemove:o})),{root:n,container:r}}er();_t();$t();la();xu();$t();Ude();kt();var Mve=class t{constructor(){this.contextProcessor=vV.getInstance(),this.mention=_R.getInstance()}static getInstance(){return t.instance||(t.instance=new t),t.instance}async processMessageContext(e,r,n,o,i,a){try{B(`[ContextManager] Processing context for message ${e.id}`);let s=e.originalMessage||e.message,{processedPrompt:u,includedFiles:l}=await k8e(s,"",n,a),c=o==="copilot_plus"?await this.mention.processUrls(s):{urlContext:"",imageUrls:[]},d=new Set(l.map(g=>g.path)),p=[...e.context?.notes||[]];i&&o!=="project"&&a&&!p.some(g=>g.path===a.path)&&p.push(a);let m=await this.contextProcessor.processContextNotes(d,r,n,p,i,a,o),h=this.contextProcessor.processSelectedTextContexts(),y=u+c.urlContext+m+h;return B(`[ContextManager] Successfully processed context for message ${e.id}`),y}catch(s){return B(`[ContextManager] Error processing context for message ${e.id}:`,s),e.originalMessage||e.message}}async reprocessMessageContext(e,r,n,o,i,a,s){let u=r.getMessage(e);if(!u||u.sender!=="user"||!u.id)return;B(`[ContextManager] Reprocessing context for message ${e}`);let l=await this.processMessageContext(u,n,o,i,a,s);r.updateProcessedText(u.id,l),B(`[ContextManager] Completed context reprocessing for message ${e}`)}createMessageContext(e,r,n=Kj()){return{notes:e,urls:r,selectedTextContexts:n}}async extractContextNotes(e,r,n=[]){return[...await Zg(e,r),...n].filter((s,u,l)=>l.findIndex(c=>c.path===s.path)===u)}needsContextReprocessing(e){return e.needsContextReprocessing===!0}getSelectedTextContexts(){return Kj()}};kt();$t();var GV=class{constructor(){this.messages=[]}generateId(){return`msg-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}addMessage(e,r,n,o,i){let a=this.generateId(),s=nu(new Date),u={id:a,displayText:e,processedText:r,sender:n,timestamp:s,context:o,isVisible:!0,isErrorMessage:!1,content:i};return this.messages.push(u),B(`[MessageRepository] Added message with ID: ${a}`),a}addDisplayOnlyMessage(e,r,n){if(n){let o=nu(new Date),i={id:n,displayText:e,processedText:e,sender:r,timestamp:o,isVisible:!0,isErrorMessage:!1};return this.messages.push(i),B(`[MessageRepository] Added display-only message with ID: ${n}`),n}return this.addMessage(e,e,r)}addFullMessage(e){let r=e.id||this.generateId(),n=e.timestamp||nu(new Date),o={id:r,displayText:e.message,processedText:e.originalMessage||e.message,sender:e.sender,timestamp:n,context:e.context,isVisible:e.isVisible!==!1,isErrorMessage:e.isErrorMessage,sources:e.sources,content:e.content};return this.messages.push(o),B(`[MessageRepository] Added full message with ID: ${r}`),r}editMessage(e,r){let n=this.messages.find(o=>o.id===e);return n?n.displayText===r?(B(`[MessageRepository] No changes needed for message: ${e}`),!0):(n.displayText=r,n.sender==="user"||n.sender==="USER"?B(`[MessageRepository] Edited user message ${e}, needs context reprocessing`):(n.processedText=r,B(`[MessageRepository] Edited AI message ${e}`)),!0):(B(`[MessageRepository] Message not found for edit: ${e}`),!1)}updateProcessedText(e,r){let n=this.messages.find(o=>o.id===e);return n?(n.processedText=r,B(`[MessageRepository] Updated processed text for message ${e}`),!0):(B(`[MessageRepository] Message not found for processed text update: ${e}`),!1)}deleteMessage(e){let r=this.messages.findIndex(n=>n.id===e);return r===-1?(B(`[MessageRepository] Message not found for deletion: ${e}`),!1):(this.messages.splice(r,1),B(`[MessageRepository] Deleted message ${e}`),!0)}clear(){this.messages=[],B("[MessageRepository] Cleared all messages")}truncateAfter(e){this.messages=this.messages.slice(0,e+1),B(`[MessageRepository] Truncated messages after index ${e}`)}truncateAfterMessageId(e){let r=this.messages.findIndex(n=>n.id===e);r!==-1&&(this.messages=this.messages.slice(0,r+1),B(`[MessageRepository] Truncated messages after message ${e}`))}getDisplayMessages(){return this.messages.filter(e=>e.isVisible).map(e=>({id:e.id,message:e.displayText,originalMessage:e.displayText,sender:e.sender,timestamp:e.timestamp,isVisible:!0,context:e.context,isErrorMessage:e.isErrorMessage,sources:e.sources,content:e.content}))}getLLMMessage(e){let r=this.messages.find(n=>n.id===e);if(r)return{id:r.id,message:r.processedText,originalMessage:r.displayText,sender:r.sender,timestamp:r.timestamp,isVisible:!1,context:r.context,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content}}getLLMMessages(){return this.messages.map(e=>({id:e.id,message:e.processedText,originalMessage:e.displayText,sender:e.sender,timestamp:e.timestamp,isVisible:!1,context:e.context,isErrorMessage:e.isErrorMessage,sources:e.sources,content:e.content}))}getMessage(e){let r=this.messages.find(n=>n.id===e);if(r)return{id:r.id,message:r.displayText,originalMessage:r.displayText,sender:r.sender,timestamp:r.timestamp,isVisible:r.isVisible,context:r.context,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content}}loadMessages(e){this.clear(),e.forEach(r=>{this.messages.push({id:r.id||this.generateId(),displayText:r.message,processedText:r.originalMessage||r.message,sender:r.sender,timestamp:r.timestamp||nu(new Date),context:r.context,isVisible:r.isVisible!==!1,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content})}),B(`[MessageRepository] Loaded ${e.length} messages`)}getDebugInfo(){return{totalMessages:this.messages.length,visibleMessages:this.messages.filter(e=>e.isVisible).length,userMessages:this.messages.filter(e=>e.sender==="user"||e.sender==="USER").length,aiMessages:this.messages.filter(e=>e.sender==="AI"||e.sender==="assistant").length}}};var K$=require("obsidian");$t();kt();er();_t();la();kt();var rX=class{constructor(e,r,n){this.app=e;this.messageRepo=r;this.chainManager=n}async saveChat(e){try{let r=this.messageRepo.getDisplayMessages();if(r.length===0){new K$.Notice("No messages to save.");return}let n=ne(),o=this.formatChatContent(r),i=r[0].timestamp?.epoch||Date.now();await Mm(n.defaultSaveFolder);let a=await this.findFileByEpoch(i),s;a?s=this.app.metadataCache.getFileCache(a)?.frontmatter?.topic:n.generateAIChatTitleOnSave?s=await this.generateAITopic(r):s=void 0;let u=this.generateFileName(r,i,s),l=this.generateNoteContent(o,i,e,s);a?(await this.app.vault.modify(a,l),B(`[ChatPersistenceManager] Updated existing chat file: ${a.path}`)):(await this.app.vault.create(u,l),new K$.Notice(`Chat saved as note: ${u}`),B(`[ChatPersistenceManager] Created new chat file: ${u}`))}catch(r){ie("[ChatPersistenceManager] Error saving chat:",r),new K$.Notice("Failed to save chat as note. Check console for details.")}}async loadChat(e){try{let r=await this.app.vault.read(e),n=this.parseChatContent(r);return B(`[ChatPersistenceManager] Loaded ${n.length} messages from ${e.path}`),n}catch(r){return ie("[ChatPersistenceManager] Error loading chat:",r),new K$.Notice("Failed to load chat history. Check console for details."),[]}}async getChatHistoryFiles(){let e=ne(),r=this.app.vault.getAbstractFileByPath(e.defaultSaveFolder);if(!(r instanceof K$.TFolder))return[];let o=this.app.vault.getMarkdownFiles().filter(a=>a.path.startsWith(r.path)),i=Su();return o.filter(a=>i?a.basename.startsWith(`${i.id}__`):!a.basename.includes("__")||!a.basename.split("__")[0])}formatChatContent(e){return e.map(r=>{let n=r.timestamp?r.timestamp.display:"Unknown time";return`**${r.sender}**: ${r.message}
[Timestamp: ${n}]`}).join(`
`)}parseChatContent(e){let r=[],n=e.match(/^---\n([\s\S]*?)\n---/),o=e;n&&(o=e.slice(n[0].length).trim());let i=/\*\*(user|ai)\*\*: ([\s\S]*?)(?=(?:\n\*\*(?:user|ai)\*\*: )|$)/g,a;for(;(a=i.exec(o))!==null;){let s=a[1]==="user"?So:Yg,u=a[2].trim(),l=u.split(`
`),c=u,d="Unknown time",f=l.length-1;if(f>0&&l[f].startsWith("[Timestamp: ")){let m=l[f].match(/\[Timestamp: (.*?)\]/);m&&(d=m[1],c=l.slice(0,f).join(`
`).trim())}let p;if(d!=="Unknown time"){let m=new Date(d);isNaN(m.getTime())||(p=m.getTime())}r.push({message:c,sender:s,isVisible:!0,timestamp:p?{epoch:p,display:d,fileName:""}:null})}return r}async findFileByEpoch(e){let r=await this.getChatHistoryFiles();for(let n of r)if(this.app.metadataCache.getFileCache(n)?.frontmatter?.epoch===e)return n;return null}async generateAITopic(e){if(this.chainManager)try{let r=this.chainManager.chatModelManager.getChatModel();if(!r)return;let n=6,o=200,a=`Generate a concise title (max 5 words) for this conversation based on its content. Return only the title without any explanation or quotes.
Conversation:
${e.reduce((l,c,d)=>d>=n?l:l+(l?`
`:"")+`${c.sender}: ${c.message.slice(0,o)}`,"")}`;return(await r.invoke(a)).content.toString().trim().replace(/^["']|["']$/g,"").replace(/[\\/:*?"<>|]/g,"").slice(0,50)||void 0}catch(r){ie("[ChatPersistenceManager] Error generating AI topic:",r);return}}generateFileName(e,r,n){let o=ne(),a=nu(new Date(r)).fileName,s;if(n)s=n;else{let f=e.find(p=>p.sender===So);s=f?f.message.split(/\s+/).slice(0,10).join(" ").replace(/[\\/:*?"<>|]/g,"").trim():"Untitled Chat"}let u=o.defaultConversationNoteName||"{$date}_{$time}__{$topic}";u=u.replace("{$topic}",s.slice(0,100).replace(/\s+/g,"_")).replace("{$date}",a.split("_")[0]).replace("{$time}",a.split("_")[1]);let l=u.replace(/[\\/:*?"<>|]/g,"_"),c=Su(),d=c?`${c.id}__`:"";return`${o.defaultSaveFolder}/${d}${l}.md`}generateNoteContent(e,r,n,o){let i=ne(),a=Su();return`---
epoch: ${r}
modelKey: ${n}
${o?`topic: "${o}"`:""}
${a?`projectId: ${a.id}`:""}
${a?`projectName: ${a.name}`:""}
tags:
- ${i.defaultConversationTag}
---
${e}`}};er();var Rve=class{constructor(e,r,n,o){this.messageRepo=e;this.chainManager=r;this.fileParserManager=n;this.plugin=o;this.projectMessageRepos=new Map;this.defaultProjectKey="defaultProjectKey";this.lastKnownProjectId=null;this.contextManager=Mve.getInstance(),this.projectMessageRepos.set(this.defaultProjectKey,e),this.persistenceManager=new rX(o.app,e,r)}getCurrentMessageRepo(){let e=this.plugin.projectManager.getCurrentProjectId(),r=e??this.defaultProjectKey;if(this.lastKnownProjectId!==e&&(B(`[ChatManager] Project changed from ${this.lastKnownProjectId} to ${e}`),this.lastKnownProjectId=e),!this.projectMessageRepos.has(r)){B(`[ChatManager] Creating new message repository for project: ${r}`);let o=new GV;this.projectMessageRepos.set(r,o)}let n=this.projectMessageRepos.get(r);return this.persistenceManager=new rX(this.plugin.app,n,this.chainManager),n}setOnMessageCreatedCallback(e){this.onMessageCreatedCallback=e}async sendMessage(e,r,n,o=!1,i){try{B(`[ChatManager] Sending message: "${e}"`);let a=this.plugin.app.workspace.getActiveFile(),s={...r};if(o&&a){let f=r.notes||[],p=f.some(m=>m.path===a.path);s.notes=p?f:[...f,a]}let u=this.getCurrentMessageRepo(),l=u.addMessage(e,e,So,s,i);this.onMessageCreatedCallback&&this.onMessageCreatedCallback(l);let c=u.getMessage(l);if(!c)throw new Error(`Failed to retrieve message ${l}`);let d=await this.contextManager.processMessageContext(c,this.fileParserManager,this.plugin.app.vault,n,o,a);return u.updateProcessedText(l,d),B(`[ChatManager] Successfully sent message ${l}`),l}catch(a){throw B("[ChatManager] Error sending message:",a),a}}async editMessage(e,r,n,o=!1){try{B(`[ChatManager] Editing message ${e}: "${r}"`);let i=this.getCurrentMessageRepo();if(!i.editMessage(e,r))return!1;let s=this.plugin.app.workspace.getActiveFile();return await this.contextManager.reprocessMessageContext(e,i,this.fileParserManager,this.plugin.app.vault,n,o,s),await this.updateChainMemory(),B(`[ChatManager] Successfully edited message ${e}`),!0}catch(i){return B(`[ChatManager] Error editing message ${e}:`,i),!1}}async regenerateMessage(e,r,n,o){try{B(`[ChatManager] Regenerating message ${e}`);let i=this.getCurrentMessageRepo();if(!i.getMessage(e))return B(`[ChatManager] Message not found: ${e}`),!1;let s=i.getDisplayMessages(),u=s.findIndex(f=>f.id===e);if(u<=0)return B("[ChatManager] Cannot regenerate first message or no user message found"),!1;let l=s[u-1];if(l.sender!==So)return B("[ChatManager] Previous message is not from user"),!1;if(i.truncateAfter(u-1),o&&o(),await this.updateChainMemory(),!l.id)return B("[ChatManager] User message has no ID for regeneration"),!1;let c=i.getLLMMessage(l.id);if(!c)return B("[ChatManager] LLM message not found for regeneration"),!1;let d=new AbortController;return await this.chainManager.runChain(c,d,r,n,{debug:ne().debug}),B(`[ChatManager] Successfully regenerated message ${e}`),!0}catch(i){return B(`[ChatManager] Error regenerating message ${e}:`,i),!1}}async deleteMessage(e){try{return B(`[ChatManager] Deleting message ${e}`),this.getCurrentMessageRepo().deleteMessage(e)?(await this.updateChainMemory(),B(`[ChatManager] Successfully deleted message ${e}`),!0):!1}catch(r){return B(`[ChatManager] Error deleting message ${e}:`,r),!1}}addDisplayMessage(e,r,n){return this.getCurrentMessageRepo().addDisplayOnlyMessage(e,r,n)}addFullMessage(e){return this.getCurrentMessageRepo().addFullMessage(e)}clearMessages(){this.getCurrentMessageRepo().clear(),this.chainManager.memoryManager.clearChatMemory(),B("[ChatManager] Cleared all messages")}async truncateAfterMessageId(e){this.getCurrentMessageRepo().truncateAfterMessageId(e),await this.updateChainMemory(),B(`[ChatManager] Truncated messages after ${e}`)}getDisplayMessages(){return this.getCurrentMessageRepo().getDisplayMessages()}getLLMMessages(){return this.getCurrentMessageRepo().getLLMMessages()}getMessage(e){return this.getCurrentMessageRepo().getMessage(e)}getLLMMessage(e){return this.getCurrentMessageRepo().getLLMMessage(e)}async updateChainMemory(){try{let r=this.getCurrentMessageRepo().getLLMMessages();await oir(r,this.chainManager.memoryManager),B(`[ChatManager] Updated chain memory with ${r.length} messages`)}catch(e){B("[ChatManager] Error updating chain memory:",e)}}async loadMessages(e){let r=this.getCurrentMessageRepo();r.clear(),e.forEach(n=>{r.addFullMessage(n)}),await this.updateChainMemory(),B(`[ChatManager] Loaded ${e.length} messages`)}async saveChat(e){await this.persistenceManager.saveChat(e)}getDebugInfo(){return{...this.getCurrentMessageRepo().getDebugInfo(),currentProject:this.plugin.projectManager.getCurrentProjectId(),totalProjects:this.projectMessageRepos.size}}async handleProjectSwitch(){let e=this.plugin.projectManager.getCurrentProjectId();B(`[ChatManager] Handling project switch to: ${e}`),this.lastKnownProjectId=null;let r=this.getCurrentMessageRepo();await this.updateChainMemory(),B(`[ChatManager] Project switch complete. Messages: ${r.getDisplayMessages().length}`)}};qj();$t();ez();fy();Sc();er();_t();var xX=require("obsidian"),QKe=j(Z()),Gyr=j(Bc());var Nve=class extends Yl{constructor(e,r){super(e,r,"Resetting settings will clear all settings and restore the default values. You will lose any custom settings you have made including the API keys. Are you sure you want to continue?","Reset Settings")}};Un();var nX=j(Z());dn();var Hhr=({tab:t,isSelected:e,onClick:r,isFirst:n,isLast:o})=>nX.default.createElement("div",{role:"tab",id:`tab-${t.id}`,"aria-controls":`tabpanel-${t.id}`,"aria-selected":e,onClick:r,className:he("tw-flex tw-flex-row tw-items-center","tw-h-8","tw-px-2 tw-py-1","tw-gap-1.5","tw-cursor-pointer","tw-overflow-hidden","tw-whitespace-nowrap","tw-text-sm","tw-border tw-border-solid tw-border-border","tw-rounded-b-[2px] tw-rounded-t-sm","tw-bg-primary","tw-transition-all tw-duration-300 tw-ease-in-out","hover:tw-border-interactive-accent",e&&["!tw-bg-interactive-accent","tw-text-on-accent","!tw-max-w-full","tw-transition-all tw-duration-300 tw-ease-in-out","tw-delay-100"],"lg:tw-max-w-32","md:tw-max-w-32")},nX.default.createElement("div",{className:he("tw-flex tw-items-center tw-justify-center","tw-size-4","tw-transition-transform tw-duration-200 tw-ease-in-out",e?"tw-max-w-[16px] tw-translate-x-0 tw-opacity-100":"tw-max-w-0 tw--translate-x-4 tw-opacity-0")},t.icon),nX.default.createElement("span",{className:he("tw-text-sm","tw-font-medium","tw-transition-all tw-duration-200 tw-ease-in-out","tw-overflow-hidden tw-whitespace-nowrap","tw-max-w-[100px] tw-translate-x-0 tw-opacity-100")},t.label)),Vhr=({id:t,children:e,isSelected:r})=>r?nX.default.createElement("div",{role:"tabpanel",id:`tabpanel-${t}`,"aria-labelledby":`tab-${t}`,className:he("tw-pt-4","tw-transition-all tw-duration-200 tw-ease-in-out",r?"tw-translate-y-0 tw-opacity-100":"tw-translate-y-2 tw-opacity-0")},e):null;var Rg=j(Z()),Whr=(0,Rg.createContext)(void 0),Khr=({children:t})=>{let[e,r]=(0,Rg.useState)("basic"),[n,o]=(0,Rg.useState)(null),i=(0,Rg.useRef)(!1);return(0,Rg.useEffect)(()=>{if(!i.current){let a=document.querySelector(".modal-container");o(a),i.current=!0}},[]),Rg.default.createElement(Whr.Provider,{value:{selectedTab:e,setSelectedTab:r,modalContainer:n}},t)},JV=()=>{let t=(0,Rg.useContext)(Whr);if(t===void 0)throw new Error("useTab must be used within a TabProvider");return t};_t();var Ze=j(Z());Un();var Li=j(Z());Un();dn();var yu=j(Z());var Re=j(Z()),eB=j(qa());var gu=j(Z());function Jhr(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,gu.useMemo)(()=>n=>{e.forEach(o=>o(n))},e)}var oX=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function G$(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function jve(t){return"nodeType"in t}function dm(t){var e,r;return t?G$(t)?t:jve(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function Dve(t){let{Document:e}=dm(t);return t instanceof e}function ZV(t){return G$(t)?!1:t instanceof dm(t).HTMLElement}function SKe(t){return t instanceof dm(t).SVGElement}function J$(t){return t?G$(t)?t.document:jve(t)?Dve(t)?t:ZV(t)||SKe(t)?t.ownerDocument:document:document:document}var Ob=oX?gu.useLayoutEffect:gu.useEffect;function Lve(t){let e=(0,gu.useRef)(t);return Ob(()=>{e.current=t}),(0,gu.useCallback)(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return e.current==null?void 0:e.current(...n)},[])}function Zhr(){let t=(0,gu.useRef)(null),e=(0,gu.useCallback)((n,o)=>{t.current=setInterval(n,o)},[]),r=(0,gu.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function YV(t,e){e===void 0&&(e=[t]);let r=(0,gu.useRef)(t);return Ob(()=>{r.current!==t&&(r.current=t)},e),r}function XV(t,e){let r=(0,gu.useRef)();return(0,gu.useMemo)(()=>{let n=t(r.current);return r.current=n,n},[...e])}function iX(t){let e=Lve(t),r=(0,gu.useRef)(null),n=(0,gu.useCallback)(o=>{o!==r.current&&e?.(o,r.current),r.current=o},[]);return[r,n]}function Fve(t){let e=(0,gu.useRef)();return(0,gu.useEffect)(()=>{e.current=t},[t]),e.current}var xKe={};function Z$(t,e){return(0,gu.useMemo)(()=>{if(e)return e;let r=xKe[t]==null?0:xKe[t]+1;return xKe[t]=r,t+"-"+r},[t,e])}function Yhr(t){return function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((i,a)=>{let s=Object.entries(a);for(let[u,l]of s){let c=i[u];c!=null&&(i[u]=c+t*l)}return i},{...e})}}var Y$=Yhr(1),X$=Yhr(-1);function uKn(t){return"clientX"in t&&"clientY"in t}function aX(t){if(!t)return!1;let{KeyboardEvent:e}=dm(t.target);return e&&t instanceof e}function lKn(t){if(!t)return!1;let{TouchEvent:e}=dm(t.target);return e&&t instanceof e}function kve(t){if(lKn(t)){if(t.touches&&t.touches.length){let{clientX:e,clientY:r}=t.touches[0];return{x:e,y:r}}else if(t.changedTouches&&t.changedTouches.length){let{clientX:e,clientY:r}=t.changedTouches[0];return{x:e,y:r}}}return uKn(t)?{x:t.clientX,y:t.clientY}:null}var Cb=Object.freeze({Translate:{toString(t){if(!t)return;let{x:e,y:r}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;let{scaleX:e,scaleY:r}=t;return"scaleX("+e+") scaleY("+r+")"}},Transform:{toString(t){if(t)return[Cb.Translate.toString(t),Cb.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),Ghr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Xhr(t){return t.matches(Ghr)?t:t.querySelector(Ghr)}var Q$=j(Z()),cKn={display:"none"};function Qhr(t){let{id:e,value:r}=t;return Q$.default.createElement("div",{id:e,style:cKn},r)}function egr(t){let{id:e,announcement:r,ariaLiveType:n="assertive"}=t,o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Q$.default.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function tgr(){let[t,e]=(0,Q$.useState)("");return{announce:(0,Q$.useCallback)(n=>{n!=null&&e(n)},[]),announcement:t}}var mgr=(0,Re.createContext)(null);function dKn(t){let e=(0,Re.useContext)(mgr);(0,Re.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function fKn(){let[t]=(0,Re.useState)(()=>new Set),e=(0,Re.useCallback)(n=>(t.add(n),()=>t.delete(n)),[t]);return[(0,Re.useCallback)(n=>{let{type:o,event:i}=n;t.forEach(a=>{var s;return(s=a[o])==null?void 0:s.call(a,i)})},[t]),e]}var pKn={draggable:`
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
`},mKn={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:r}=t;return r?"Draggable item "+e.id+" was moved over droppable area "+r.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:r}=t;return r?"Draggable item "+e.id+" was dropped over droppable area "+r.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function hKn(t){let{announcements:e=mKn,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=pKn}=t,{announce:i,announcement:a}=tgr(),s=Z$("DndLiveRegion"),[u,l]=(0,Re.useState)(!1);if((0,Re.useEffect)(()=>{l(!0)},[]),dKn((0,Re.useMemo)(()=>({onDragStart(d){let{active:f}=d;i(e.onDragStart({active:f}))},onDragMove(d){let{active:f,over:p}=d;e.onDragMove&&i(e.onDragMove({active:f,over:p}))},onDragOver(d){let{active:f,over:p}=d;i(e.onDragOver({active:f,over:p}))},onDragEnd(d){let{active:f,over:p}=d;i(e.onDragEnd({active:f,over:p}))},onDragCancel(d){let{active:f,over:p}=d;i(e.onDragCancel({active:f,over:p}))}}),[i,e])),!u)return null;let c=Re.default.createElement(Re.default.Fragment,null,Re.default.createElement(Qhr,{id:n,value:o.draggable}),Re.default.createElement(egr,{id:s,announcement:a}));return r?(0,eB.createPortal)(c,r):c}var Rc;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Rc||(Rc={}));function Bve(){}function QV(t,e){return(0,Re.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function Uve(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,Re.useMemo)(()=>[...e].filter(n=>n!=null),[...e])}var gv=Object.freeze({x:0,y:0});function hgr(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function ggr(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return r-n}function gKn(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return n-r}function rgr(t){let{left:e,top:r,height:n,width:o}=t;return[{x:e,y:r},{x:e+o,y:r},{x:e,y:r+n},{x:e+o,y:r+n}]}function RKe(t,e){if(!t||t.length===0)return null;let[r]=t;return e?r[e]:r}function ngr(t,e,r){return e===void 0&&(e=t.left),r===void 0&&(r=t.top),{x:e+t.width*.5,y:r+t.height*.5}}var e6=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=ngr(e,e.left,e.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=hgr(ngr(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(ggr)},ygr=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=rgr(e),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=rgr(u),c=o.reduce((f,p,m)=>f+hgr(l[m],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(ggr)};function yKn(t,e){let r=Math.max(e.top,t.top),n=Math.max(e.left,t.left),o=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),a=o-n,s=i-r;if(n<o&&r<i){let u=e.width*e.height,l=t.width*t.height,c=a*s,d=c/(u+l-c);return Number(d.toFixed(4))}return 0}var bKn=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=[];for(let i of n){let{id:a}=i,s=r.get(a);if(s){let u=yKn(s,e);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(gKn)};function _Kn(t,e,r){return{...t,scaleX:e&&r?e.width/r.width:1,scaleY:e&&r?e.height/r.height:1}}function bgr(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:gv}function vKn(t){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return o.reduce((a,s)=>({...a,top:a.top+t*s.y,bottom:a.bottom+t*s.y,left:a.left+t*s.x,right:a.right+t*s.x}),{...r})}}var wKn=vKn(1);function xKn(t){if(t.startsWith("matrix3d(")){let e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){let e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function SKn(t,e,r){let n=xKn(e);if(!n)return t;let{scaleX:o,scaleY:i,x:a,y:s}=n,u=t.left-a-(1-o)*parseFloat(r),l=t.top-s-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),c=o?t.width/o:t.width,d=i?t.height/i:t.height;return{width:c,height:d,top:l,right:u+c,bottom:l+d,left:u}}var CKn={ignoreTransform:!1};function nB(t,e){e===void 0&&(e=CKn);let r=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:l,transformOrigin:c}=dm(t).getComputedStyle(t);l&&(r=SKn(r,l,c))}let{top:n,left:o,width:i,height:a,bottom:s,right:u}=r;return{top:n,left:o,width:i,height:a,bottom:s,right:u}}function ogr(t){return nB(t,{ignoreTransform:!0})}function OKn(t){let e=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}function EKn(t,e){return e===void 0&&(e=dm(t).getComputedStyle(t)),e.position==="fixed"}function PKn(t,e){e===void 0&&(e=dm(t).getComputedStyle(t));let r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{let i=e[o];return typeof i=="string"?r.test(i):!1})}function dX(t,e){let r=[];function n(o){if(e!=null&&r.length>=e||!o)return r;if(Dve(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!ZV(o)||SKe(o)||r.includes(o))return r;let i=dm(t).getComputedStyle(o);return o!==t&&PKn(o,i)&&r.push(o),EKn(o,i)?r:n(o.parentNode)}return t?n(t):r}function _gr(t){let[e]=dX(t,1);return e??null}function CKe(t){return!oX||!t?null:G$(t)?t:jve(t)?Dve(t)||t===J$(t).scrollingElement?window:ZV(t)?t:null:null}function vgr(t){return G$(t)?t.scrollX:t.scrollLeft}function wgr(t){return G$(t)?t.scrollY:t.scrollTop}function PKe(t){return{x:vgr(t),y:wgr(t)}}var hd;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(hd||(hd={}));function xgr(t){return!oX||!t?!1:t===document.scrollingElement}function Sgr(t){let e={x:0,y:0},r=xgr(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},n={x:t.scrollWidth-r.width,y:t.scrollHeight-r.height},o=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,a=t.scrollTop>=n.y,s=t.scrollLeft>=n.x;return{isTop:o,isLeft:i,isBottom:a,isRight:s,maxScroll:n,minScroll:e}}var TKn={x:.2,y:.2};function AKn(t,e,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=TKn);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=Sgr(t),p={x:0,y:0},m={x:0,y:0},h={height:e.height*o.y,width:e.width*o.x};return!l&&i<=e.top+h.height?(p.y=hd.Backward,m.y=n*Math.abs((e.top+h.height-i)/h.height)):!c&&u>=e.bottom-h.height&&(p.y=hd.Forward,m.y=n*Math.abs((e.bottom-h.height-u)/h.height)),!f&&s>=e.right-h.width?(p.x=hd.Forward,m.x=n*Math.abs((e.right-h.width-s)/h.width)):!d&&a<=e.left+h.width&&(p.x=hd.Backward,m.x=n*Math.abs((e.left+h.width-a)/h.width)),{direction:p,speed:m}}function IKn(t){if(t===document.scrollingElement){let{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}let{top:e,left:r,right:n,bottom:o}=t.getBoundingClientRect();return{top:e,left:r,right:n,bottom:o,width:t.clientWidth,height:t.clientHeight}}function Cgr(t){return t.reduce((e,r)=>Y$(e,PKe(r)),gv)}function MKn(t){return t.reduce((e,r)=>e+vgr(r),0)}function RKn(t){return t.reduce((e,r)=>e+wgr(r),0)}function NKn(t,e){if(e===void 0&&(e=nB),!t)return;let{top:r,left:n,bottom:o,right:i}=e(t);_gr(t)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var jKn=[["x",["left","right"],MKn],["y",["top","bottom"],RKn]],uX=class{constructor(e,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=dX(r),o=Cgr(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[i,a,s]of jKn)for(let u of a)Object.defineProperty(this,u,{get:()=>{let l=s(n),c=o[i]-l;return this.rect[u]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},tB=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=e}add(e,r,n){var o;(o=this.target)==null||o.addEventListener(e,r,n),this.listeners.push([e,r,n])}};function DKn(t){let{EventTarget:e}=dm(t);return t instanceof e?t:J$(t)}function OKe(t,e){let r=Math.abs(t.x),n=Math.abs(t.y);return typeof e=="number"?Math.sqrt(r**2+n**2)>e:"x"in e&&"y"in e?r>e.x&&n>e.y:"x"in e?r>e.x:"y"in e?n>e.y:!1}var Eb;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Eb||(Eb={}));function igr(t){t.preventDefault()}function LKn(t){t.stopPropagation()}var uo;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(uo||(uo={}));var Ogr={start:[uo.Space,uo.Enter],cancel:[uo.Esc],end:[uo.Space,uo.Enter,uo.Tab]},FKn=(t,e)=>{let{currentCoordinates:r}=e;switch(t.code){case uo.Right:return{...r,x:r.x+25};case uo.Left:return{...r,x:r.x-25};case uo.Down:return{...r,y:r.y+25};case uo.Up:return{...r,y:r.y-25}}},zN=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:r}}=e;this.props=e,this.listeners=new tB(J$(r)),this.windowListeners=new tB(dm(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Eb.Resize,this.handleCancel),this.windowListeners.add(Eb.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Eb.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,n=e.node.current;n&&NKn(n),r(gv)}handleKeyDown(e){if(aX(e)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=Ogr,coordinateGetter:a=FKn,scrollBehavior:s="smooth"}=o,{code:u}=e;if(i.end.includes(u)){this.handleEnd(e);return}if(i.cancel.includes(u)){this.handleCancel(e);return}let{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:gv;this.referenceCoordinates||(this.referenceCoordinates=c);let d=a(e,{active:r,context:n.current,currentCoordinates:c});if(d){let f=X$(d,c),p={x:0,y:0},{scrollableAncestors:m}=n.current;for(let h of m){let y=e.code,{isTop:g,isRight:_,isLeft:w,isBottom:S,maxScroll:C,minScroll:E}=Sgr(h),P=IKn(h),T={x:Math.min(y===uo.Right?P.right-P.width/2:P.right,Math.max(y===uo.Right?P.left:P.left+P.width/2,d.x)),y:Math.min(y===uo.Down?P.bottom-P.height/2:P.bottom,Math.max(y===uo.Down?P.top:P.top+P.height/2,d.y))},I=y===uo.Right&&!_||y===uo.Left&&!w,N=y===uo.Down&&!S||y===uo.Up&&!g;if(I&&T.x!==d.x){let M=h.scrollLeft+f.x,D=y===uo.Right&&M<=C.x||y===uo.Left&&M>=E.x;if(D&&!f.y){h.scrollTo({left:M,behavior:s});return}D?p.x=h.scrollLeft-M:p.x=y===uo.Right?h.scrollLeft-C.x:h.scrollLeft-E.x,p.x&&h.scrollBy({left:-p.x,behavior:s});break}else if(N&&T.y!==d.y){let M=h.scrollTop+f.y,D=y===uo.Down&&M<=C.y||y===uo.Up&&M>=E.y;if(D&&!f.x){h.scrollTo({top:M,behavior:s});return}D?p.y=h.scrollTop-M:p.y=y===uo.Down?h.scrollTop-C.y:h.scrollTop-E.y,p.y&&h.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(e,Y$(X$(d,this.referenceCoordinates),p))}}}handleMove(e,r){let{onMove:n}=this.props;e.preventDefault(),n(r)}handleEnd(e){let{onEnd:r}=this.props;e.preventDefault(),this.detach(),r()}handleCancel(e){let{onCancel:r}=this.props;e.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};zN.activators=[{eventName:"onKeyDown",handler:(t,e,r)=>{let{keyboardCodes:n=Ogr,onActivation:o}=e,{active:i}=r,{code:a}=t.nativeEvent;if(n.start.includes(a)){let s=i.activatorNode.current;return s&&t.target!==s?!1:(t.preventDefault(),o?.({event:t.nativeEvent}),!0)}return!1}}];function agr(t){return!!(t&&"distance"in t)}function sgr(t){return!!(t&&"delay"in t)}var lX=class{constructor(e,r,n){var o;n===void 0&&(n=DKn(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=r;let{event:i}=e,{target:a}=i;this.props=e,this.events=r,this.document=J$(a),this.documentListeners=new tB(this.document),this.listeners=new tB(n),this.windowListeners=new tB(dm(a)),this.initialCoordinates=(o=kve(i))!=null?o:gv,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Eb.Resize,this.handleCancel),this.windowListeners.add(Eb.DragStart,igr),this.windowListeners.add(Eb.VisibilityChange,this.handleCancel),this.windowListeners.add(Eb.ContextMenu,igr),this.documentListeners.add(Eb.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(sgr(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(agr(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,r){let{active:n,onPending:o}=this.props;o(n,e,this.initialCoordinates,r)}handleStart(){let{initialCoordinates:e}=this,{onStart:r}=this.props;e&&(this.activated=!0,this.documentListeners.add(Eb.Click,LKn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Eb.SelectionChange,this.removeTextSelection),r(e))}handleMove(e){var r;let{activated:n,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:s}}=i;if(!o)return;let u=(r=kve(e))!=null?r:gv,l=X$(o,u);if(!n&&s){if(agr(s)){if(s.tolerance!=null&&OKe(l,s.tolerance))return this.handleCancel();if(OKe(l,s.distance))return this.handleStart()}if(sgr(s)&&OKe(l,s.tolerance))return this.handleCancel();this.handlePending(s,l);return}e.cancelable&&e.preventDefault(),a(u)}handleEnd(){let{onAbort:e,onEnd:r}=this.props;this.detach(),this.activated||e(this.props.active),r()}handleCancel(){let{onAbort:e,onCancel:r}=this.props;this.detach(),this.activated||e(this.props.active),r()}handleKeydown(e){e.code===uo.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},kKn={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},UN=class extends lX{constructor(e){let{event:r}=e,n=J$(r.target);super(e,kKn,n)}};UN.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return!r.isPrimary||r.button!==0?!1:(n?.({event:r}),!0)}}];var $Kn={move:{name:"mousemove"},end:{name:"mouseup"}},TKe;(function(t){t[t.RightClick=2]="RightClick"})(TKe||(TKe={}));var AKe=class extends lX{constructor(e){super(e,$Kn,J$(e.event.target))}};AKe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return r.button===TKe.RightClick?!1:(n?.({event:r}),!0)}}];var EKe={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},IKe=class extends lX{constructor(e){super(e,EKe)}static setup(){return window.addEventListener(EKe.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(EKe.move.name,e)};function e(){}}};IKe.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e,{touches:o}=r;return o.length>1?!1:(n?.({event:r}),!0)}}];var sX;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(sX||(sX={}));var zve;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(zve||(zve={}));function BKn(t){let{acceleration:e,activator:r=sX.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=zve.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=t,p=UKn({delta:d,disabled:!i}),[m,h]=Zhr(),y=(0,Re.useRef)({x:0,y:0}),g=(0,Re.useRef)({x:0,y:0}),_=(0,Re.useMemo)(()=>{switch(r){case sX.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case sX.DraggableRect:return o}},[r,o,u]),w=(0,Re.useRef)(null),S=(0,Re.useCallback)(()=>{let E=w.current;if(!E)return;let P=y.current.x*g.current.x,T=y.current.y*g.current.y;E.scrollBy(P,T)},[]),C=(0,Re.useMemo)(()=>s===zve.TreeOrder?[...l].reverse():l,[s,l]);(0,Re.useEffect)(()=>{if(!i||!l.length||!_){h();return}for(let E of C){if(n?.(E)===!1)continue;let P=l.indexOf(E),T=c[P];if(!T)continue;let{direction:I,speed:N}=AKn(E,T,_,e,f);for(let M of["x","y"])p[M][I[M]]||(N[M]=0,I[M]=0);if(N.x>0||N.y>0){h(),w.current=E,m(S,a),y.current=N,g.current=I;return}}y.current={x:0,y:0},g.current={x:0,y:0},h()},[e,S,n,h,i,a,JSON.stringify(_),JSON.stringify(p),m,l,C,c,JSON.stringify(f)])}var zKn={x:{[hd.Backward]:!1,[hd.Forward]:!1},y:{[hd.Backward]:!1,[hd.Forward]:!1}};function UKn(t){let{delta:e,disabled:r}=t,n=Fve(e);return XV(o=>{if(r||!n||!o)return zKn;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[hd.Backward]:o.x[hd.Backward]||i.x===-1,[hd.Forward]:o.x[hd.Forward]||i.x===1},y:{[hd.Backward]:o.y[hd.Backward]||i.y===-1,[hd.Forward]:o.y[hd.Forward]||i.y===1}}},[r,e,n])}function qKn(t,e){let r=e!=null?t.get(e):void 0,n=r?r.node.current:null;return XV(o=>{var i;return e==null?null:(i=n??o)!=null?i:null},[n,e])}function HKn(t,e){return(0,Re.useMemo)(()=>t.reduce((r,n)=>{let{sensor:o}=n,i=o.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,n)}));return[...r,...i]},[]),[t,e])}var cX;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(cX||(cX={}));var MKe;(function(t){t.Optimized="optimized"})(MKe||(MKe={}));var ugr=new Map;function VKn(t,e){let{dragging:r,dependencies:n,config:o}=e,[i,a]=(0,Re.useState)(null),{frequency:s,measure:u,strategy:l}=o,c=(0,Re.useRef)(t),d=y(),f=YV(d),p=(0,Re.useCallback)(function(g){g===void 0&&(g=[]),!f.current&&a(_=>_===null?g:_.concat(g.filter(w=>!_.includes(w))))},[f]),m=(0,Re.useRef)(null),h=XV(g=>{if(d&&!r)return ugr;if(!g||g===ugr||c.current!==t||i!=null){let _=new Map;for(let w of t){if(!w)continue;if(i&&i.length>0&&!i.includes(w.id)&&w.rect.current){_.set(w.id,w.rect.current);continue}let S=w.node.current,C=S?new uX(u(S),S):null;w.rect.current=C,C&&_.set(w.id,C)}return _}return g},[t,i,r,d,u]);return(0,Re.useEffect)(()=>{c.current=t},[t]),(0,Re.useEffect)(()=>{d||p()},[r,d]),(0,Re.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,Re.useEffect)(()=>{d||typeof s!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...n]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:i!=null};function y(){switch(l){case cX.Always:return!1;case cX.BeforeDragging:return r;default:return!r}}}function Egr(t,e){return XV(r=>t?r||(typeof e=="function"?e(t):t):null,[e,t])}function WKn(t,e){return Egr(t,e)}function KKn(t){let{callback:e,disabled:r}=t,n=Lve(e),o=(0,Re.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,r]);return(0,Re.useEffect)(()=>()=>o?.disconnect(),[o]),o}function qve(t){let{callback:e,disabled:r}=t,n=Lve(e),o=(0,Re.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[r]);return(0,Re.useEffect)(()=>()=>o?.disconnect(),[o]),o}function GKn(t){return new uX(nB(t),t)}function lgr(t,e,r){e===void 0&&(e=GKn);let[n,o]=(0,Re.useState)(null);function i(){o(u=>{if(!t)return null;if(t.isConnected===!1){var l;return(l=u??r)!=null?l:null}let c=e(t);return JSON.stringify(u)===JSON.stringify(c)?u:c})}let a=KKn({callback(u){if(t)for(let l of u){let{type:c,target:d}=l;if(c==="childList"&&d instanceof HTMLElement&&d.contains(t)){i();break}}}}),s=qve({callback:i});return Ob(()=>{i(),t?(s?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[t]),n}function JKn(t){let e=Egr(t);return bgr(t,e)}var cgr=[];function ZKn(t){let e=(0,Re.useRef)(t),r=XV(n=>t?n&&n!==cgr&&t&&e.current&&t.parentNode===e.current.parentNode?n:dX(t):cgr,[t]);return(0,Re.useEffect)(()=>{e.current=t},[t]),r}function YKn(t){let[e,r]=(0,Re.useState)(null),n=(0,Re.useRef)(t),o=(0,Re.useCallback)(i=>{let a=CKe(i.target);a&&r(s=>s?(s.set(a,PKe(a)),new Map(s)):null)},[]);return(0,Re.useEffect)(()=>{let i=n.current;if(t!==i){a(i);let s=t.map(u=>{let l=CKe(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,PKe(l)]):null}).filter(u=>u!=null);r(s.length?new Map(s):null),n.current=t}return()=>{a(t),a(i)};function a(s){s.forEach(u=>{let l=CKe(u);l?.removeEventListener("scroll",o)})}},[o,t]),(0,Re.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>Y$(i,a),gv):Cgr(t):gv,[t,e])}function dgr(t,e){e===void 0&&(e=[]);let r=(0,Re.useRef)(null);return(0,Re.useEffect)(()=>{r.current=null},e),(0,Re.useEffect)(()=>{let n=t!==gv;n&&!r.current&&(r.current=t),!n&&r.current&&(r.current=null)},[t]),r.current?X$(t,r.current):gv}function XKn(t){(0,Re.useEffect)(()=>{if(!oX)return;let e=t.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(let r of e)r?.()}},t.map(e=>{let{sensor:r}=e;return r}))}function QKn(t,e){return(0,Re.useMemo)(()=>t.reduce((r,n)=>{let{eventName:o,handler:i}=n;return r[o]=a=>{i(a,e)},r},{}),[t,e])}function Pgr(t){return(0,Re.useMemo)(()=>t?OKn(t):null,[t])}var fgr=[];function eGn(t,e){e===void 0&&(e=nB);let[r]=t,n=Pgr(r?dm(r):null),[o,i]=(0,Re.useState)(fgr);function a(){i(()=>t.length?t.map(u=>xgr(u)?n:new uX(e(u),u)):fgr)}let s=qve({callback:a});return Ob(()=>{s?.disconnect(),a(),t.forEach(u=>s?.observe(u))},[t]),o}function tGn(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return ZV(e)?e:t}function rGn(t){let{measure:e}=t,[r,n]=(0,Re.useState)(null),o=(0,Re.useCallback)(l=>{for(let{target:c}of l)if(ZV(c)){n(d=>{let f=e(c);return d?{...d,width:f.width,height:f.height}:f});break}},[e]),i=qve({callback:o}),a=(0,Re.useCallback)(l=>{let c=tGn(l);i?.disconnect(),c&&i?.observe(c),n(c?e(c):null)},[e,i]),[s,u]=iX(a);return(0,Re.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var nGn=[{sensor:UN,options:{}},{sensor:zN,options:{}}],oGn={current:{}},$ve={draggable:{measure:ogr},droppable:{measure:ogr,strategy:cX.WhileDragging,frequency:MKe.Optimized},dragOverlay:{measure:nB}},rB=class extends Map{get(e){var r;return e!=null&&(r=super.get(e))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:r}=e;return!r})}getNodeFor(e){var r,n;return(r=(n=this.get(e))==null?void 0:n.node.current)!=null?r:void 0}},iGn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new rB,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Bve},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:$ve,measureDroppableContainers:Bve,windowRect:null,measuringScheduled:!1},aGn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Bve,draggableNodes:new Map,over:null,measureDroppableContainers:Bve},Hve=(0,Re.createContext)(aGn),Tgr=(0,Re.createContext)(iGn);function sGn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new rB}}}function uGn(t,e){switch(e.type){case Rc.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Rc.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Rc.DragEnd:case Rc.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Rc.RegisterDroppable:{let{element:r}=e,{id:n}=r,o=new rB(t.droppable.containers);return o.set(n,r),{...t,droppable:{...t.droppable,containers:o}}}case Rc.SetDroppableDisabled:{let{id:r,key:n,disabled:o}=e,i=t.droppable.containers.get(r);if(!i||n!==i.key)return t;let a=new rB(t.droppable.containers);return a.set(r,{...i,disabled:o}),{...t,droppable:{...t.droppable,containers:a}}}case Rc.UnregisterDroppable:{let{id:r,key:n}=e,o=t.droppable.containers.get(r);if(!o||n!==o.key)return t;let i=new rB(t.droppable.containers);return i.delete(r),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function lGn(t){let{disabled:e}=t,{active:r,activatorEvent:n,draggableNodes:o}=(0,Re.useContext)(Hve),i=Fve(n),a=Fve(r?.id);return(0,Re.useEffect)(()=>{if(!e&&!n&&i&&a!=null){if(!aX(i)||document.activeElement===i.target)return;let s=o.get(a);if(!s)return;let{activatorNode:u,node:l}=s;if(!u.current&&!l.current)return;requestAnimationFrame(()=>{for(let c of[u.current,l.current]){if(!c)continue;let d=Xhr(c);if(d){d.focus();break}}})}},[n,e,o,a,i]),null}function cGn(t,e){let{transform:r,...n}=e;return t!=null&&t.length?t.reduce((o,i)=>i({transform:o,...n}),r):r}function dGn(t){return(0,Re.useMemo)(()=>({draggable:{...$ve.draggable,...t?.draggable},droppable:{...$ve.droppable,...t?.droppable},dragOverlay:{...$ve.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function fGn(t){let{activeNode:e,measure:r,initialRect:n,config:o=!0}=t,i=(0,Re.useRef)(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;Ob(()=>{if(!a&&!s||!e){i.current=!1;return}if(i.current||!n)return;let l=e?.node.current;if(!l||l.isConnected===!1)return;let c=r(l),d=bgr(c,n);if(a||(d.x=0),s||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){let f=_gr(l);f&&f.scrollBy({top:d.y,left:d.x})}},[e,a,s,n,r])}var Agr=(0,Re.createContext)({...gv,scaleX:1,scaleY:1}),BN;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(BN||(BN={}));var t6=(0,Re.memo)(function(e){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=nGn,collisionDetection:d=bKn,measuring:f,modifiers:p,...m}=e,h=(0,Re.useReducer)(uGn,void 0,sGn),[y,g]=h,[_,w]=fKn(),[S,C]=(0,Re.useState)(BN.Uninitialized),E=S===BN.Initialized,{draggable:{active:P,nodes:T,translate:I},droppable:{containers:N}}=y,M=P!=null?T.get(P):null,D=(0,Re.useRef)({initial:null,translated:null}),k=(0,Re.useMemo)(()=>{var Ms;return P!=null?{id:P,data:(Ms=M?.data)!=null?Ms:oGn,rect:D}:null},[P,M]),L=(0,Re.useRef)(null),[H,K]=(0,Re.useState)(null),[G,X]=(0,Re.useState)(null),F=YV(m,Object.values(m)),Q=Z$("DndDescribedBy",a),ee=(0,Re.useMemo)(()=>N.getEnabled(),[N]),U=dGn(f),{droppableRects:z,measureDroppableContainers:V,measuringScheduled:q}=VKn(ee,{dragging:E,dependencies:[I.x,I.y],config:U.droppable}),W=qKn(T,P),J=(0,Re.useMemo)(()=>G?kve(G):null,[G]),se=RA(),be=WKn(W,U.draggable.measure);fGn({activeNode:P!=null?T.get(P):null,config:se.layoutShiftCompensation,initialRect:be,measure:U.draggable.measure});let ce=lgr(W,U.draggable.measure,be),pe=lgr(W?W.parentElement:null),Me=(0,Re.useRef)({activatorEvent:null,active:null,activeNode:W,collisionRect:null,collisions:null,droppableRects:z,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ue=N.getNodeFor((r=Me.current.over)==null?void 0:r.id),Et=rGn({measure:U.dragOverlay.measure}),pr=(n=Et.nodeRef.current)!=null?n:W,$r=E?(o=Et.rect)!=null?o:ce:null,On=!!(Et.nodeRef.current&&Et.rect),Br=JKn(On?null:ce),Tr=Pgr(pr?dm(pr):null),Ie=ZKn(E?Ue??W:null),Ge=eGn(Ie),Ne=cGn(p,{transform:{x:I.x-Br.x,y:I.y-Br.y,scaleX:1,scaleY:1},activatorEvent:G,active:k,activeNodeRect:ce,containerNodeRect:pe,draggingNodeRect:$r,over:Me.current.over,overlayNodeRect:Et.rect,scrollableAncestors:Ie,scrollableAncestorRects:Ge,windowRect:Tr}),le=J?Y$(J,I):null,oe=YKn(Ie),fe=dgr(oe),_e=dgr(oe,[ce]),ge=Y$(Ne,fe),Le=$r?wKn($r,Ne):null,dr=k&&Le?d({active:k,collisionRect:Le,droppableRects:z,droppableContainers:ee,pointerCoordinates:le}):null,Ii=RKe(dr,"id"),[bi,_f]=(0,Re.useState)(null),yp=On?Ne:Y$(Ne,_e),Vi=_Kn(yp,(i=bi?.rect)!=null?i:null,ce),gd=(0,Re.useRef)(null),yd=(0,Re.useCallback)((Ms,bu)=>{let{sensor:is,options:bp}=bu;if(L.current==null)return;let wf=T.get(L.current);if(!wf)return;let Zs=Ms.nativeEvent,pm=new is({active:L.current,activeNode:wf,event:Zs,options:bp,context:Me,onAbort(Qn){if(!T.get(Qn))return;let{onDragAbort:vp}=F.current,Th={id:Qn};vp?.(Th),_({type:"onDragAbort",event:Th})},onPending(Qn,Ye,vp,Th){if(!T.get(Qn))return;let{onDragPending:oE}=F.current,Kn={id:Qn,constraint:Ye,initialCoordinates:vp,offset:Th};oE?.(Kn),_({type:"onDragPending",event:Kn})},onStart(Qn){let Ye=L.current;if(Ye==null)return;let vp=T.get(Ye);if(!vp)return;let{onDragStart:Th}=F.current,oc={activatorEvent:Zs,active:{id:Ye,data:vp.data,rect:D}};(0,eB.unstable_batchedUpdates)(()=>{Th?.(oc),C(BN.Initializing),g({type:Rc.DragStart,initialCoordinates:Qn,active:Ye}),_({type:"onDragStart",event:oc}),K(gd.current),X(Zs)})},onMove(Qn){g({type:Rc.DragMove,coordinates:Qn})},onEnd:_p(Rc.DragEnd),onCancel:_p(Rc.DragCancel)});gd.current=pm;function _p(Qn){return async function(){let{active:vp,collisions:Th,over:oc,scrollAdjustedTranslate:oE}=Me.current,Kn=null;if(vp&&oE){let{cancelDrop:Ab}=F.current;Kn={activatorEvent:Zs,active:vp,collisions:Th,delta:oE,over:oc},Qn===Rc.DragEnd&&typeof Ab=="function"&&await Promise.resolve(Ab(Kn))&&(Qn=Rc.DragCancel)}L.current=null,(0,eB.unstable_batchedUpdates)(()=>{g({type:Qn}),C(BN.Uninitialized),_f(null),K(null),X(null),gd.current=null;let Ab=Qn===Rc.DragEnd?"onDragEnd":"onDragCancel";if(Kn){let s6=F.current[Ab];s6?.(Kn),_({type:Ab,event:Kn})}})}}},[T]),vf=(0,Re.useCallback)((Ms,bu)=>(is,bp)=>{let wf=is.nativeEvent,Zs=T.get(bp);if(L.current!==null||!Zs||wf.dndKit||wf.defaultPrevented)return;let pm={active:Zs};Ms(is,bu.options,pm)===!0&&(wf.dndKit={capturedBy:bu.sensor},L.current=bp,yd(is,bu))},[T,yd]),Wn=HKn(c,vf);XKn(c),Ob(()=>{ce&&S===BN.Initializing&&C(BN.Initialized)},[ce,S]),(0,Re.useEffect)(()=>{let{onDragMove:Ms}=F.current,{active:bu,activatorEvent:is,collisions:bp,over:wf}=Me.current;if(!bu||!is)return;let Zs={active:bu,activatorEvent:is,collisions:bp,delta:{x:ge.x,y:ge.y},over:wf};(0,eB.unstable_batchedUpdates)(()=>{Ms?.(Zs),_({type:"onDragMove",event:Zs})})},[ge.x,ge.y]),(0,Re.useEffect)(()=>{let{active:Ms,activatorEvent:bu,collisions:is,droppableContainers:bp,scrollAdjustedTranslate:wf}=Me.current;if(!Ms||L.current==null||!bu||!wf)return;let{onDragOver:Zs}=F.current,pm=bp.get(Ii),_p=pm&&pm.rect.current?{id:pm.id,rect:pm.rect.current,data:pm.data,disabled:pm.disabled}:null,Qn={active:Ms,activatorEvent:bu,collisions:is,delta:{x:wf.x,y:wf.y},over:_p};(0,eB.unstable_batchedUpdates)(()=>{_f(_p),Zs?.(Qn),_({type:"onDragOver",event:Qn})})},[Ii]),Ob(()=>{Me.current={activatorEvent:G,active:k,activeNode:W,collisionRect:Le,collisions:dr,droppableRects:z,draggableNodes:T,draggingNode:pr,draggingNodeRect:$r,droppableContainers:N,over:bi,scrollableAncestors:Ie,scrollAdjustedTranslate:ge},D.current={initial:$r,translated:Le}},[k,W,dr,Le,T,pr,$r,z,N,bi,Ie,ge]),BKn({...se,delta:I,draggingRect:Le,pointerCoordinates:le,scrollableAncestors:Ie,scrollableAncestorRects:Ge});let MA=(0,Re.useMemo)(()=>({active:k,activeNode:W,activeNodeRect:ce,activatorEvent:G,collisions:dr,containerNodeRect:pe,dragOverlay:Et,draggableNodes:T,droppableContainers:N,droppableRects:z,over:bi,measureDroppableContainers:V,scrollableAncestors:Ie,scrollableAncestorRects:Ge,measuringConfiguration:U,measuringScheduled:q,windowRect:Tr}),[k,W,ce,G,dr,pe,Et,T,N,z,bi,V,Ie,Ge,U,q,Tr]),WN=(0,Re.useMemo)(()=>({activatorEvent:G,activators:Wn,active:k,activeNodeRect:ce,ariaDescribedById:{draggable:Q},dispatch:g,draggableNodes:T,over:bi,measureDroppableContainers:V}),[G,Wn,k,ce,g,Q,T,bi,V]);return Re.default.createElement(mgr.Provider,{value:w},Re.default.createElement(Hve.Provider,{value:WN},Re.default.createElement(Tgr.Provider,{value:MA},Re.default.createElement(Agr.Provider,{value:Vi},l)),Re.default.createElement(lGn,{disabled:s?.restoreFocus===!1})),Re.default.createElement(hKn,{...s,hiddenTextDescribedById:Q}));function RA(){let Ms=H?.autoScrollEnabled===!1,bu=typeof u=="object"?u.enabled===!1:u===!1,is=E&&!Ms&&!bu;return typeof u=="object"?{...u,enabled:is}:{enabled:is}}}),pGn=(0,Re.createContext)(null),pgr="button",mGn="Draggable";function Igr(t){let{id:e,data:r,disabled:n=!1,attributes:o}=t,i=Z$(mGn),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,Re.useContext)(Hve),{role:p=pgr,roleDescription:m="draggable",tabIndex:h=0}=o??{},y=u?.id===e,g=(0,Re.useContext)(y?Agr:pGn),[_,w]=iX(),[S,C]=iX(),E=QKn(a,e),P=YV(r);Ob(()=>(d.set(e,{id:e,key:i,node:_,activatorNode:S,data:P}),()=>{let I=d.get(e);I&&I.key===i&&d.delete(e)}),[d,e]);let T=(0,Re.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&p===pgr?!0:void 0,"aria-roledescription":m,"aria-describedby":c.draggable}),[n,p,h,y,m,c.draggable]);return{active:u,activatorEvent:s,activeNodeRect:l,attributes:T,isDragging:y,listeners:n?void 0:E,node:_,over:f,setNodeRef:w,setActivatorNodeRef:C,transform:g}}function Mgr(){return(0,Re.useContext)(Tgr)}var hGn="Droppable",gGn={timeout:25};function Rgr(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:o}=t,i=Z$(hGn),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,Re.useContext)(Hve),c=(0,Re.useRef)({disabled:r}),d=(0,Re.useRef)(!1),f=(0,Re.useRef)(null),p=(0,Re.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:y}={...gGn,...o},g=YV(h??n),_=(0,Re.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(g.current)?g.current:[g.current]),p.current=null},y)},[y]),w=qve({callback:_,disabled:m||!a}),S=(0,Re.useCallback)((T,I)=>{w&&(I&&(w.unobserve(I),d.current=!1),T&&w.observe(T))},[w]),[C,E]=iX(S),P=YV(e);return(0,Re.useEffect)(()=>{!w||!C.current||(w.disconnect(),d.current=!1,w.observe(C.current))},[C,w]),(0,Re.useEffect)(()=>(s({type:Rc.RegisterDroppable,element:{id:n,key:i,disabled:r,node:C,rect:f,data:P}}),()=>s({type:Rc.UnregisterDroppable,key:i,id:n})),[n]),(0,Re.useEffect)(()=>{r!==c.current.disabled&&(s({type:Rc.SetDroppableDisabled,id:n,key:i,disabled:r}),c.current.disabled=r)},[n,i,r,s]),{active:a,rect:f,isOver:u?.id===n,node:C,over:u,setNodeRef:E}}function Gve(t,e,r){let n=t.slice();return n.splice(r<0?n.length+r:r,0,n.splice(e,1)[0]),n}function yGn(t,e){return t.reduce((r,n,o)=>{let i=e.get(n);return i&&(r[o]=i),r},Array(t.length))}function Vve(t){return t!==null&&t>=0}function bGn(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function _Gn(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}var Ngr=t=>{let{rects:e,activeIndex:r,overIndex:n,index:o}=t,i=Gve(e,n,r),a=e[o],s=i[o];return!s||!a?null:{x:s.left-a.left,y:s.top-a.top,scaleX:s.width/a.width,scaleY:s.height/a.height}};var Wve={scaleX:1,scaleY:1},r6=t=>{var e;let{activeIndex:r,activeNodeRect:n,index:o,rects:i,overIndex:a}=t,s=(e=i[r])!=null?e:n;if(!s)return null;if(o===r){let l=i[a];return l?{x:0,y:r<a?l.top+l.height-(s.top+s.height):l.top-s.top,...Wve}:null}let u=vGn(i,o,r);return o>r&&o<=a?{x:0,y:-s.height-u,...Wve}:o<r&&o>=a?{x:0,y:s.height+u,...Wve}:{x:0,y:0,...Wve}};function vGn(t,e,r){let n=t[e],o=t[e-1],i=t[e+1];return n?r<e?o?n.top-(o.top+o.height):i?i.top-(n.top+n.height):0:i?i.top-(n.top+n.height):o?n.top-(o.top+o.height):0:0}var jgr="Sortable",Dgr=yu.default.createContext({activeIndex:-1,containerId:jgr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ngr,disabled:{draggable:!1,droppable:!1}});function n6(t){let{children:e,id:r,items:n,strategy:o=Ngr,disabled:i=!1}=t,{active:a,dragOverlay:s,droppableRects:u,over:l,measureDroppableContainers:c}=Mgr(),d=Z$(jgr,r),f=s.rect!==null,p=(0,yu.useMemo)(()=>n.map(E=>typeof E=="object"&&"id"in E?E.id:E),[n]),m=a!=null,h=a?p.indexOf(a.id):-1,y=l?p.indexOf(l.id):-1,g=(0,yu.useRef)(p),_=!bGn(p,g.current),w=y!==-1&&h===-1||_,S=_Gn(i);Ob(()=>{_&&m&&c(p)},[_,p,m,c]),(0,yu.useEffect)(()=>{g.current=p},[p]);let C=(0,yu.useMemo)(()=>({activeIndex:h,containerId:d,disabled:S,disableTransforms:w,items:p,overIndex:y,useDragOverlay:f,sortedRects:yGn(p,u),strategy:o}),[h,d,S.draggable,S.droppable,w,p,y,u,f,o]);return yu.default.createElement(Dgr.Provider,{value:C},e)}var wGn=t=>{let{id:e,items:r,activeIndex:n,overIndex:o}=t;return Gve(r,n,o).indexOf(e)},xGn=t=>{let{containerId:e,isSorting:r,wasDragging:n,index:o,items:i,newIndex:a,previousItems:s,previousContainerId:u,transition:l}=t;return!l||!n||s!==i&&o===a?!1:r?!0:a!==o&&e===u},SGn={duration:200,easing:"ease"},Lgr="transform",CGn=Cb.Transition.toString({property:Lgr,duration:0,easing:"linear"}),OGn={roleDescription:"sortable"};function EGn(t){let{disabled:e,index:r,node:n,rect:o}=t,[i,a]=(0,yu.useState)(null),s=(0,yu.useRef)(r);return Ob(()=>{if(!e&&r!==s.current&&n.current){let u=o.current;if(u){let l=nB(n.current,{ignoreTransform:!0}),c={x:u.left-l.left,y:u.top-l.top,scaleX:u.width/l.width,scaleY:u.height/l.height};(c.x||c.y)&&a(c)}}r!==s.current&&(s.current=r)},[e,r,n,o]),(0,yu.useEffect)(()=>{i&&a(null)},[i]),i}function o6(t){let{animateLayoutChanges:e=xGn,attributes:r,disabled:n,data:o,getNewIndex:i=wGn,id:a,strategy:s,resizeObserverConfig:u,transition:l=SGn}=t,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:y,useDragOverlay:g,strategy:_}=(0,yu.useContext)(Dgr),w=PGn(n,p),S=c.indexOf(a),C=(0,yu.useMemo)(()=>({sortable:{containerId:d,index:S,items:c},...o}),[d,o,S,c]),E=(0,yu.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:P,node:T,isOver:I,setNodeRef:N}=Rgr({id:a,data:C,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...u}}),{active:M,activatorEvent:D,activeNodeRect:k,attributes:L,setNodeRef:H,listeners:K,isDragging:G,over:X,setActivatorNodeRef:F,transform:Q}=Igr({id:a,data:C,attributes:{...OGn,...r},disabled:w.draggable}),ee=Jhr(N,H),U=!!M,z=U&&!m&&Vve(f)&&Vve(y),V=!g&&G,q=V&&z?Q:null,J=z?q??(s??_)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:y,index:S}):null,se=Vve(f)&&Vve(y)?i({id:a,items:c,activeIndex:f,overIndex:y}):S,be=M?.id,ce=(0,yu.useRef)({activeId:be,items:c,newIndex:se,containerId:d}),pe=c!==ce.current.items,Me=e({active:M,containerId:d,isDragging:G,isSorting:U,id:a,index:S,items:c,newIndex:ce.current.newIndex,previousItems:ce.current.items,previousContainerId:ce.current.containerId,transition:l,wasDragging:ce.current.activeId!=null}),Ue=EGn({disabled:!Me,index:S,node:T,rect:P});return(0,yu.useEffect)(()=>{U&&ce.current.newIndex!==se&&(ce.current.newIndex=se),d!==ce.current.containerId&&(ce.current.containerId=d),c!==ce.current.items&&(ce.current.items=c)},[U,se,d,c]),(0,yu.useEffect)(()=>{if(be===ce.current.activeId)return;if(be!=null&&ce.current.activeId==null){ce.current.activeId=be;return}let pr=setTimeout(()=>{ce.current.activeId=be},50);return()=>clearTimeout(pr)},[be]),{active:M,activeIndex:f,attributes:L,data:C,rect:P,index:S,newIndex:se,items:c,isOver:I,isSorting:U,isDragging:G,listeners:K,node:T,overIndex:y,over:X,setNodeRef:ee,setActivatorNodeRef:F,setDroppableNodeRef:N,setDraggableNodeRef:H,transform:Ue??J,transition:Et()};function Et(){if(Ue||pe&&ce.current.newIndex===S)return CGn;if(!(V&&!aX(D)||!l)&&(U||Me))return Cb.Transition.toString({...l,property:Lgr})}}function PGn(t,e){var r,n;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(r=t?.draggable)!=null?r:e.draggable,droppable:(n=t?.droppable)!=null?n:e.droppable}}function Kve(t){if(!t)return!1;let e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}var TGn=[uo.Down,uo.Right,uo.Up,uo.Left],Jve=(t,e)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=e;if(TGn.includes(t.code)){if(t.preventDefault(),!r||!n)return;let u=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;let f=o.get(d.id);if(f)switch(t.code){case uo.Down:n.top<f.top&&u.push(d);break;case uo.Up:n.top>f.top&&u.push(d);break;case uo.Left:n.left>f.left&&u.push(d);break;case uo.Right:n.left<f.left&&u.push(d);break}});let l=ygr({active:r,collisionRect:n,droppableRects:o,droppableContainers:u,pointerCoordinates:null}),c=RKe(l,"id");if(c===a?.id&&l.length>1&&(c=l[1].id),c!=null){let d=i.get(r.id),f=i.get(c),p=f?o.get(f.id):null,m=f?.node.current;if(m&&p&&d&&f){let y=dX(m).some((E,P)=>s[P]!==E),g=Fgr(d,f),_=AGn(d,f),w=y||!g?{x:0,y:0}:{x:_?n.width-p.width:0,y:_?n.height-p.height:0},S={x:p.left,y:p.top};return w.x&&w.y?S:X$(S,w)}}}};function Fgr(t,e){return!Kve(t)||!Kve(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function AGn(t,e){return!Kve(t)||!Kve(e)||!Fgr(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}_n();function Zve({id:t,item:e,title:r,subtitle:n,badge:o,icon:i,isDraggable:a=!1,isExpandable:s=!1,defaultExpanded:u=!1,expandedContent:l,primaryAction:c,dropdownActions:d=[],containerRef:f,className:p,onExpandToggle:m}){let[h,y]=(0,Li.useState)(u),{attributes:g,listeners:_,setNodeRef:w,transform:S,transition:C,isDragging:E}=o6({id:t,disabled:!a}),P={transform:Cb.Transform.toString(S),transition:C},T=()=>{if(s){let N=!h;y(N),m?.(N)}},I=d.length>0;return Li.default.createElement(L$,{ref:w,style:P,className:he("tw-mb-2",E&&["tw-opacity-90","tw-shadow-lg","tw-border-accent/50","tw-relative","tw-z-[9999]","tw-bg-primary","tw-rounded-lg","tw-transform-gpu"],a&&"tw-touch-manipulation",p)},Li.default.createElement(F$,{className:"tw-p-3"},Li.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},a&&Li.default.createElement("div",{className:"tw-mr-2 tw-cursor-grab tw-touch-none active:tw-cursor-grabbing",...g,..._},Li.default.createElement(Yb,{className:"tw-size-4"})),Li.default.createElement("div",{className:"tw-flex-1 tw-touch-auto",onClick:s?T:void 0,style:{cursor:s?"pointer":"default"}},Li.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},s&&Li.default.createElement("div",{className:"tw-flex tw-size-3 tw-items-center tw-justify-center"},h?Li.default.createElement($i,{className:"tw-size-3 tw-stroke-[7]"}):Li.default.createElement($m,{className:"tw-size-3 tw-stroke-[7]"})),i&&Li.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},i),Li.default.createElement("div",{className:"tw-min-w-0 tw-flex-1"},Li.default.createElement("div",{className:"tw-break-words tw-font-medium tw-leading-relaxed"},r,o&&Li.default.createElement("span",{className:"tw-ml-1 tw-inline-flex tw-items-center"},o)),n&&Li.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Li.default.createElement("span",{className:"tw-bg-secondary tw-text-sm tw-text-muted"},n))))),Li.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},c&&Li.default.createElement(me,{variant:"ghost",size:"icon",onClick:N=>{N.stopPropagation(),c.onClick(e)},title:c.tooltip},c.icon),I&&Li.default.createElement(JO,null,Li.default.createElement(ZO,{asChild:!0},Li.default.createElement(me,{variant:"ghost",size:"icon"},Li.default.createElement(Gv,{className:"tw-size-4"}))),Li.default.createElement(wh,{align:"end",container:f?.current},d.map((N,M)=>Li.default.createElement(so,{key:M,onClick:D=>{D.stopPropagation(),N.onClick(e)},className:he(N.variant==="destructive"&&"tw-text-error")},Li.default.createElement("span",{className:"tw-mr-2 tw-flex tw-size-4 tw-items-center tw-justify-center"},N.icon),N.label))))))),s&&Li.default.createElement("div",{className:he("tw-transition-all tw-duration-300 tw-ease-in-out",h?"tw-max-h-96 tw-opacity-100":"tw-max-h-0 tw-overflow-hidden tw-opacity-0")},Li.default.createElement(k$,{className:"tw-p-3 tw-pt-0"},l)))}_n();var Nc=j(Z());dn();var fX=Nc.forwardRef(({className:t,...e},r)=>Nc.createElement("div",{className:"tw-relative tw-w-full tw-overflow-auto"},Nc.createElement("table",{ref:r,className:he("tw-w-full tw-caption-bottom tw-border-collapse tw-text-sm",t),...e})));fX.displayName="Table";var pX=Nc.forwardRef(({className:t,...e},r)=>Nc.createElement("thead",{ref:r,className:he("[&_tr]:tw-border-b",t),...e}));pX.displayName="TableHeader";var mX=Nc.forwardRef(({className:t,...e},r)=>Nc.createElement("tbody",{ref:r,className:t,...e}));mX.displayName="TableBody";var IGn=Nc.forwardRef(({className:t,...e},r)=>Nc.createElement("tfoot",{ref:r,className:he("tw-border-t tw-font-medium tw-bg-primary-alt/50",t),...e}));IGn.displayName="TableFooter";var qN=Nc.forwardRef(({className:t,...e},r)=>Nc.createElement("tr",{ref:r,className:he("tw-border-b tw-transition-colors hover:tw-bg-primary-alt/50 data-[state=selected]:tw-bg-primary-alt",t),...e}));qN.displayName="TableRow";var fm=Nc.forwardRef(({className:t,...e},r)=>Nc.createElement("th",{ref:r,className:he("tw-h-10 tw-px-2 tw-text-left tw-align-middle tw-font-medium tw-text-muted [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));fm.displayName="TableHead";var gp=Nc.forwardRef(({className:t,...e},r)=>Nc.createElement("td",{ref:r,className:he("tw-p-2 tw-align-middle [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));gp.displayName="TableCell";var MGn=Nc.forwardRef(({className:t,...e},r)=>Nc.createElement("caption",{ref:r,className:he("tw-mt-4 tw-text-sm tw-text-muted",t),...e}));MGn.displayName="TableCaption";dn();_t();O8();var ka=j(Z());dn();var Ng=j(Z());dn();_n();qj();$t();kt();function rE({value:t,onChange:e,placeholder:r,disabled:n,className:o}){let[i,a]=(0,Ng.useState)(!1),s=(0,Ng.useRef)(null),u=(0,Ng.useRef)(!0);return(0,Ng.useEffect)(()=>{(async()=>{if(u.current&&t&&s.current){try{s.current.value=await Co(t)}catch(c){ie("Failed to decrypt value:"+Fn(c)),s.current.value=t}u.current=!1}else s.current&&(s.current.value=t||"")})()},[t]),Ng.default.createElement("div",{className:he("tw-relative",o)},Ng.default.createElement(gi,{ref:s,type:i?"text":"password",onChange:l=>e?.(l.target.value),placeholder:r,disabled:n,className:he("tw-w-full !tw-pr-7")}),Ng.default.createElement("div",{onClick:()=>!n&&a(!i),className:he("tw-absolute tw-inset-y-0 tw-right-2 tw-flex tw-items-center tw-justify-center","tw-cursor-pointer",n&&"tw-cursor-not-allowed tw-opacity-50"),role:"button","aria-label":i?"Hide password":"Show password"},i?Ng.default.createElement(j5,{className:he("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")}):Ng.default.createElement(GE,{className:he("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")})))}_n();var bf=j(Z());var ba=j(Z(),1);function nE(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var $gr=j(Z(),1);function kgr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function NKe(...t){return e=>{let r=!1,n=t.map(o=>{let i=kgr(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():kgr(t[o],null)}}}}function TA(...t){return $gr.useCallback(NKe(...t),t)}var Is=j(Z(),1);var Bgr=j(Z(),1),zgr=j(qa(),1);var yf=j(Z(),1);var i6=j(at(),1),hX=yf.forwardRef((t,e)=>{let{children:r,...n}=t,o=yf.Children.toArray(r),i=o.find(NGn);if(i){let a=i.props.children,s=o.map(u=>u===i?yf.Children.count(a)>1?yf.Children.only(null):yf.isValidElement(a)?a.props.children:null:u);return(0,i6.jsx)(jKe,{...n,ref:e,children:yf.isValidElement(a)?yf.cloneElement(a,void 0,s):null})}return(0,i6.jsx)(jKe,{...n,ref:e,children:r})});hX.displayName="Slot";var jKe=yf.forwardRef((t,e)=>{let{children:r,...n}=t;if(yf.isValidElement(r)){let o=DGn(r);return yf.cloneElement(r,{...jGn(n,r.props),ref:e?NKe(e,o):o})}return yf.Children.count(r)>1?yf.Children.only(null):null});jKe.displayName="SlotClone";var RGn=({children:t})=>(0,i6.jsx)(i6.Fragment,{children:t});function NGn(t){return yf.isValidElement(t)&&t.type===RGn}function jGn(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function DGn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Ugr=j(at(),1),LGn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],jg=LGn.reduce((t,e)=>{let r=Bgr.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?hX:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Ugr.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function qgr(t,e){t&&zgr.flushSync(()=>t.dispatchEvent(e))}var LKe=j(at(),1),FGn="DismissableLayer",DKe="dismissableLayer.update",kGn="dismissableLayer.pointerDownOutside",$Gn="dismissableLayer.focusOutside",Hgr,Wgr=Is.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),FKe=Is.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Is.useContext(Wgr),[c,d]=Is.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Is.useState({}),m=TA(e,P=>d(P)),h=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(y),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=g,C=UGn(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=qGn(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return nN(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Is.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Hgr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),Vgr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Hgr)}},[c,f,r,l]),Is.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),Vgr())},[c,l]),Is.useEffect(()=>{let P=()=>p({});return document.addEventListener(DKe,P),()=>document.removeEventListener(DKe,P)},[]),(0,LKe.jsx)(jg.div,{...u,ref:m,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:nE(t.onFocusCapture,E.onFocusCapture),onBlurCapture:nE(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:nE(t.onPointerDownCapture,C.onPointerDownCapture)})});FKe.displayName=FGn;var BGn="DismissableLayerBranch",zGn=Is.forwardRef((t,e)=>{let r=Is.useContext(Wgr),n=Is.useRef(null),o=TA(e,n);return Is.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,LKe.jsx)(jg.div,{...t,ref:o})});zGn.displayName=BGn;function UGn(t,e=globalThis?.document){let r=un(t),n=Is.useRef(!1),o=Is.useRef(()=>{});return Is.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Kgr(kGn,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function qGn(t,e=globalThis?.document){let r=un(t),n=Is.useRef(!1);return Is.useEffect(()=>{let o=i=>{i.target&&!n.current&&Kgr($Gn,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Vgr(){let t=new CustomEvent(DKe);document.dispatchEvent(t)}function Kgr(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?qgr(o,i):o.dispatchEvent(i)}var Pb=j(Z(),1);var Xgr=j(at(),1),kKe="focusScope.autoFocusOnMount",$Ke="focusScope.autoFocusOnUnmount",Ggr={bubbles:!1,cancelable:!0},HGn="FocusScope",BKe=Pb.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Pb.useState(null),l=un(o),c=un(i),d=Pb.useRef(null),f=TA(e,h=>u(h)),p=Pb.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Pb.useEffect(()=>{if(n){let _=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:HN(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||HN(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let T of E)T.removedNodes.length>0&&HN(s)};var h=_,y=w,g=S;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(S);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),Pb.useEffect(()=>{if(s){Zgr.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(kKe,Ggr);s.addEventListener(kKe,l),s.dispatchEvent(g),g.defaultPrevented||(VGn(ZGn(Qgr(s)),{select:!0}),document.activeElement===h&&HN(s))}return()=>{s.removeEventListener(kKe,l),setTimeout(()=>{let g=new CustomEvent($Ke,Ggr);s.addEventListener($Ke,c),s.dispatchEvent(g),g.defaultPrevented||HN(h??document.body,{select:!0}),s.removeEventListener($Ke,c),Zgr.remove(p)},0)}}},[s,l,c,p]);let m=Pb.useCallback(h=>{if(!r&&!n||p.paused)return;let y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(y&&g){let _=h.currentTarget,[w,S]=WGn(_);w&&S?!h.shiftKey&&g===S?(h.preventDefault(),r&&HN(w,{select:!0})):h.shiftKey&&g===w&&(h.preventDefault(),r&&HN(S,{select:!0})):g===_&&h.preventDefault()}},[r,n,p.paused]);return(0,Xgr.jsx)(jg.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});BKe.displayName=HGn;function VGn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(HN(n,{select:e}),document.activeElement!==r)return}function WGn(t){let e=Qgr(t),r=Jgr(e,t),n=Jgr(e.reverse(),t);return[r,n]}function Qgr(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{let o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function Jgr(t,e){for(let r of t)if(!KGn(r,{upTo:e}))return r}function KGn(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function GGn(t){return t instanceof HTMLInputElement&&"select"in t}function HN(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&GGn(t)&&e&&t.select()}}var Zgr=JGn();function JGn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=Ygr(t,e),t.unshift(e)},remove(e){t=Ygr(t,e),t[0]?.resume()}}}function Ygr(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function ZGn(t){return t.filter(e=>e.tagName!=="A")}var Yve=j(Z(),1),eyr=j(qa(),1);var tyr=j(at(),1),YGn="Portal",zKe=Yve.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Yve.useState(!1);vo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?eyr.default.createPortal((0,tyr.jsx)(jg.div,{...n,ref:e}),a):null});zKe.displayName=YGn;var na=j(at(),1),UKe="Dialog",[ryr,sea]=ts(UKe),[XGn,yv]=ryr(UKe),nyr=t=>{let{__scopeDialog:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=t,s=ba.useRef(null),u=ba.useRef(null),[l=!1,c]=im({prop:n,defaultProp:o,onChange:i});return(0,na.jsx)(XGn,{scope:e,triggerRef:s,contentRef:u,contentId:Xl(),titleId:Xl(),descriptionId:Xl(),open:l,onOpenChange:c,onOpenToggle:ba.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};nyr.displayName=UKe;var oyr="DialogTrigger",iyr=ba.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=yv(oyr,r),i=TA(e,o.triggerRef);return(0,na.jsx)(jg.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":VKe(o.open),...n,ref:i,onClick:nE(t.onClick,o.onOpenToggle)})});iyr.displayName=oyr;var qKe="DialogPortal",[QGn,ayr]=ryr(qKe,{forceMount:void 0}),syr=t=>{let{__scopeDialog:e,forceMount:r,children:n,container:o}=t,i=yv(qKe,e);return(0,na.jsx)(QGn,{scope:e,forceMount:r,children:ba.Children.map(n,a=>(0,na.jsx)(of,{present:r||i.open,children:(0,na.jsx)(zKe,{asChild:!0,container:o,children:a})}))})};syr.displayName=qKe;var Xve="DialogOverlay",uyr=ba.forwardRef((t,e)=>{let r=ayr(Xve,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=yv(Xve,t.__scopeDialog);return i.modal?(0,na.jsx)(of,{present:n||i.open,children:(0,na.jsx)(eJn,{...o,ref:e})}):null});uyr.displayName=Xve;var eJn=ba.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=yv(Xve,r);return(0,na.jsx)(YY,{as:hX,allowPinchZoom:!0,shards:[o.contentRef],children:(0,na.jsx)(jg.div,{"data-state":VKe(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),oB="DialogContent",lyr=ba.forwardRef((t,e)=>{let r=ayr(oB,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=yv(oB,t.__scopeDialog);return(0,na.jsx)(of,{present:n||i.open,children:i.modal?(0,na.jsx)(tJn,{...o,ref:e}):(0,na.jsx)(rJn,{...o,ref:e})})});lyr.displayName=oB;var tJn=ba.forwardRef((t,e)=>{let r=yv(oB,t.__scopeDialog),n=ba.useRef(null),o=TA(e,r.contentRef,n);return ba.useEffect(()=>{let i=n.current;if(i)return yN(i)},[]),(0,na.jsx)(cyr,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:nE(t.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:nE(t.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:nE(t.onFocusOutside,i=>i.preventDefault())})}),rJn=ba.forwardRef((t,e)=>{let r=yv(oB,t.__scopeDialog),n=ba.useRef(!1),o=ba.useRef(!1);return(0,na.jsx)(cyr,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(n.current||r.triggerRef.current?.focus(),i.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));let a=i.target;r.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),cyr=ba.forwardRef((t,e)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=t,s=yv(oB,r),u=ba.useRef(null),l=TA(e,u);return oN(),(0,na.jsxs)(na.Fragment,{children:[(0,na.jsx)(BKe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,na.jsx)(FKe,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":VKe(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,na.jsxs)(na.Fragment,{children:[(0,na.jsx)(nJn,{titleId:s.titleId}),(0,na.jsx)(iJn,{contentRef:u,descriptionId:s.descriptionId})]})]})}),HKe="DialogTitle",dyr=ba.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=yv(HKe,r);return(0,na.jsx)(jg.h2,{id:o.titleId,...n,ref:e})});dyr.displayName=HKe;var fyr="DialogDescription",pyr=ba.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=yv(fyr,r);return(0,na.jsx)(jg.p,{id:o.descriptionId,...n,ref:e})});pyr.displayName=fyr;var myr="DialogClose",hyr=ba.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=yv(myr,r);return(0,na.jsx)(jg.button,{type:"button",...n,ref:e,onClick:nE(t.onClick,()=>o.onOpenChange(!1))})});hyr.displayName=myr;function VKe(t){return t?"open":"closed"}var gyr="DialogTitleWarning",[uea,yyr]=gir(gyr,{contentName:oB,titleName:HKe,docsSlug:"dialog"}),nJn=({titleId:t})=>{let e=yyr(gyr),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return ba.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},oJn="DialogDescriptionWarning",iJn=({contentRef:t,descriptionId:e})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${yyr(oJn).contentName}}.`;return ba.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},byr=nyr,_yr=iyr,vyr=syr,WKe=uyr,KKe=lyr,GKe=dyr,JKe=pyr,wyr=hyr;_n();dn();var Qve=byr,xyr=_yr,sJn=vyr;var Syr=bf.forwardRef(({className:t,...e},r)=>bf.createElement(WKe,{ref:r,className:he("tw-fixed tw-inset-0 tw-z-modal data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0","tw-bg-overlay/50",t),...e}));Syr.displayName=WKe.displayName;var gX=bf.forwardRef(({className:t,children:e,container:r,...n},o)=>bf.createElement(sJn,{container:r},bf.createElement(Syr,null),bf.createElement(KKe,{ref:o,className:he("tw-fixed tw-left-1/2 tw-top-1/2 tw-z-modal tw-grid tw-w-full tw-max-w-lg -tw-translate-x-1/2 -tw-translate-y-1/2 tw-gap-4 tw-border tw-bg-primary tw-p-6 tw-shadow-lg tw-duration-200 data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[state=closed]:tw-slide-out-to-left-1/2 data-[state=closed]:tw-slide-out-to-top-[48%] data-[state=open]:tw-slide-in-from-left-1/2 data-[state=open]:tw-slide-in-from-top-[48%] sm:tw-rounded-lg",t),...n},e,bf.createElement(wyr,{className:"clickable-icon tw-absolute tw-right-4 tw-top-4 tw-border-none tw-bg-transparent tw-text-faint tw-outline-none hover:tw-bg-transparent hover:tw-bg-opacity-100 hover:tw-text-normal focus-visible:tw-text-normal focus-visible:tw-outline-none focus-visible:tw-ring-0"},bf.createElement(_i,{className:"tw-size-4"}),bf.createElement("span",{className:"tw-sr-only"},"Close")))));gX.displayName=KKe.displayName;var yX=({className:t,...e})=>bf.createElement("div",{className:he("tw-flex tw-flex-col tw-space-y-0.5 tw-text-center sm:tw-text-left",t),...e});yX.displayName="DialogHeader";var uJn=({className:t,...e})=>bf.createElement("div",{className:he("tw-flex tw-flex-col-reverse sm:tw-flex-row sm:tw-justify-end sm:tw-space-x-2",t),...e});uJn.displayName="DialogFooter";var bX=bf.forwardRef(({className:t,...e},r)=>bf.createElement(GKe,{ref:r,className:he("tw-mt-0 tw-text-lg tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));bX.displayName=GKe.displayName;var _X=bf.forwardRef(({className:t,...e},r)=>bf.createElement(JKe,{ref:r,className:he("tw-text-sm tw-text-muted",t),...e}));_X.displayName=JKe.displayName;kt();function Pr(t){let{title:e,description:r,className:n,disabled:o}=t,{modalContainer:i}=JV(),a="onChange"in t?t.onChange:void 0,s=(0,ka.useMemo)(()=>{if(a)return Ree(l=>{a(l)},1e3)},[a]),u=()=>{switch(t.type){case"text":case"number":return ka.default.createElement(gi,{type:t.type,defaultValue:t.value,onChange:l=>{s?.(l.target.value)},placeholder:t.placeholder,disabled:o,className:"tw-w-full sm:tw-w-[200px]"});case"password":return ka.default.createElement(rE,{value:t.value!==void 0?String(t.value):void 0,onChange:l=>{s?.(l)},placeholder:t.placeholder,disabled:o,className:"tw-w-full sm:tw-w-[200px]"});case"textarea":return ka.default.createElement(ev,{defaultValue:t.value,onChange:l=>{s?.(l.target.value)},placeholder:t.placeholder,rows:t.rows||3,disabled:o,className:"tw-min-h-[80px] tw-w-full sm:tw-w-[300px]"});case"switch":return ka.default.createElement(gV,{checked:t.checked,onCheckedChange:t.onCheckedChange,disabled:o});case"select":return ka.default.createElement("div",{className:"tw-group tw-relative tw-w-full sm:tw-w-[200px]"},ka.default.createElement("select",{value:t.value?.toString(),onChange:l=>t.onChange?.(l.target.value),disabled:o,className:he("tw-w-full tw-appearance-none","tw-flex tw-h-9 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-dropdown tw-px-3 tw-py-1 tw-pr-8","tw-text-sm !tw-shadow tw-transition-colors","focus:tw-outline-none focus:tw-ring-1 focus:tw-ring-ring","disabled:tw-cursor-not-allowed disabled:tw-opacity-50","hover:tw-bg-interactive-hover hover:tw-text-normal")},t.placeholder&&ka.default.createElement("option",{value:"",disabled:!0},t.placeholder),t.options.map(l=>ka.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),ka.default.createElement("div",{className:he("tw-pointer-events-none tw-absolute tw-inset-y-0 tw-right-0 tw-flex tw-items-center tw-pr-2","tw-transition-colors group-hover:[&>svg]:tw-text-normal",o&&"tw-opacity-50")},ka.default.createElement($i,{className:"tw-size-4"})));case"slider":return ka.default.createElement(KY,{value:t.value||0,onChange:t.onChange,min:t.min,max:t.max,step:t.step,suffix:t.suffix,disabled:o,className:"tw-w-full sm:tw-w-[300px]"});case"dialog":return ka.default.createElement(Qve,null,ka.default.createElement(xyr,{asChild:!0},t.trigger),ka.default.createElement(gX,{container:i},(t.dialogTitle||t.dialogDescription)&&ka.default.createElement(yX,null,t.dialogTitle&&ka.default.createElement(bX,null,t.dialogTitle),t.dialogDescription&&ka.default.createElement(_X,null,t.dialogDescription)),t.children));case"custom":return t.children}};return ka.default.createElement("div",{className:he("tw-flex tw-flex-col tw-items-start tw-justify-between tw-gap-4 tw-py-4 sm:tw-flex-row sm:tw-items-center","tw-w-full",n)},ka.default.createElement("div",{className:"tw-w-full tw-space-y-1.5 sm:tw-w-[300px]"},ka.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-leading-none"},e),r&&ka.default.createElement("div",{className:"tw-text-xs tw-text-muted"},r)),ka.default.createElement("div",{className:"tw-w-full tw-flex-1 sm:tw-flex sm:tw-justify-end"},u()))}var ewe=require("obsidian"),lJn=({command:t,commands:e,onUpdate:r,onRemove:n,onCopy:o,containerRef:i})=>{let a=l=>{new Q1(app,e,l,async d=>{await r(d,l.title)}).open()},s=[{icon:Ze.default.createElement(dy,{className:"tw-size-4"}),label:"Edit",onClick:a},{icon:Ze.default.createElement(Bm,{className:"tw-size-4"}),label:"Copy",onClick:o},{icon:Ze.default.createElement(qm,{className:"tw-size-4"}),label:"Delete",onClick:l=>{new Yl(app,()=>n(l),`Are you sure you want to delete the command "${l.title}"? This will permanently remove the command file and cannot be undone.`,"Delete Command","Delete","Cancel").open()},variant:"destructive"}],u=Ze.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-justify-around"},Ze.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},Ze.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ze.default.createElement("span",{className:"tw-text-sm tw-font-medium"},"In Menu"),Ze.default.createElement(jn,{content:Ze.default.createElement("div",{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available in the context menu when you right-click in the editor.")})),Ze.default.createElement(hu,{checked:t.showInContextMenu,onCheckedChange:l=>{r({...t,showInContextMenu:l===!0},t.title)}})),Ze.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},Ze.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ze.default.createElement("span",{className:"tw-text-sm tw-font-medium"},"In Slash"),Ze.default.createElement(jn,{content:Ze.default.createElement("div",{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available as a slash command in the chat.")})),Ze.default.createElement(hu,{checked:t.showInSlashMenu,onCheckedChange:l=>r({...t,showInSlashMenu:l===!0},t.title)})));return Ze.default.createElement(Zve,{id:t.title,item:t,title:t.title,isDraggable:!0,isExpandable:!0,expandedContent:u,primaryAction:{icon:Ze.default.createElement(dy,{className:"tw-size-4"}),onClick:a,tooltip:"Edit Command"},dropdownActions:s,containerRef:i})},cJn=({command:t,commands:e,onUpdate:r,onRemove:n,onCopy:o})=>{let{attributes:i,listeners:a,setNodeRef:s,transform:u,transition:l,isDragging:c}=o6({id:t.title}),d={transform:Cb.Transform.toString(u),transition:l},f=()=>{n(t)};return Ze.default.createElement(qN,{ref:s,style:d,className:he("tw-transition-colors",c&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50")},Ze.default.createElement(gp,{className:"tw-w-10"},Ze.default.createElement("div",{...i,...a,className:"tw-flex tw-cursor-grab tw-items-center tw-justify-center"},Ze.default.createElement(Yb,{className:"tw-size-4"}))),Ze.default.createElement(gp,null,t.title),Ze.default.createElement(gp,{className:"tw-text-center"},Ze.default.createElement(hu,{checked:t.showInContextMenu,onCheckedChange:p=>{r({...t,showInContextMenu:p===!0},t.title)},className:"tw-mx-auto"})),Ze.default.createElement(gp,{className:"tw-text-center"},Ze.default.createElement(hu,{checked:t.showInSlashMenu,onCheckedChange:p=>r({...t,showInSlashMenu:p===!0},t.title),className:"tw-mx-auto"})),Ze.default.createElement(gp,{className:"tw-text-center"},Ze.default.createElement("div",{className:"tw-flex tw-justify-center tw-space-x-1"},Ze.default.createElement(me,{variant:"ghost",size:"icon",onClick:()=>{new Q1(app,e,t,async m=>{await r(m,t.title)}).open()}},Ze.default.createElement(dy,{className:"tw-size-4"})),Ze.default.createElement(me,{variant:"ghost",size:"icon",onClick:()=>o(t),title:"Copy command"},Ze.default.createElement(Bm,{className:"tw-size-4"})),Ze.default.createElement(me,{variant:"ghost",size:"icon",onClick:()=>{new Yl(app,f,`Are you sure you want to delete the command "${t.title}"? This will permanently remove the command file and cannot be undone.`,"Delete Command","Delete","Cancel").open()}},Ze.default.createElement(qm,{className:"tw-size-4"})))))},Cyr=()=>{let t=Rir(),e=(0,Ze.useMemo)(()=>oY([...t]),[t]),r=an(),n=(0,Ze.useRef)(null),o=Uve(QV(UN,{activationConstraint:{distance:8}}),QV(zN,{coordinateGetter:Jve})),i=async(d,f)=>{await Ac.getInstance().updateCommand(d,f)},a=async d=>{await Ac.getInstance().createCommand(d)},s=async d=>{try{await Ac.getInstance().deleteCommand(d),new ewe.Notice(`Command "${d.title}" deleted successfully!`)}catch(f){throw console.error("Failed to delete command:",f),new ewe.Notice("Failed to delete command. Please try again."),f}},u=async d=>{try{let f=jir(d.title,e),p={...d,title:f};await Ac.getInstance().createCommand(p,{autoOrder:!1})}catch(f){console.error("Failed to copy command:",f),new ewe.Notice("Failed to copy command. Please try again.")}},l=async d=>{let{active:f,over:p}=d;if(!p||f.id===p.id)return;let m=e.findIndex(_=>_.title===f.id),h=e.findIndex(_=>_.title===p.id);if(m===-1||h===-1)return;let y=[...e],[g]=y.splice(m,1);y.splice(h,0,g),await Ac.getInstance().reorderCommands(y)},c=()=>Ze.default.createElement("div",{className:"tw-relative md:tw-hidden"},Ze.default.createElement(t6,{sensors:o,collisionDetection:e6,onDragEnd:l},Ze.default.createElement(n6,{items:e.map(d=>d.title),strategy:r6},Ze.default.createElement("div",{className:"tw-space-y-2"},e.length===0?Ze.default.createElement("div",{className:"tw-rounded-lg tw-border tw-border-border tw-bg-primary tw-p-8 tw-text-center tw-text-muted"},"No custom prompt files found."):e.map(d=>Ze.default.createElement(lJn,{key:d.title,command:d,commands:e,onUpdate:i,onRemove:s,onCopy:u,containerRef:n}))))));return Ze.default.createElement("div",{className:"tw-space-y-4",ref:n},Ze.default.createElement("section",null,Ze.default.createElement("div",{className:"tw-mb-4 tw-flex tw-flex-col tw-gap-2"},Ze.default.createElement("div",{className:"tw-text-xl tw-font-bold"},"Custom Commands"),Ze.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Custom commands are preset prompts that you can trigger in the editor by right-clicking and selecting them from the context menu or by using a ",Ze.default.createElement("code",null,"/")," command in the chat to load them into your chat input.")),Ze.default.createElement(Pr,{type:"text",title:"Custom Prompts Folder Name",description:"Folder where custom prompts are stored",value:r.customPromptsFolder,onChange:d=>{Xe("customPromptsFolder",d),Rbe()},placeholder:"copilot/copilot-custom-prompts"}),Ze.default.createElement(Pr,{type:"switch",title:"Custom Prompt Templating",description:"Process variables like {activenote}, {foldername}, or {#tag} in prompts. Disable for raw prompts.",checked:r.enableCustomPromptTemplating,onCheckedChange:d=>{Xe("enableCustomPromptTemplating",d)}}),Ze.default.createElement(Pr,{type:"select",title:"Custom Prompts Sort Strategy",description:"Sort order for slash command menu prompts",value:r.promptSortStrategy,onChange:d=>Xe("promptSortStrategy",d),options:[{label:"Recency",value:"timestamp"},{label:"Alphabetical",value:"alphabetical"},{label:"Manual",value:"manual"}]}),Ze.default.createElement("div",{className:"tw-mb-4 tw-flex tw-items-start tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-4 tw-text-muted"},Ze.default.createElement(JE,{className:"tw-size-5"})," ",Ze.default.createElement("div",null,"Commands are automatically loaded from .md files in your custom prompts folder"," ",Ze.default.createElement("strong",null,r.customPromptsFolder),". Modifying the files will also update the command settings.")),Ze.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Ze.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-between tw-gap-2 md:tw-justify-end"},Ze.default.createElement("div",null,Ze.default.createElement(me,{variant:"secondary",onClick:()=>new Yl(app,wKe,"This will add default commands to your custom prompts folder. Do you want to continue?","Generate Default Commands").open()},"Generate Default")),Ze.default.createElement(me,{variant:"default",className:"tw-gap-2",onClick:()=>{let d={...HO};new Q1(app,e,d,async p=>{await a(p)}).open()}},Ze.default.createElement(Wh,{className:"tw-size-2 md:tw-size-4"}),"Add Cmd")),Ze.default.createElement("div",{className:"tw-hidden md:tw-block"},Ze.default.createElement(t6,{sensors:o,collisionDetection:e6,onDragEnd:l},Ze.default.createElement(fX,null,Ze.default.createElement(pX,null,Ze.default.createElement(qN,null,Ze.default.createElement(fm,{className:"tw-w-10"}),Ze.default.createElement(fm,null,"Name"),Ze.default.createElement(fm,{className:"tw-w-24 tw-text-center"},Ze.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"In Menu",Ze.default.createElement(jn,{content:Ze.default.createElement("div",{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available in the context menu when you right-click in the editor.")}))),Ze.default.createElement(fm,{className:"tw-w-28 tw-text-center"},Ze.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"Slash Cmd",Ze.default.createElement(jn,{content:Ze.default.createElement("div",{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available as a slash command in the chat.")}))),Ze.default.createElement(fm,{className:"tw-w-32 tw-text-center"},"Actions"))),Ze.default.createElement(n6,{items:e.map(d=>d.title),strategy:r6},Ze.default.createElement(mX,null,e.length===0?Ze.default.createElement(qN,null,Ze.default.createElement(gp,{colSpan:5,className:"tw-py-8 tw-text-center tw-text-muted"},"No custom prompt files found.")):e.map(d=>Ze.default.createElement(cJn,{key:d.title,command:d,commands:e,onUpdate:i,onRemove:s,onCopy:u}))))))),c())))};_n();var lo=j(Z());Un();ez();_t();var AA=j(Z()),Oyr=()=>{let t=an();return AA.default.createElement("div",{className:"tw-space-y-4"},AA.default.createElement("section",null,AA.default.createElement(Pr,{type:"textarea",title:"User System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!",value:t.userSystemPrompt,onChange:e=>Xe("userSystemPrompt",e),placeholder:"Enter your system prompt here..."}),AA.default.createElement("div",{className:"tw-space-y-4"},AA.default.createElement(Pr,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:t.enableEncryption,onCheckedChange:e=>{Xe("enableEncryption",e)}}),AA.default.createElement(Pr,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:t.debug,onCheckedChange:e=>{Xe("debug",e)}}),AA.default.createElement(Pr,{type:"custom",title:"Create Log File",description:`Open the Copilot log file (${Nf.getLogPath()}) for easy sharing when reporting issues.`},AA.default.createElement(me,{variant:"secondary",size:"sm",onClick:async()=>{await Nf.flush(),await Nf.openLogFile()}},"Create Log File")))))};xu();Un();er();dn();fy();_t();var nc=j(Z()),Eyr=require("obsidian"),Pyr=j(Bc());Un();fy();_t();_n();function dJn({onConfirm:t,onCancel:e}){let r=ne();return nc.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},nc.default.createElement("div",null,nc.default.createElement("p",null,"Thanks for purchasing ",nc.default.createElement("b",null,"Copilot Plus"),"! You have unlocked the full power of Copilot, featuring chat context, PDF and image support, exclusive chat and embedding models, and much more!"),nc.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),nc.default.createElement("ul",{className:"tw-pl-4"},nc.default.createElement("li",null,"Default mode: ",nc.default.createElement("b",{className:"tw-text-accent"},"Copilot Plus")),nc.default.createElement("li",null,"Chat model: ",nc.default.createElement("b",{className:"tw-text-accent"},wze)),nc.default.createElement("li",null,nc.default.createElement("div",null,"Embedding model:"," ",nc.default.createElement("b",{className:"tw-text-accent"},xze)),r.embeddingModelKey!==Sze&&nc.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-warning"},nc.default.createElement($p,{className:"tw-size-4"})," It will rebuild your embeddings for the entire vault")))),nc.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},nc.default.createElement(me,{variant:"ghost",onClick:e},"Apply Later"),nc.default.createElement(me,{variant:"default",onClick:t},"Apply Now")))}var twe=class extends Eyr.Modal{constructor(e){super(e),this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:e}=this;this.root=(0,Pyr.createRoot)(e);let r=()=>{iHt(),this.close()},n=()=>{this.close()};this.root.render(nc.default.createElement(dJn,{onConfirm:r,onCancel:n}))}onClose(){this.root.unmount()}};Un();er();fy();_t();_n();var Js=j(Z());function Tyr(){let t=an(),[e,r]=(0,Js.useState)(null),[n,o]=(0,Js.useState)(!1),i=_4(),[a,s]=(0,Js.useState)(t.plusLicenseKey);return(0,Js.useEffect)(()=>{s(t.plusLicenseKey)},[t.plusLicenseKey]),Js.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4 tw-rounded-lg tw-bg-secondary tw-p-4"},Js.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-text-xl tw-font-bold"},Js.default.createElement("span",null,"Copilot Plus"),i&&Js.default.createElement(pp,{variant:"outline",className:"tw-text-success"},"Active")),Js.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-text-sm tw-text-muted"},Js.default.createElement("div",null,"Copilot Plus takes your Obsidian experience to the next level with cutting-edge AI capabilities. This premium tier unlocks advanced features:"," ",Js.default.createElement("strong",null," ","including chat context, PDF and image support, web search integration, exclusive chat and embedding models, and much more.")),Js.default.createElement("div",null,"Copilot Plus is evolving fast, with new features and improvements rolling out regularly. Join now to secure the lowest price and get early access!")),Js.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Js.default.createElement(rE,{className:"tw-w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),Js.default.createElement(me,{disabled:n,onClick:async()=>{Xe("plusLicenseKey",a),o(!0);let u=await pO();o(!1),u?(r(null),new twe(app).open()):r("Invalid license key")},className:"tw-min-w-10 tw-text-xs md:tw-text-sm"},n?Js.default.createElement(iu,{className:"tw-size-2 tw-animate-spin md:tw-size-4"}):"Apply"),Js.default.createElement(me,{className:"tw-text-xs md:tw-text-sm",variant:"secondary",onClick:()=>fD(jE.SETTINGS)},"Join Now ",Js.default.createElement(lD,{className:"tw-size-2 md:tw-size-4"}))),Js.default.createElement("div",{className:"tw-text-error"},e))}kt();_n();var a6=require("obsidian"),yt=j(Z());Un();er();qj();wR();$t();_t();er();var fJn={openai:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"openai"}))||[],google:t=>t.models?.map(e=>{let r=e.name.split("models/")?.[1];return{id:r,name:r,provider:"google"}})||[],anthropic:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"anthropic"}))||[],mistralai:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"mistralai"}))||[],cohereai:t=>t.models?.map(e=>({id:e.name,name:e.name,provider:"cohereai"}))||[],deepseek:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"deepseek"}))||[],groq:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"groq"}))||[],xai:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"xai"}))||[],openrouterai:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"openrouterai"}))||[]},pJn=t=>e=>e.data&&Array.isArray(e.data)?e.data.map(r=>({id:r.id||r.name||String(Math.random()),name:r.name||r.id||r.display_name||"Unknown Model",provider:t})):e.models&&Array.isArray(e.models)?e.models.map(r=>({id:r.id||r.name||String(Math.random()),name:r.name||r.displayName||r.id||"Unknown Model",provider:t})):Array.isArray(e)?e.map(r=>({id:r.id||r.name||String(Math.random()),name:r.name||r.id||"Unknown Model",provider:t})):[],mJn=t=>fJn[t]||pJn(t),Ayr=(t,e)=>{let r=mJn(t);try{return r(e)}catch(n){return console.error(`Error parsing ${t} model data:`,n),[]}};kt();_n();var VN=require("obsidian"),Ir=j(Z()),Iyr=j(Bc());function hJn({onClose:t}){let e=an(),[r,n]=(0,Ir.useState)(null),[o,i]=(0,Ir.useState)({}),[a,s]=(0,Ir.useState)(null),[u,l]=(0,Ir.useState)(null),[c,d]=(0,Ir.useState)(null),[f,p]=(0,Ir.useState)(!1);(0,Ir.useEffect)(()=>{n(null),d(null)},[]);let m=w=>{let S=NE[w];return e[S]??""},h=hCe().map(w=>{let S=w,C=m(S);return{provider:S,apiKey:C}}),y=(w,S)=>{m(w)!==S&&(Xe(NE[w],S),i(E=>({...E,[w]:void 0})),l(E=>E===w?null:E))},g=async(w,S)=>{s(w),l(null);try{S=await Co(S);let C=ME(w).listModelURL,E={Authorization:`Bearer ${S}`};w==="google"?(C+=`?key=${S}`,E={}):w==="anthropic"&&(E={"x-api-key":S,"anthropic-version":"2023-06-01"});let P=async M=>{let D=new AbortController,k=setTimeout(()=>D.abort(),3e3);try{let L=await(M?wu:fetch)(C,{headers:E,signal:D.signal,method:"GET"});if(!L.ok){let H=Fn(await L.json());throw ie(H),new Error(`Failed to fetch models: ${L.statusText}
detail: `+H)}return L}finally{clearTimeout(k)}},T;try{T=await P(!1)}catch(M){console.log("First fetch attempt failed, trying with safeFetch...");try{T=await P(!0)}catch(D){let k=`
without CORS Error: `+Fn(M)+`
with CORS Error: `+Fn(D);throw new Error(k)}}let I=await T.json(),N=Ayr(w,I);i(M=>({...M,[w]:N})),s(null)}catch(C){console.error(`Error fetching models for ${w}:`,C),l(w),s(null),new VN.Notice(`Failed to load models for ${jp(w)}: ${Fn(C)}`,5e3)}},_=async()=>{if(!c){new VN.Notice("Please select a model first");return}p(!0);try{let w=m(c.provider),S={name:c.name,provider:c.provider,apiKey:w,enabled:!0};if(await Wd.instance.getCurrentChainManager().chatModelManager.ping(S),e.activeModels.find(E=>E.name===c.name&&E.provider===c.provider))new VN.Notice(`Model ${c.name} verified successfully! It already exists in your models list.`);else{let E=[...e.activeModels,S];Xe("activeModels",E),new VN.Notice(`Model ${c.name} verified successfully and added to your models list!`)}}catch(w){console.error("Model verification failed:",w),new VN.Notice("Model verification failed: "+Fn(w),1e4)}finally{p(!1)}};return Ir.default.createElement("div",{className:"tw-max-h-[600px] tw-overflow-y-auto tw-p-4 sm:tw-max-w-[500px]"},Ir.default.createElement("div",{className:"tw-mb-4"},Ir.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"AI Provider Settings"),Ir.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Configure your AI providers by adding their API keys.")),Ir.default.createElement("div",{className:"tw-space-y-6 tw-py-4"},Ir.default.createElement("div",{className:"tw-space-y-4"},h.map(w=>Ir.default.createElement(Ir.default.Fragment,{key:w.provider},Ir.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ir.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},Ir.default.createElement("div",{className:"tw-truncate"},jp(w.provider))),Ir.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},Ir.default.createElement("div",{className:"tw-flex-1"},Ir.default.createElement(rE,{className:"tw-max-w-full",value:w.apiKey,onChange:S=>y(w.provider,S)})),Ir.default.createElement("div",{className:""},Ir.default.createElement(me,{onClick:()=>{let S=r===w.provider?null:w.provider;n(S),S&&w.apiKey&&o[w.provider]===void 0&&a!==w.provider&&u!==w.provider&&g(w.provider,w.apiKey)},disabled:!w.apiKey,variant:"secondary",className:"tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-2 tw-whitespace-nowrap tw-px-4 tw-py-2"},"Add Model",r===w.provider?Ir.default.createElement(Gb,{className:"tw-ml-1 tw-size-4"}):Ir.default.createElement($i,{className:"tw-ml-1 tw-size-4"})))),Ir.default.createElement("div",null,ME(w.provider).keyManagementURL&&Ir.default.createElement("a",{href:ME(w.provider).keyManagementURL,target:"_blank",rel:"noopener noreferrer",className:"tw-text-[10px] tw-text-accent hover:tw-text-accent-hover sm:tw-text-xs"},"Get ",jp(w.provider)," Key"))),Ir.default.createElement(cv,{open:r===w.provider,className:"tw-mt-2"},Ir.default.createElement(dv,{className:"tw-rounded-md tw-p-3"},Ir.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ir.default.createElement(Xn,{label:"Model",description:"Add the currently selected model to model List. After adding, please check the Model Tab."},Ir.default.createElement("div",null,Ir.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ir.default.createElement("div",{className:"tw-flex-1"},Ir.default.createElement(lve,{options:o[w.provider]?.sort((S,C)=>S.name.localeCompare(C.name)).map(S=>({label:S.name,value:S.id}))||[],onChange:S=>{let C=S.target.value,E=o[w.provider]?.find(P=>P.id===C);E&&d({id:E.id,name:E.name,provider:w.provider})},onClick:()=>{w.apiKey&&o[w.provider]===void 0&&a!==w.provider&&u!==w.provider&&g(w.provider,w.apiKey)},value:c?.provider===w.provider?c.id:"",placeholder:"Select Model",disabled:!w.apiKey||a===w.provider||u===w.provider&&o[w.provider]!==null})),Ir.default.createElement("div",{className:"tw-w-[72px]"},Ir.default.createElement(me,{onClick:_,disabled:!c||c.provider!==w.provider||f,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},f?Ir.default.createElement(iu,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Add"))),Ir.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},a===w.provider&&Ir.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),u===w.provider&&Ir.default.createElement("div",{className:"tw-p-1 tw-text-error"},"Failed to load models.",o[w.provider]===null&&" Check API Key or network."),o[w.provider]&&o[w.provider].length===0&&Ir.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"No models available for this provider."),o[w.provider]===void 0&&u!==w.provider&&a!==w.provider&&Ir.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Click to load models or expand to try again if API key was changed."))))))))))),Ir.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end"},Ir.default.createElement(me,{onClick:t},"Close")))}var rwe=class extends VN.Modal{constructor(e){super(e)}onOpen(){let{contentEl:e}=this;this.root=(0,Iyr.createRoot)(e),this.root.render(Ir.default.createElement(hJn,{onClose:()=>this.close()}))}onClose(){this.root.unmount()}};var yJn={llm_chain:"Chat",vault_qa:"Vault QA (Basic)",copilot_plus:"Copilot Plus",project:"Projects (alpha)"},Myr=()=>{let t=an(),[e,r]=(0,yt.useState)(!1),[n,o]=(0,yt.useState)(t.defaultConversationNoteName||"{$date}_{$time}__{$topic}"),i=()=>{r(!0);try{let u=n||"{$date}_{$time}__{$topic}",c=["{$date}","{$time}","{$topic}"].filter(y=>!u.includes(y));if(c.length>0){new a6.Notice(`Error: Missing required variables: ${c.join(", ")}`,4e3);return}let d=/[\\/:*?"<>|]/,f=u.replace(/\{\$date}/g,"").replace(/\{\$time}/g,"").replace(/\{\$topic}/g,"");if(d.test(f)){new a6.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:p}=nu(new Date),h=u.replace("{$topic}","test topic name".slice(0,100).replace(/\s+/g,"_")).replace("{$date}",p.split("_")[0]).replace("{$time}",p.split("_")[1]);Xe("defaultConversationNoteName",u),o(u),new a6.Notice(`Format applied successfully! Example: ${h}`,4e3)}catch(u){new a6.Notice(`Error applying format: ${u.message}`,4e3)}finally{r(!1)}},a=!!t.activeModels.find(u=>u.enabled&&Qr(u)===t.defaultModelKey),s=t.activeModels.filter(u=>u.enabled).map(u=>({label:YH(u),value:Qr(u)}));return yt.default.createElement("div",{className:"tw-space-y-4"},yt.default.createElement(Tyr,null),yt.default.createElement("section",null,yt.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"General"),yt.default.createElement("div",{className:"tw-space-y-4"},yt.default.createElement("div",{className:"tw-space-y-4"},yt.default.createElement(Pr,{type:"custom",title:"API Keys",description:yt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},yt.default.createElement("span",{className:"tw-leading-none"},"Configure API keys for different AI providers"),yt.default.createElement(jn,{content:yt.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},yt.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"API key required for chat and QA features"),yt.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"To enable chat and QA functionality, please provide an API key from your selected provider."))}))},yt.default.createElement(me,{onClick:()=>{new rwe(app).open()},variant:"secondary",className:"tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-2 sm:tw-w-auto sm:tw-justify-start"},"Set Keys",yt.default.createElement(q5,{className:"tw-size-4"})))),yt.default.createElement(Pr,{type:"select",title:"Default Chat Model",description:yt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},yt.default.createElement("span",{className:"tw-leading-none"},"Select the Chat model to use"),yt.default.createElement(jn,{content:yt.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},yt.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Default model is OpenRouter Gemini 2.5 Flash"),yt.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"Set your OpenRouter API key in 'API keys' to use this model, or select a different model from another provider."))})),value:a?t.defaultModelKey:"Select Model",onChange:u=>{let l=t.activeModels.find(f=>f.enabled&&Qr(f)===u);if(!l)return;let{hasApiKey:c,errorNotice:d}=sz(l,t);if(!c&&d){new a6.Notice(d);return}Xe("defaultModelKey",u)},options:a?s:[{label:"Select Model",value:"Select Model"},...s],placeholder:"Model"}),yt.default.createElement(Pr,{type:"select",title:"Default Mode",description:yt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},yt.default.createElement("span",{className:"tw-leading-none"},"Select the default chat mode"),yt.default.createElement(jn,{content:yt.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},yt.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},yt.default.createElement("li",null,yt.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",yt.default.createElement("i",null,"Free to use with your own API key.")),yt.default.createElement("li",null,yt.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",yt.default.createElement("i",null,"Free to use with your own API key.")),yt.default.createElement("li",null,yt.default.createElement("strong",null,"Copilot Plus:")," Covers all features of the 2 free modes, plus advanced paid features including chat context menu, advanced search, AI agents, and more. Check out"," ",yt.default.createElement("a",{href:Cze(jE.MODE_SELECT_TOOLTIP),target:"_blank",rel:"noopener noreferrer",className:"tw-text-accent hover:tw-text-accent-hover"},"obsidiancopilot.com")," ","for more details.")))})),value:t.defaultChainType,onChange:u=>Xe("defaultChainType",u),options:Object.entries(yJn).map(([u,l])=>({label:l,value:u}))}),yt.default.createElement(Pr,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:t.defaultOpenArea,onChange:u=>Xe("defaultOpenArea",u),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),yt.default.createElement(Pr,{type:"text",title:"Default Conversation Folder Name",description:"The default folder name where chat conversations will be saved. Default is 'copilot/copilot-conversations'",value:t.defaultSaveFolder,onChange:u=>Xe("defaultSaveFolder",u),placeholder:"copilot/copilot-conversations"}),yt.default.createElement(Pr,{type:"text",title:"Default Conversation Tag",description:"The default tag to be used when saving a conversation. Default is 'ai-conversations'",value:t.defaultConversationTag,onChange:u=>Xe("defaultConversationTag",u),placeholder:"ai-conversations"}),yt.default.createElement(Pr,{type:"custom",title:"Conversation Filename Template",description:yt.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-1.5 "},yt.default.createElement("span",{className:"tw-leading-none"},"Customize the format of saved conversation note names."),yt.default.createElement(jn,{content:yt.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},yt.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Note: All the following variables must be included in the template."),yt.default.createElement("div",null,yt.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-muted"},"Available variables:"),yt.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},yt.default.createElement("li",null,yt.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),yt.default.createElement("li",null,yt.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),yt.default.createElement("li",null,yt.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),yt.default.createElement("i",{className:"tw-mt-2 tw-text-sm tw-text-muted"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]")))}))},yt.default.createElement("div",{className:"tw-flex tw-w-[320px] tw-items-center tw-gap-1.5"},yt.default.createElement(gi,{type:"text",className:he("tw-min-w-[80px] tw-grow tw-transition-all tw-duration-200",e?"tw-w-[80px]":"tw-w-[120px]"),placeholder:"{$date}_{$time}__{$topic}",value:n,onChange:u=>o(u.target.value),disabled:e}),yt.default.createElement(me,{onClick:()=>i(),disabled:e,variant:"secondary"},e?yt.default.createElement(yt.default.Fragment,null,yt.default.createElement(iu,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Apply"):"Apply"))),yt.default.createElement(Pr,{type:"switch",title:"Autosave Chat",description:"Automatically saves the chat after every user message and AI response.",checked:t.autosaveChat,onCheckedChange:u=>Xe("autosaveChat",u)}),yt.default.createElement(Pr,{type:"switch",title:"Generate AI Chat Title on Save",description:"When enabled, uses an AI model to generate a concise title for saved chat notes. When disabled, uses the first 10 words of the first user message.",checked:t.generateAIChatTitleOnSave,onCheckedChange:u=>Xe("generateAIChatTitleOnSave",u)}),yt.default.createElement(Pr,{type:"switch",title:"Include Current Note in Context Menu",description:"Automatically include the current note in the chat context menu by default when sending messages to the AI.",checked:t.includeActiveNoteAsContext,onCheckedChange:u=>{Xe("includeActiveNoteAsContext",u)}}),yt.default.createElement(Pr,{type:"switch",title:"Images in Markdown",description:"Pass embedded images in markdown to the AI along with the text. Only works with multimodal models.",checked:t.passMarkdownImages,onCheckedChange:u=>{Xe("passMarkdownImages",u)}}),yt.default.createElement(Pr,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:t.showSuggestedPrompts,onCheckedChange:u=>Xe("showSuggestedPrompts",u)}),yt.default.createElement(Pr,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:t.showRelevantNotes,onCheckedChange:u=>Xe("showRelevantNotes",u)}))))};Un();er();dn();_t();_n();var iB=require("obsidian"),wo=j(Z());var bv=j(Z());ube();_t();var Ryr=()=>{let t=an(),e=zO.getInstance(),r=new Set(t.autonomousAgentEnabledToolIds||[]),n=e.getToolsByCategory(),o=e.getConfigurableTools(),i=(s,u)=>{let l=new Set(r);u?l.add(s):l.delete(s),Xe("autonomousAgentEnabledToolIds",Array.from(l))},a=()=>Array.from(n.entries()).filter(([u,l])=>l.some(c=>o.includes(c))).map(([u,l])=>{let c=l.filter(d=>o.includes(d));return c.length===0?null:bv.default.createElement(bv.default.Fragment,{key:u},c.map(({metadata:d})=>bv.default.createElement(Pr,{key:d.id,type:"switch",title:d.displayName,description:d.description,checked:r.has(d.id),onCheckedChange:f=>i(d.id,f)})))});return bv.default.createElement(bv.default.Fragment,null,bv.default.createElement(Pr,{type:"slider",title:"Max Iterations",description:"Maximum number of reasoning iterations the autonomous agent can perform. Higher values allow for more complex reasoning but may take longer.",value:t.autonomousAgentMaxIterations??4,onChange:s=>{Xe("autonomousAgentMaxIterations",s)},min:4,max:8,step:1}),bv.default.createElement("div",{className:"tw-mt-4 tw-rounded-lg tw-bg-secondary tw-p-4"},bv.default.createElement("div",{className:"tw-mb-2 tw-text-sm tw-font-medium"},"Agent Accessible Tools"),bv.default.createElement("div",{className:"tw-mb-4 tw-text-xs tw-text-muted"},"Toggle which tools the autonomous agent can use"),bv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},a())))};var Nyr=()=>{let t=an(),e=t.autocompleteAcceptKey||Xg.KEYBIND,[r,n]=(0,wo.useState)(!1),o=[{value:"Tab",label:"Tab"},{value:"Space",label:"Space"},{value:"ArrowRight",label:"Right Arrow"}],i=u=>{Xe("autocompleteAcceptKey",u),new iB.Notice(`Autocomplete accept key set to: ${u}`)},a=()=>{Xe("autocompleteAcceptKey",Xg.KEYBIND),new iB.Notice(`Autocomplete accept key reset to: ${Xg.KEYBIND}`)},s=async()=>{if(!r){n(!0),new iB.Notice("Rebuilding word index...");try{let l=await u$.getInstance(app.vault).rescan(c=>{c.processedFiles===c.totalFiles&&new iB.Notice(`Word index complete! Found ${c.foundWords} words from ${c.processedFiles} files.`)});new iB.Notice(`Word index rebuilt successfully! ${l.wordCount} unique words indexed.`)}catch(u){console.error("Failed to refresh word index:",u),new iB.Notice("Failed to refresh word index. Check console for details.")}finally{n(!1)}}};return wo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},wo.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4"},wo.default.createElement("div",{className:"tw-flex tw-items-center tw-py-4"},wo.default.createElement(pp,{variant:"secondary",className:"tw-text-accent"},"Plus Required")),wo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},wo.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autonomous Agent"),wo.default.createElement(Pr,{type:"switch",title:"Enable Autonomous Agent",description:"Enable autonomous agent mode in Plus chat. The AI will reason step-by-step and decide which tools to use automatically, improving response quality for complex queries.",checked:t.enableAutonomousAgent,onCheckedChange:u=>{Xe("enableAutonomousAgent",u)}}),t.enableAutonomousAgent&&wo.default.createElement(wo.default.Fragment,null,wo.default.createElement(Ryr,null)),wo.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autocomplete"),wo.default.createElement(Pr,{type:"switch",title:"Sentence Autocomplete",description:wo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},wo.default.createElement("span",{className:"tw-leading-none"},"Enable AI-powered sentence autocomplete suggestions while typing")),checked:t.enableAutocomplete,onCheckedChange:u=>Xe("enableAutocomplete",u)}),wo.default.createElement(Pr,{type:"switch",title:"Word Completion",description:"Suggest completions for partially typed words based on your vault's content. Requires at least 3 characters to trigger.",checked:t.enableWordCompletion,onCheckedChange:u=>{Xe("enableWordCompletion",u)}}),wo.default.createElement(Pr,{type:"custom",title:"Word Index Management",description:"Rebuild the word index to include new words from your vault. The index is automatically built when the plugin loads."},wo.default.createElement(me,{onClick:s,disabled:r,className:"tw-flex tw-items-center tw-gap-2"},wo.default.createElement(Jv,{className:he("tw-size-4",r&&"tw-animate-spin")}),r?"Rebuilding...":"Refresh Word Index")),wo.default.createElement(Pr,{type:"custom",title:"Autocomplete Accept Suggestion Key",description:wo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},wo.default.createElement("span",{className:"tw-leading-none"},"The key used to accept autocomplete suggestions"),wo.default.createElement(jn,{content:wo.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},wo.default.createElement("div",{className:"tw-text-sm tw-text-muted"},'Select the key you want to use for accepting suggestions. Default is "Tab".'))}))},wo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},wo.default.createElement(LN,{value:e,onValueChange:i},wo.default.createElement(CA,{className:"tw-w-[180px]"},wo.default.createElement(FN,{placeholder:"Select key"})),wo.default.createElement(OA,null,o.map(u=>wo.default.createElement(EA,{key:u.value,value:u.value},u.label)))),e&&e!==Xg.KEYBIND&&wo.default.createElement(me,{variant:"ghost",onClick:a,className:"tw-h-8 tw-text-xs"},"Reset to Default"))),wo.default.createElement(Pr,{type:"switch",title:"Allow Additional Context",description:"Allow the AI to access relevant notes to provide more relevant suggestions. When off, the AI can only see the current note context.",checked:t.allowAdditionalContext,onCheckedChange:u=>{Xe("allowAdditionalContext",u)}}))))};er();fF();wR();$t();_t();var rt=j(Z());_t();er();kt();var vX=require("obsidian");Un();_n();var ZKe=({open:t,onOpenChange:e,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=JV(),a=ne(),s=o?"openai":"openai",[u,l]=(0,rt.useState)(null),[c,d]=(0,rt.useState)(!1),[f,p]=(0,rt.useState)(!1),[m,h]=(0,rt.useState)({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1}),y=(F,Q)=>{h(ee=>({...ee,[F]:Q}))},g=()=>{h({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1})},_=()=>{let F=!0,Q={...m};return Q.name=!C.name,C.name||(F=!1),C.provider==="azure openai"&&(Q.instanceName=!C.azureOpenAIApiInstanceName,Q.apiVersion=!C.azureOpenAIApiVersion,o?(Q.embeddingDeploymentName=!C.azureOpenAIApiEmbeddingDeploymentName,C.azureOpenAIApiEmbeddingDeploymentName||(F=!1)):(Q.deploymentName=!C.azureOpenAIApiDeploymentName,C.azureOpenAIApiDeploymentName||(F=!1)),(!C.azureOpenAIApiInstanceName||!C.azureOpenAIApiVersion)&&(F=!1)),h(Q),F},w=F=>a[NE[F]]||"",S=(F=s)=>{let Q={name:"",provider:F,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:w(F),isEmbeddingModel:o,capabilities:[]};return o?Q:{...Q,stream:!0}},[C,E]=(0,rt.useState)(S()),P=F=>({...F,name:F.name?.trim(),baseUrl:F.baseUrl?.trim(),apiKey:F.apiKey?.trim(),openAIOrgId:F.openAIOrgId?.trim(),azureOpenAIApiInstanceName:F.azureOpenAIApiInstanceName?.trim(),azureOpenAIApiDeploymentName:F.azureOpenAIApiDeploymentName?.trim(),azureOpenAIApiEmbeddingDeploymentName:F.azureOpenAIApiEmbeddingDeploymentName?.trim(),azureOpenAIApiVersion:F.azureOpenAIApiVersion?.trim()}),[T,I]=(0,rt.useState)(ME(s)),N=()=>!!(C.name&&C.provider),M=()=>f||!N(),D=()=>{if(!_()){new vX.Notice("Please fill in all required fields");return}let F=P(C);r(F),e(!1),E(S()),g()},k=F=>{I(ME(F)),E({...C,provider:F,apiKey:w(F),...F==="openai"?{openAIOrgId:a.openAIOrgId}:{},...F==="azure openai"?{azureOpenAIApiInstanceName:a.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:a.azureOpenAIApiDeploymentName,azureOpenAIApiVersion:a.azureOpenAIApiVersion,azureOpenAIApiEmbeddingDeploymentName:a.azureOpenAIApiEmbeddingDeploymentName}:{}})},L=F=>{F||(E(S()),g(),d(!1)),e(F)},H=async()=>{if(!_()){new vX.Notice("Please fill in all required fields");return}p(!0);try{let F=P(C);await n(F),new vX.Notice("Model verification successful!")}catch(F){console.error(F);let Q=Fn(F);new vX.Notice("Model verification failed: "+Q)}finally{p(!1)}},K=()=>{let Q=(()=>{switch(C.provider){case"openai":return rt.default.createElement(Xn,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},rt.default.createElement(gi,{type:"text",placeholder:"Enter OpenAI Organization ID if applicable",value:C.openAIOrgId||"",onChange:ee=>E({...C,openAIOrgId:ee.target.value})}));case"azure openai":return rt.default.createElement(rt.default.Fragment,null,rt.default.createElement(Xn,{label:"Instance Name",required:!0,error:m.instanceName,errorMessage:"Instance name is required"},rt.default.createElement(gi,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:C.azureOpenAIApiInstanceName||"",onChange:ee=>{E({...C,azureOpenAIApiInstanceName:ee.target.value}),y("instanceName",!1)}})),o?rt.default.createElement(Xn,{label:"Embedding Deployment Name",required:!0,error:m.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},rt.default.createElement(gi,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:C.azureOpenAIApiEmbeddingDeploymentName||"",onChange:ee=>{E({...C,azureOpenAIApiEmbeddingDeploymentName:ee.target.value}),y("embeddingDeploymentName",!1)}})):rt.default.createElement(Xn,{label:"Deployment Name",required:!0,error:m.deploymentName,errorMessage:"Deployment name is required",description:"This is your actual model, no need to pass a model name separately."},rt.default.createElement(gi,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:C.azureOpenAIApiDeploymentName||"",onChange:ee=>{E({...C,azureOpenAIApiDeploymentName:ee.target.value}),y("deploymentName",!1)}})),rt.default.createElement(Xn,{label:"API Version",required:!0,error:m.apiVersion,errorMessage:"API version is required"},rt.default.createElement(gi,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:C.azureOpenAIApiVersion||"",onChange:ee=>{E({...C,azureOpenAIApiVersion:ee.target.value}),y("apiVersion",!1)}})));default:return null}})();return Q?rt.default.createElement(cv,{open:c,onOpenChange:d,className:"tw-space-y-2 tw-rounded-lg tw-border tw-pt-4"},rt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},rt.default.createElement(om,null,"Additional ",jp(C.provider)," Settings"),rt.default.createElement(gA,{asChild:!0},rt.default.createElement(me,{variant:"ghost",size:"sm",className:"tw-w-9 tw-p-0"},rt.default.createElement($i,{className:"tw-size-4"}),rt.default.createElement("span",{className:"tw-sr-only"},"Toggle")))),rt.default.createElement(dv,{className:"tw-max-h-[200px] tw-space-y-4 tw-overflow-y-auto tw-pb-0.5 tw-pl-0.5 tw-pr-2"},Q)):null},G=()=>{if(C.provider!=="azure openai")return T.host;let F=C.azureOpenAIApiInstanceName||"[instance]",Q=o?C.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":C.azureOpenAIApiDeploymentName||"[deployment]",ee=C.azureOpenAIApiVersion||"[api-version]";return`https://${F}.openai.azure.com/openai/deployments/${Q}/${o?"embeddings":"chat/completions"}?api-version=${ee}`},X=Object.entries(sI).map(([F,Q])=>({id:F,label:F.charAt(0).toUpperCase()+F.slice(1),description:Q}));return rt.default.createElement(Qve,{open:t,onOpenChange:L},rt.default.createElement(gX,{className:"sm:tw-max-w-[425px]",container:i,ref:F=>l(F)},rt.default.createElement(yX,null,rt.default.createElement(bX,null,"Add Custom ",o?"Embedding":"Chat"," Model"),rt.default.createElement(_X,null,"Add a new model to your collection.")),rt.default.createElement("div",{className:"tw-space-y-3"},rt.default.createElement(Xn,{label:"Model Name",required:!0,error:m.name,errorMessage:"Model name is required"},rt.default.createElement(gi,{type:"text",placeholder:`Enter model name (e.g. ${o?"text-embedding-3-small":"gpt-4"})`,value:C.name,onChange:F=>{E({...C,name:F.target.value}),y("name",!1)}})),rt.default.createElement(Xn,{label:rt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},rt.default.createElement("span",{className:"tw-leading-none"},"Display Name"),rt.default.createElement(jn,{content:rt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},rt.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),rt.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),rt.default.createElement("div",{className:"tw-text-[12px]"},"Example:",rt.default.createElement("li",null,"Direct-Paid:Ds-r1"),rt.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),rt.default.createElement("li",null,"Perplexity-Paid:lg"))),contentClassName:"tw-max-w-96"}))},rt.default.createElement(gi,{type:"text",placeholder:"Custom display name (optional)",value:C.displayName||"",onChange:F=>{E({...C,displayName:F.target.value})}})),rt.default.createElement(Xn,{label:"Provider"},rt.default.createElement(LN,{value:C.provider,onValueChange:k},rt.default.createElement(CA,null,rt.default.createElement(FN,{placeholder:"Select provider"})),rt.default.createElement(OA,{container:u},Object.values(o?w8(oI,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):w8(RE,["COPILOT_PLUS"])).map(F=>rt.default.createElement(EA,{key:F,value:F},jp(F)))))),rt.default.createElement(Xn,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},rt.default.createElement(gi,{type:"text",placeholder:G()||"https://api.example.com/v1",value:C.baseUrl||"",onChange:F=>E({...C,baseUrl:F.target.value})})),rt.default.createElement(Xn,{label:"API Key"},rt.default.createElement(rE,{placeholder:`Enter ${T.label} API Key`,value:C.apiKey||"",onChange:F=>E({...C,apiKey:F})}),T.keyManagementURL&&rt.default.createElement("p",{className:"tw-text-xs tw-text-muted"},rt.default.createElement("a",{href:T.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",T.label," API Key"))),rt.default.createElement(Xn,{label:rt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},rt.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),rt.default.createElement(jn,{content:rt.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality"),contentClassName:"tw-max-w-96"}))},rt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},X.map(({id:F,label:Q,description:ee})=>rt.default.createElement("div",{key:F,className:"tw-flex tw-items-center tw-gap-2"},rt.default.createElement(hu,{id:F,checked:C.capabilities?.includes(F),onCheckedChange:U=>{let z=C.capabilities||[];E({...C,capabilities:U?[...z,F]:z.filter(V=>V!==F)})}}),rt.default.createElement(jn,{content:ee},rt.default.createElement(om,{htmlFor:F,className:"tw-text-sm"},Q)))))),K()),rt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-4"},rt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},rt.default.createElement(hu,{id:"enable-cors",checked:C.enableCors||!1,onCheckedChange:F=>E({...C,enableCors:F})}),rt.default.createElement(om,{htmlFor:"enable-cors"},rt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-0.5"},rt.default.createElement("span",{className:"tw-text-xs md:tw-text-sm"},"CORS"),rt.default.createElement(jn,{content:rt.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only check this option when prompted that CORS is needed"),contentClassName:"tw-max-w-96"})))),rt.default.createElement("div",{className:"tw-flex tw-gap-2 tw-text-xs md:tw-text-sm"},rt.default.createElement(me,{variant:"secondary",onClick:D,disabled:M()},"Add Model"),rt.default.createElement(me,{variant:"secondary",onClick:H,disabled:M()},f?rt.default.createElement(rt.default.Fragment,null,rt.default.createElement(iu,{className:"tw-mr-2 tw-size-2 tw-animate-spin md:tw-size-4 "}),"Verify"):"Verify")))))};er();_t();kt();var owe=require("obsidian"),Ke=j(Z()),jyr=j(Bc());var Hi=j(Z());Un();_n();function aB(t){let{label:e,helpText:r,disableFn:n,optional:o=!0}=t,i=t.type,a=o?t.value!==void 0:!0,[s,u]=(0,Hi.useState)(a),l=()=>{o&&(u(!s),s?n?.():i==="slider"?t.onChange(t.value??t.defaultValue??0):t.onChange(t.value??t.defaultValue??t.options[0]?.value??""))},c=f=>{s&&i==="slider"&&t.onChange(f[0])},d=f=>{s&&i==="select"&&t.onChange(f)};return Hi.default.createElement("div",{className:"tw-space-y-3"},Hi.default.createElement(YO,{delayDuration:0},Hi.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},Hi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Hi.default.createElement("span",{className:`tw-font-medium ${s?"tw-text-normal":"tw-text-muted"}`},e),r&&Hi.default.createElement(jn,{buttonClassName:"tw-size-4 tw-text-muted",content:Hi.default.createElement("div",{className:"tw-max-w-[300px]"},r)})),Hi.default.createElement("div",{className:`tw-flex tw-items-center ${o?"tw-gap-3":"tw-gap-0"}`},Hi.default.createElement("span",{className:`tw-min-w-8 tw-text-right tw-font-mono tw-text-sm ${s?"tw-text-normal":"tw-text-muted"}`},s?t.value??t.defaultValue:"\u2014"),o&&Hi.default.createElement(Zn,null,Hi.default.createElement(Yn,{asChild:!0},Hi.default.createElement(me,{variant:"ghost2",size:"sm",onClick:l,className:`tw-size-8 tw-p-0 ${s?"tw-text-accent/80 hover:tw-text-accent":"tw-text-muted hover:tw-text-normal"}`},s?Hi.default.createElement(Z5,{className:"tw-size-4"}):Hi.default.createElement(J5,{className:"tw-size-4"}))),Hi.default.createElement(Hn,{side:"bottom"},Hi.default.createElement("span",null,s?"Disable parameters":"Enable parameters")))))),Hi.default.createElement("div",{className:"tw-relative"},i==="slider"?Hi.default.createElement(Hi.default.Fragment,null,Hi.default.createElement(WY,{value:[s?t.value??t.defaultValue??0:t.min??0],onValueChange:c,min:t.min??0,max:t.max??1,step:t.step,disabled:!s,className:`tw-w-full ${s?"":"tw-opacity-40"}`}),!s&&o&&Hi.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-cursor-not-allowed tw-rounded"})):Hi.default.createElement(LN,{value:s?t.value??t.defaultValue??t.options[0]?.value:void 0,onValueChange:d,disabled:!s},Hi.default.createElement(CA,{className:`tw-w-full ${s?"":"tw-opacity-40"}`},Hi.default.createElement(FN,{placeholder:"Select an option"})),Hi.default.createElement(OA,null,t.options.map(f=>Hi.default.createElement(EA,{key:f.value,value:f.value},f.label))))))}var bJn=({model:t,onUpdate:e,onCancel:r,isEmbeddingModel:n})=>{let[o,i]=(0,Ke.useState)(t),[a,s]=(0,Ke.useState)(t),[u,l]=(0,Ke.useState)({}),c=ne(),d=w=>c[NE[w]]||"";(0,Ke.useEffect)(()=>{i(t),s(t),t.provider&&l(ME(t.provider))},[t]);let f=(0,Ke.useMemo)(()=>Ree((w,S)=>{e(n,w,S)},500),[n,e]),p=(0,Ke.useCallback)((w,S)=>{i(C=>{let E={...C,[w]:S};return f(a,E),E})},[a,f]),m=(0,Ke.useCallback)(w=>{i(S=>{let C={...S};return delete C[w],f(a,C),C})},[f,a]);if(!o)return null;let h=()=>{if(!o||!o.provider||o.provider!=="azure-openai")return u.host||"https://api.example.com/v1";let w=o.azureOpenAIApiInstanceName||"[instance]",S=o.isEmbeddingModel?o.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":o.azureOpenAIApiDeploymentName||"[deployment]",C=o.azureOpenAIApiVersion||"[api-version]",E=o.isEmbeddingModel?"embeddings":"chat/completions";return`https://${w}.openai.azure.com/openai/deployments/${S}/${E}?api-version=${C}`},y=Object.entries(sI).map(([w,S])=>({id:w,label:w.charAt(0).toUpperCase()+w.slice(1),description:S})),g=o.apiKey||d(o.provider),_=!n&&o.provider!=="copilot-plus-jina";return Ke.default.createElement("div",{className:"tw-space-y-3 tw-p-4"},Ke.default.createElement("div",{className:"tw-mb-4"},Ke.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"Model Settings - ",o.name),Ke.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Customize model parameters")),Ke.default.createElement("div",{className:"tw-space-y-3"},Ke.default.createElement(Xn,{label:"Model Name",required:!0},Ke.default.createElement(gi,{type:"text",disabled:o.core,value:o.name,onChange:w=>p("name",w.target.value),placeholder:"Enter model name"})),Ke.default.createElement(Xn,{label:Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ke.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Ke.default.createElement(jn,{content:Ke.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Ke.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Ke.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Ke.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Ke.default.createElement("li",null,"Direct-Paid:Ds-r1"),Ke.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Ke.default.createElement("li",null,"Perplexity-Paid:lg"))),contentClassName:"tw-max-w-96"}))},Ke.default.createElement(gi,{type:"text",placeholder:"Custom display name (optional)",value:o.displayName||"",onChange:w=>p("displayName",w.target.value)})),Ke.default.createElement(Xn,{label:"Provider"},Ke.default.createElement(gi,{type:"text",value:jp(o.provider),disabled:!0})),Ke.default.createElement(Xn,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Ke.default.createElement(gi,{type:"text",placeholder:h(),value:o.baseUrl||"",onChange:w=>p("baseUrl",w.target.value)})),Ke.default.createElement(Xn,{label:"API Key"},Ke.default.createElement(rE,{placeholder:`Enter ${u.label||"Provider"} API Key`,value:g,onChange:w=>p("apiKey",w)}),u.keyManagementURL&&Ke.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Ke.default.createElement("a",{href:u.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",u.label," API Key"))),_&&Ke.default.createElement(Ke.default.Fragment,null,Ke.default.createElement(Xn,{label:Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ke.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Ke.default.createElement(jn,{content:Ke.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality"),contentClassName:"tw-max-w-96"}))},Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},y.map(({id:w,label:S,description:C})=>Ke.default.createElement("div",{key:w,className:"tw-flex tw-items-center tw-gap-2"},Ke.default.createElement(hu,{id:w,checked:o.capabilities?.includes(w),onCheckedChange:E=>{let P=o.capabilities||[],T=E?[...P,w]:P.filter(I=>I!==w);p("capabilities",T)}}),Ke.default.createElement(jn,{content:C},Ke.default.createElement(om,{htmlFor:w,className:"tw-text-sm"},S)))))),Ke.default.createElement(Xn,null,Ke.default.createElement(aB,{type:"slider",optional:!1,label:"Token limit",value:o.maxTokens??c.maxTokens,onChange:w=>p("maxTokens",w),max:65e3,min:0,step:100,defaultValue:Df.MAX_TOKENS,helpText:Ke.default.createElement(Ke.default.Fragment,null,Ke.default.createElement("p",null,"The maximum number of ",Ke.default.createElement("em",null,"output tokens")," to generate. Default is"," ",Df.MAX_TOKENS,"."),Ke.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model."))})),Ke.default.createElement(Xn,null,Ke.default.createElement(aB,{type:"slider",optional:!1,label:"Temperature",value:o.temperature??c.temperature,onChange:w=>p("temperature",w),max:2,min:0,step:.05,defaultValue:Df.TEMPERATURE,helpText:`Default is ${Df.TEMPERATURE}. Higher values will result in more creativeness, but also more mistakes. Set to 0 for no randomness.`})),Ke.default.createElement(Xn,null,Ke.default.createElement(aB,{type:"slider",label:"Top-P",value:o.topP,onChange:w=>p("topP",w),disableFn:()=>m("topP"),max:1,min:0,step:.05,defaultValue:.9,helpText:"Default value is 0.9, the smaller the value, the less variety in the answers, the easier to understand, the larger the value, the larger the range of the AI's vocabulary, the more diverse"})),Ke.default.createElement(Xn,null,Ke.default.createElement(aB,{type:"slider",label:"Frequency Penalty",value:o.frequencyPenalty,onChange:w=>p("frequencyPenalty",w),disableFn:()=>m("frequencyPenalty"),max:2,min:0,step:.05,defaultValue:0,helpText:Ke.default.createElement(Ke.default.Fragment,null,Ke.default.createElement("p",null,"The frequency penalty parameter tells the model not to repeat a word that has already been used multiple times in the conversation."),Ke.default.createElement("em",null,"The higher the value, the more the model is penalized for repeating words."))})),o.provider==="openai"&&(o.name.startsWith("gpt-5")||o.name.startsWith("o1")||o.name.startsWith("o3")||o.name.startsWith("o4"))&&Ke.default.createElement(Ke.default.Fragment,null,Ke.default.createElement(Xn,null,Ke.default.createElement(aB,{type:"select",label:"Reasoning Effort",value:o.reasoningEffort,onChange:w=>p("reasoningEffort",w),disableFn:()=>m("reasoningEffort"),defaultValue:c.reasoningEffort??Df.REASONING_EFFORT,options:[...o.name.startsWith("gpt-5")?[{value:"minimal",label:"Minimal"}]:[],{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],helpText:Ke.default.createElement(Ke.default.Fragment,null,Ke.default.createElement("p",null,"Controls the amount of reasoning effort the model uses. Higher effort provides more thorough reasoning but takes longer. Note: thinking tokens are not available yet!"),Ke.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},Ke.default.createElement("li",null,"Minimal: Fastest responses, minimal reasoning (GPT-5 only)"),Ke.default.createElement("li",null,"Low: Faster responses, basic reasoning (default)"),Ke.default.createElement("li",null,"Medium: Balanced performance"),Ke.default.createElement("li",null,"High: Thorough reasoning, slower responses")))})),o.name.startsWith("gpt-5")&&Ke.default.createElement(Xn,null,Ke.default.createElement(aB,{type:"select",label:"Verbosity",value:o.verbosity,onChange:w=>p("verbosity",w),disableFn:()=>m("verbosity"),defaultValue:c.verbosity??Df.VERBOSITY,options:[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],helpText:Ke.default.createElement(Ke.default.Fragment,null,Ke.default.createElement("p",null,"Controls the length and detail of the model responses."),Ke.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},Ke.default.createElement("li",null,"Low: Concise, brief responses"),Ke.default.createElement("li",null,"Medium: Balanced detail"),Ke.default.createElement("li",null,"High: Detailed, comprehensive responses")))}))))))},nwe=class extends owe.Modal{constructor(r,n,o,i){super(r);this.model=n;this.isEmbeddingModel=o;this.onUpdate=i}onOpen(){let{contentEl:r,modalEl:n}=this;owe.Platform.isMobile&&(n.style.height="80%"),this.root=(0,jyr.createRoot)(r);let o=(a,s,u)=>{this.onUpdate(a,s,u)},i=()=>{this.close()};this.root.render(Ke.default.createElement(bJn,{model:this.model,isEmbeddingModel:this.isEmbeddingModel,onUpdate:o,onCancel:i}))}onClose(){this.root.unmount()}};Un();er();dn();_t();kt();_n();var st=j(Z());var _Jn={reasoning:{icon:JE,color:"tw-text-model-capabilities-blue",tooltip:sI.reasoning},vision:{icon:GE,color:"tw-text-model-capabilities-green",tooltip:sI.vision},websearch:{icon:Zb,color:"tw-text-model-capabilities-blue",tooltip:sI.websearch}},vJn=["reasoning","vision","websearch"],wJn=({title:t,onRefresh:e,onAdd:r})=>st.default.createElement("div",{className:"tw-mb-3 tw-flex tw-flex-col tw-gap-2 md:tw-flex-row md:tw-items-center md:tw-justify-between"},st.default.createElement("h3",{className:"tw-text-xl tw-font-bold"},t),st.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-end"},e&&st.default.createElement(me,{onClick:e,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},st.default.createElement(Jv,{className:"tw-size-2 md:tw-size-4"}),"Refresh Built-ins"),st.default.createElement(me,{onClick:r,variant:"default",className:"tw-flex tw-items-center tw-gap-2"},st.default.createElement(Wh,{className:"tw-size-2 md:tw-size-4"}),"Add Model"))),xJn=t=>st.default.createElement("div",{className:"tw-mx-auto tw-grid tw-w-16 tw-grid-cols-3 tw-gap-1"},vJn.map(e=>{let r=_Jn[e];if(!r)return st.default.createElement("div",{key:e,className:"tw-w-4"});let n=r.icon;return t.capabilities?.includes(e)?st.default.createElement(jn,{key:e,content:r.tooltip,side:"bottom"},st.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},st.default.createElement(n,{className:he("tw-size-4",r.color)}))):st.default.createElement("div",{key:e,className:"tw-flex tw-items-center tw-justify-center"},st.default.createElement("div",{className:"tw-size-4"}))})),SJn=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,id:i,containerRef:a})=>{let s=[];e&&s.push({icon:st.default.createElement(Qz,{className:"tw-size-4"}),label:"Edit",onClick:e}),r&&!t.core&&s.push({icon:st.default.createElement(Bm,{className:"tw-size-4"}),label:"Copy",onClick:r}),t.core||s.push({icon:st.default.createElement(qm,{className:"tw-size-4"}),label:"Delete",onClick:()=>n(Qr(t)),variant:"destructive"});let u=st.default.createElement("div",{className:"tw-flex tw-justify-around"},!t.isEmbeddingModel&&st.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},st.default.createElement("span",{className:"tw-text-sm"},"Enabled"),st.default.createElement(hu,{checked:t.enabled,onCheckedChange:l=>o({...t,enabled:l})})),st.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},st.default.createElement("span",{className:"tw-text-sm"},"CORS"),st.default.createElement(hu,{checked:t.enableCors,onCheckedChange:l=>o({...t,enableCors:l})})));return st.default.createElement(Zve,{id:i,item:t,title:t.displayName||t.name,subtitle:jp(t.provider,t),badge:t.capabilities&&t.capabilities.length>0?st.default.createElement(N8e,{capabilities:t.capabilities,iconSize:14}):void 0,isDraggable:!t.core,isExpandable:!0,expandedContent:u,primaryAction:e?{icon:st.default.createElement(eU,{className:"tw-size-4"}),onClick:e,tooltip:"Edit Model"}:void 0,dropdownActions:s,containerRef:a})},CJn=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,isEmbeddingModel:i,containerRef:a})=>{let{attributes:s,listeners:u,setNodeRef:l,transform:c,transition:d,isDragging:f}=o6({id:Qr(t),disabled:t.core}),p={transform:Cb.Transform.toString(c),transition:d},m=e||!t.core||r&&!t.core;return st.default.createElement(qN,{ref:l,style:p,className:he("tw-transition-colors tw-duration-200 hover:tw-bg-interactive-accent/10",f&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50 tw-bg-primary/90")},st.default.createElement(gp,{className:"tw-w-6 tw-px-2"},!t.core&&st.default.createElement(me,{variant:"ghost",size:"icon",className:"tw-size-6 tw-cursor-grab tw-touch-none tw-p-0 hover:tw-cursor-grab active:tw-cursor-grabbing",...s,...u},st.default.createElement(Yb,{className:"tw-size-4 tw-transition-colors"}))),st.default.createElement(gp,{className:"tw-pl-0"},t.displayName||t.name),st.default.createElement(gp,null,jp(t.provider,t)),st.default.createElement(gp,null,xJn(t)),!i&&st.default.createElement(gp,{className:"tw-text-center"},st.default.createElement(hu,{id:`${Qr(t)}-enabled`,checked:t.enabled,onCheckedChange:h=>o({...t,enabled:h}),className:"tw-mx-auto"})),st.default.createElement(gp,{className:"tw-text-center"},st.default.createElement(hu,{id:`${Qr(t)}-enableCors`,checked:t.enableCors,onCheckedChange:h=>o({...t,enableCors:h}),className:"tw-mx-auto"})),st.default.createElement(gp,{className:"tw-text-center"},st.default.createElement("div",{className:"tw-flex tw-justify-center tw-gap-2"},e&&st.default.createElement(me,{variant:"ghost",size:"icon",onClick:()=>e(t),className:"tw-shadow-sm tw-transition-shadow hover:tw-shadow-md"},st.default.createElement(eU,{className:"tw-size-4"})),m&&st.default.createElement(JO,null,st.default.createElement(ZO,{asChild:!0},st.default.createElement(me,{variant:"ghost",size:"icon"},st.default.createElement(Gv,{className:"tw-size-4"}))),st.default.createElement(wh,{align:"end",container:a.current},e&&st.default.createElement(so,{onClick:()=>e(t)},st.default.createElement(Qz,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&st.default.createElement(so,{onClick:()=>r(t)},st.default.createElement(Bm,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&st.default.createElement(so,{onClick:()=>n(Qr(t)),className:"tw-text-error"},st.default.createElement(qm,{className:"tw-mr-2 tw-size-4"}),"Delete"))))))},YKe=({models:t,onEdit:e,onCopy:r,onDelete:n,onAdd:o,onUpdateModel:i,onReorderModels:a,onRefresh:s,title:u})=>{let l=!!(t.length>0&&t[0].isEmbeddingModel),c=Uve(QV(UN),QV(zN,{coordinateGetter:Jve})),d=(0,st.useRef)(null),f=t.findIndex(y=>!y.core),p=y=>g=>{let{transform:_,active:w,activeNodeRect:S,over:C}=g;if(!w||!S)return _;let E=t.findIndex(M=>Qr(M)===w.id),P=t.filter(M=>!M.core).length,T=S.height,I=(f-E)*T,N=(f+P-1-E)*T;if(y&&C){let M=t.findIndex(k=>Qr(k)===C.id);if(t[M].core||M<f)return{..._,x:0,y:0}}return{..._,x:0,y:Math.min(Math.max(I,_.y),N)}},m=y=>{let{active:g,over:_}=y;if(_&&g.id!==_.id){let w=t.findIndex(P=>Qr(P)===g.id),S=t.findIndex(P=>Qr(P)===_.id),C=t[S];if(S<f||C.core)return;let E=Gve(t,w,S);a?.(E)}},h=()=>st.default.createElement("div",{className:"tw-relative md:tw-hidden"},st.default.createElement(t6,{sensors:c,collisionDetection:e6,onDragEnd:m,modifiers:[p(!0)],autoScroll:{enabled:!0,acceleration:10,threshold:{x:0,y:.2}}},st.default.createElement(n6,{items:t.map(y=>Qr(y)),strategy:r6},st.default.createElement("div",{className:"tw-relative tw-touch-auto tw-space-y-2 tw-overflow-auto tw-pb-2"},t.map(y=>st.default.createElement(SJn,{key:Qr(y),id:Qr(y),containerRef:d,model:y,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i}))))));return st.default.createElement("div",{ref:d,className:"tw-mb-4"},st.default.createElement(wJn,{title:u,onRefresh:s,onAdd:o}),st.default.createElement("div",{className:"tw-hidden md:tw-block"},st.default.createElement(t6,{sensors:c,collisionDetection:e6,onDragEnd:m,modifiers:[p(!1)]},st.default.createElement("div",{className:"tw-relative tw-overflow-hidden"},st.default.createElement(fX,null,st.default.createElement(pX,null,st.default.createElement(qN,null,st.default.createElement(fm,{className:"tw-w-6 tw-px-2"}),st.default.createElement(fm,{className:"tw-pl-0"},"Model"),st.default.createElement(fm,null,"Provider"),st.default.createElement(fm,{className:"tw-text-center"},"Capabilities"),!l&&st.default.createElement(fm,{className:"tw-text-center"},"Enable"),st.default.createElement(fm,{className:"tw-text-center"},"CORS"),st.default.createElement(fm,{className:"tw-w-[100px] tw-text-center"},"Actions"))),st.default.createElement(mX,{className:"tw-relative"},st.default.createElement(n6,{items:t.map(y=>Qr(y)),strategy:r6},t.map(y=>st.default.createElement(CJn,{key:Qr(y),containerRef:d,model:y,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i,isEmbeddingModel:l})))))))),h())};kt();var iwe=require("obsidian"),Dg=j(Z()),Dyr=()=>{let t=an(),[e,r]=(0,Dg.useState)(!1),[n,o]=(0,Dg.useState)(!1),i=(h,y=!1)=>{let g={...w8(h,["isBuiltIn","core","projectEnabled","plusExclusive","believerExclusive","capabilities","displayName","dimensions"]),name:`${h.name} (copy)`},_=y?"activeEmbeddingModels":"activeModels";Xe(_,[...t[_],g])},a=(h,y=!1)=>{Xe(y?"activeEmbeddingModels":"activeModels",h)},s=h=>{let[y,g]=h.split("|"),_=t.activeModels.filter(S=>!(S.name===y&&S.provider===g)),w=t.defaultModelKey;if(h===t.defaultModelKey){let S=_.find(C=>C.enabled);w=S?`${S.name}|${S.provider}`:""}AE({activeModels:_,defaultModelKey:w})},u=(h,y,g)=>{let _=h?"activeEmbeddingModels":"activeModels",w=t[_].findIndex(S=>S.name===y.name&&S.provider===y.provider);if(w!==-1){let S=[...t[_]];S[w]=g,Xe(_,S)}else new iwe.Notice("Could not find model to update"),ie("Could not find model to update:",y)},l=h=>{let y=t.activeModels.map(g=>g.name===h.name&&g.provider===h.provider?h:g);Xe("activeModels",y)},c=h=>{let[y,g]=h.split("|"),_=t.activeEmbeddingModels.filter(w=>!(w.name===y&&w.provider===g));Xe("activeEmbeddingModels",_)},d=h=>{let y=t.activeEmbeddingModels.map(g=>g.name===h.name&&g.provider===h.provider?h:g);Xe("activeEmbeddingModels",y)},f=()=>{let h=t.activeModels.filter(g=>!g.isBuiltIn),y=[...jv,...h];Xe("activeModels",y),new iwe.Notice("Chat models refreshed successfully")},p=()=>{let h=t.activeEmbeddingModels.filter(g=>!g.isBuiltIn),y=[...Lj,...h];Xe("activeEmbeddingModels",y),new iwe.Notice("Embedding models refreshed successfully")},m=(h,y=!1)=>{new nwe(app,h,y,u).open()};return Dg.default.createElement("div",{className:"tw-space-y-4"},Dg.default.createElement("section",null,Dg.default.createElement(YKe,{models:t.activeModels,onEdit:h=>m(h),onCopy:h=>i(h),onDelete:s,onAdd:()=>r(!0),onUpdateModel:l,onReorderModels:h=>a(h),onRefresh:f,title:"Chat Models"}),Dg.default.createElement(ZKe,{open:e,onOpenChange:r,onAdd:h=>{let y=[...t.activeModels,h];Xe("activeModels",y)},ping:h=>Wd.instance.getCurrentChainManager().chatModelManager.ping(h)}),Dg.default.createElement("div",{className:"tw-space-y-4"},Dg.default.createElement(Pr,{type:"slider",title:"Conversation turns in context",description:"The number of previous conversation turns to include in the context. Default is 15 turns, i.e. 30 messages.",value:t.contextTurns,onChange:h=>Xe("contextTurns",h),min:1,max:50,step:1}))),Dg.default.createElement("section",null,Dg.default.createElement(YKe,{models:t.activeEmbeddingModels,onEdit:h=>m(h,!0),onDelete:c,onCopy:h=>i(h,!0),onAdd:()=>o(!0),onUpdateModel:d,onReorderModels:h=>a(h,!0),onRefresh:p,title:"Embedding Models"}),Dg.default.createElement(ZKe,{open:n,onOpenChange:o,onAdd:h=>{let y=[...t.activeEmbeddingModels,h];Xe("activeEmbeddingModels",y)},isEmbeddingModel:!0,ping:h=>Ru.getInstance().ping(h)})))};var Byr=require("obsidian");Un();var Vn=j(Z()),zyr=j(Bc());Yp();_n();var Lyr=require("obsidian"),Tb=j(Z()),Fyr=j(Bc());Un();function OJn({onConfirm:t,onCancel:e}){let[r,n]=(0,Tb.useState)(""),[o,i]=(0,Tb.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),t(u)};return Tb.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Tb.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Tb.default.createElement(gi,{placeholder:"Enter the extension (e.g. txt, excalidraw.md)",value:r,onChange:u=>{n(u.target.value),i(null)},onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),u.stopPropagation(),a(r))}}),o&&Tb.default.createElement("p",{className:"tw-text-sm tw-text-error"},o)),Tb.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Tb.default.createElement(me,{variant:"secondary",onClick:e},"Cancel"),Tb.default.createElement(me,{variant:"default",onClick:()=>a(r)},"Confirm")))}var awe=class extends Lyr.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,Fyr.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(Tb.default.createElement(OJn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var kyr=require("obsidian"),_v=j(Z()),$yr=j(Bc());Un();function EJn({onConfirm:t,onCancel:e}){let[r,n]=(0,_v.useState)("");return _v.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},_v.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},_v.default.createElement("div",null,"Comma separated list of paths, tags, note titles or file extension e.g. folder1, folder1/folder2, #tag1, #tag2, [[note1]], [[note2]], *.jpg, *.excallidraw.md"),_v.default.createElement(gi,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&t(r)}})),_v.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},_v.default.createElement(me,{variant:"secondary",onClick:e},"Cancel"),_v.default.createElement(me,{variant:"default",onClick:()=>t(r)},"Confirm")))}var swe=class extends kyr.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,$yr.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(_v.default.createElement(EJn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};function uwe({title:t,patterns:e,onRemove:r}){return Vn.default.createElement("div",{className:"tw-grid tw-grid-cols-4 tw-gap-2"},Vn.default.createElement("div",{className:"tw-font-bold"},t),Vn.default.createElement("ul",{className:"tw-col-span-3 tw-m-0 tw-flex tw-list-inside tw-list-disc tw-flex-col tw-gap-1 tw-pl-0"},e.map(n=>Vn.default.createElement("li",{key:n,className:"tw-flex tw-gap-2 tw-rounded-md tw-pl-2 tw-pr-1 hover:tw-bg-dropdown-hover"},Vn.default.createElement(Eh,{className:"tw-flex-1"},n),Vn.default.createElement(me,{variant:"ghost2",size:"fit",onClick:()=>r(n)},Vn.default.createElement(_i,{className:"tw-size-4"}))))))}function PJn({value:t,onUpdate:e,container:r}){let[n,o]=(0,Vn.useState)(t),i=ah(n),{tagPatterns:a,extensionPatterns:s,folderPatterns:u,notePatterns:l}=p4(i),c=f=>{let p=m4({tagPatterns:f.tagPatterns??a,extensionPatterns:f.extensionPatterns??s,folderPatterns:f.folderPatterns??u,notePatterns:f.notePatterns??l});o(p),e(p)},d=a.length>0||s.length>0||u.length>0||l.length>0;return Vn.default.createElement("div",{className:"tw-mt-2 tw-flex tw-flex-col tw-gap-4"},Vn.default.createElement("div",{className:"tw-flex tw-max-h-[400px] tw-flex-col tw-gap-2 tw-overflow-y-auto tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-4"},!d&&Vn.default.createElement("div",{className:"tw-text-center tw-text-sm"},"No patterns specified"),a.length>0&&Vn.default.createElement(uwe,{title:"Tags",patterns:a,onRemove:f=>{let p=a.filter(m=>m!==f);c({tagPatterns:p})}}),s.length>0&&Vn.default.createElement(uwe,{title:"Extensions",patterns:s,onRemove:f=>{let p=s.filter(m=>m!==f);c({extensionPatterns:p})}}),u.length>0&&Vn.default.createElement(uwe,{title:"Folders",patterns:u,onRemove:f=>{let p=u.filter(m=>m!==f);c({folderPatterns:p})}}),l.length>0&&Vn.default.createElement(uwe,{title:"Notes",patterns:l,onRemove:f=>{let p=l.filter(m=>m!==f);c({notePatterns:p})}})),Vn.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Vn.default.createElement(JO,null,Vn.default.createElement(ZO,{asChild:!0},Vn.default.createElement(me,{variant:"secondary"},"Add...")),Vn.default.createElement(wh,{align:"start",container:r},Vn.default.createElement(so,{onSelect:()=>{new TV(app,f=>{let p=pG(f);a.includes(p)||c({tagPatterns:[...a,p]})}).open()}},Vn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Vn.default.createElement($I,{className:"tw-size-4"}),"Tag")),Vn.default.createElement(so,{onSelect:()=>{new PV(app,f=>{u.includes(f)||c({folderPatterns:[...u,f]})}).open()}},Vn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Vn.default.createElement(cy,{className:"tw-size-4"}),"Folder")),Vn.default.createElement(so,{onSelect:()=>{new wN({app,onNoteSelect:f=>{let p=h4(f);l.includes(p)||c({notePatterns:[...l,p]})},excludeNotePaths:[],titleOnly:!0}).open()}},Vn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Vn.default.createElement(zm,{className:"tw-size-4"}),"Note")),Vn.default.createElement(so,{onSelect:()=>{new awe(app,f=>{let p=bze(f);s.includes(p)||c({extensionPatterns:[...s,p]})}).open()}},Vn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Vn.default.createElement(B5,{className:"tw-size-4"}),"Extension")),Vn.default.createElement(so,{onSelect:()=>{new swe(app,f=>{let p=ah(f),{tagPatterns:m,extensionPatterns:h,folderPatterns:y,notePatterns:g}=p4(p);c({tagPatterns:[...a,...m],extensionPatterns:[...s,...h],folderPatterns:[...u,...y],notePatterns:[...l,...g]})}).open()}},Vn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Vn.default.createElement(YE,{className:"tw-size-4"}),"Custom"))))))}var wX=class extends Byr.Modal{constructor(r,n,o,i){super(r);this.onUpdate=n;this.value=o;this.setTitle(i)}onOpen(){let{contentEl:r}=this;this.root=(0,zyr.createRoot)(r);let n=o=>{this.onUpdate(o)};this.root.render(Vn.default.createElement(PJn,{value:this.value,onUpdate:n,container:this.contentEl}))}onClose(){this.root.unmount()}};var lwe=class extends Yl{constructor(e,r){super(e,r,"Changing this setting means you have to rebuild the index for your entire vault, do you wish to proceed?","Rebuild Index")}};var cwe=class extends Yl{constructor(e,r,n){let o=n?`Semantic search requires building an embedding index for your vault.
Use 'Refresh Vault Index' or 'Force Reindex Vault' commands to build the index after enabling. Pick your embedding model below.`:`Disabling semantic search will fall back to index-free lexical search (less resource-intensive, could be less accurate).
Your existing index will be preserved but not used.`,i=n?"Enable Semantic Search":"Disable Semantic Search",a=n?"Enable":"Disable";super(e,r,o,i,a,"Cancel")}};Un();er();_t();var Uyr=require("obsidian"),ur=j(Z()),qyr=()=>{let t=an(),e=async r=>{if(r!==t.embeddingModelKey){if(t.enableSemanticSearchV3){new lwe(app,async()=>{Xe("embeddingModelKey",r),await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().indexVaultToVectorStore(!1)}).open();return}Xe("embeddingModelKey",r),new Uyr.Notice("Embedding model saved. Enable Semantic Search to build the index.")}};return ur.default.createElement("div",{className:"tw-space-y-4"},ur.default.createElement("section",null,ur.default.createElement("div",{className:"tw-space-y-4"},ur.default.createElement(Pr,{type:"switch",title:"Enable Inline Citations (experimental)",description:"When enabled, AI responses will include footnote-style citations within the text and numbered sources at the end (This is an experimental feature and may not work as expected for all models.)",checked:t.enableInlineCitations,onCheckedChange:r=>Xe("enableInlineCitations",r)}),ur.default.createElement(Pr,{type:"switch",title:"Enable Semantic Search",description:"Enable semantic search for meaning-based document retrieval. When disabled, uses fast lexical search only. Use 'Refresh Vault Index' or 'Force Reindex Vault' to build the embedding index.",checked:t.enableSemanticSearchV3,onCheckedChange:r=>{new cwe(app,async()=>{Xe("enableSemanticSearchV3",r),r&&await(await Promise.resolve().then(()=>(Sc(),Vd))).default.getInstance().indexVaultToVectorStore(!1)},r).open()}}),ur.default.createElement(Pr,{type:"select",title:"Embedding Model",description:ur.default.createElement("div",{className:"tw-space-y-2"},ur.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ur.default.createElement("span",{className:"tw-font-medium tw-leading-none tw-text-accent"},"Powers Semantic Vault Search and Relevant Notes. Enable Semantic Search to use it."),ur.default.createElement(jn,{content:ur.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},ur.default.createElement("div",{className:"tw-pt-2 tw-text-sm tw-text-muted"},"This model converts text into vector representations, essential for semantic search and Question Answering (QA) functionality. Changing the embedding model will:"),ur.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},ur.default.createElement("li",null,"Require rebuilding your vault's vector index"),ur.default.createElement("li",null,"Affect semantic search quality"),ur.default.createElement("li",null,"Impact Question Answering feature performance")))}))),value:t.embeddingModelKey,onChange:e,options:t.activeEmbeddingModels.map(r=>({label:YH(r),value:Qr(r)})),placeholder:"Model"}),ur.default.createElement(Pr,{type:"select",title:"Auto-Index Strategy",description:ur.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ur.default.createElement("span",{className:"tw-leading-none"},"Decide when you want the vault to be indexed."),ur.default.createElement(jn,{content:ur.default.createElement("div",{className:"tw-space-y-2 tw-py-2"},ur.default.createElement("div",{className:"tw-space-y-1"},ur.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Choose when to index your vault:"),ur.default.createElement("ul",{className:"tw-list-disc tw-space-y-1 tw-pl-2 tw-text-sm"},ur.default.createElement("li",null,ur.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},ur.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"NEVER:"),ur.default.createElement("span",null,"Manual indexing via command or refresh only"))),ur.default.createElement("li",null,ur.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},ur.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON STARTUP:"),ur.default.createElement("span",null,"Index updates when plugin loads or reloads"))),ur.default.createElement("li",null,ur.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},ur.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON MODE SWITCH:"),ur.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),ur.default.createElement("p",{className:"tw-text-sm tw-text-callout-warning"},"Warning: Cost implications for large vaults with paid models"))})),value:t.indexVaultToVectorStore,onChange:r=>{Xe("indexVaultToVectorStore",r)},options:ott.map(r=>({label:r,value:r})),placeholder:"Strategy"}),ur.default.createElement(Pr,{type:"slider",title:"Max Sources",description:"Copilot goes through your vault to find relevant notes and passes the top N to the LLM. Default for N is 15. Increase if you want more notes included in the answer generation step.",min:1,max:128,step:1,value:t.maxSourceChunks,onChange:r=>Xe("maxSourceChunks",r)}),t.enableSemanticSearchV3&&ur.default.createElement(ur.default.Fragment,null,ur.default.createElement(Pr,{type:"slider",title:"Requests per Minute",description:"Default is 60. Decrease if you are rate limited by your embedding provider.",min:10,max:60,step:10,value:Math.min(t.embeddingRequestsPerMin,60),onChange:r=>Xe("embeddingRequestsPerMin",r)}),ur.default.createElement(Pr,{type:"slider",title:"Embedding Batch Size",description:"Default is 16. Increase if you are rate limited by your embedding provider.",min:1,max:128,step:1,value:t.embeddingBatchSize,onChange:r=>Xe("embeddingBatchSize",r)}),ur.default.createElement(Pr,{type:"select",title:"Number of Partitions",description:"Number of partitions for Copilot index. Default is 1. Increase if you have issues indexing large vaults. Warning: Changes require clearing and rebuilding the index!",value:String(t.numPartitions||1),onChange:r=>Xe("numPartitions",Number(r)),options:[{label:"1",value:"1"},{label:"2",value:"2"},{label:"4",value:"4"},{label:"8",value:"8"},{label:"16",value:"16"},{label:"32",value:"32"},{label:"40",value:"40"}],placeholder:"Select partitions"})),ur.default.createElement(Pr,{type:"slider",title:"Lexical Search RAM Limit",description:"Maximum RAM usage for full-text search index. Lower values use less memory but may limit search performance on large vaults. Default is 100 MB.",min:20,max:1e3,step:20,value:t.lexicalSearchRamLimit||100,onChange:r=>Xe("lexicalSearchRamLimit",r),suffix:" MB"}),ur.default.createElement(Pr,{type:"switch",title:"Enable Folder and Graph Boosts",description:"Enable folder and graph-based relevance boosts for lexical search results. When disabled, provides pure keyword-based relevance scoring without folder or connection-based adjustments.",checked:t.enableLexicalBoosts,onCheckedChange:r=>Xe("enableLexicalBoosts",r)}),ur.default.createElement(Pr,{type:"custom",title:"Exclusions",description:ur.default.createElement(ur.default.Fragment,null,ur.default.createElement("p",null,"Exclude folders, tags, note titles or file extensions from being indexed. Previously indexed files will remain until a force re-index is performed."))},ur.default.createElement(me,{variant:"secondary",onClick:()=>new wX(app,r=>Xe("qaExclusions",r),t.qaExclusions,"Manage Exclusions").open()},"Manage")),ur.default.createElement(Pr,{type:"custom",title:"Inclusions",description:ur.default.createElement("p",null,"Index only the specified paths, tags, or note titles. Exclusions take precedence over inclusions. Previously indexed files will remain until a force re-index is performed.")},ur.default.createElement(me,{variant:"secondary",onClick:()=>new wX(app,r=>Xe("qaInclusions",r),t.qaInclusions,"Manage Inclusions").open()},"Manage")),ur.default.createElement(Pr,{type:"switch",title:"Enable Obsidian Sync for Copilot index",description:"If enabled, store the semantic index in .obsidian so it syncs with Obsidian Sync. If disabled, store it under .copilot/ at the vault root.",checked:t.enableIndexSync,onCheckedChange:r=>Xe("enableIndexSync",r)}),ur.default.createElement(Pr,{type:"switch",title:"Disable index loading on mobile",description:"When enabled, Copilot index won't be loaded on mobile devices to save resources. Only chat mode will be available. Any existing index from desktop sync will be preserved. Uncheck to enable QA modes on mobile.",checked:t.disableIndexOnMobile,onCheckedChange:r=>Xe("disableIndexOnMobile",r)}))))};var Vyr=["basic","model","QA","command","plus","advanced"],TJn={basic:lo.default.createElement(M5,{className:"tw-size-5"}),model:lo.default.createElement(R5,{className:"tw-size-5"}),QA:lo.default.createElement(KE,{className:"tw-size-5"}),command:lo.default.createElement(FI,{className:"tw-size-5"}),plus:lo.default.createElement(Uf,{className:"tw-size-5"}),advanced:lo.default.createElement(YE,{className:"tw-size-5"})},AJn={basic:()=>lo.default.createElement(Myr,null),model:()=>lo.default.createElement(Dyr,null),QA:()=>lo.default.createElement(qyr,null),command:()=>lo.default.createElement(Cyr,null),plus:()=>lo.default.createElement(Nyr,null),advanced:()=>lo.default.createElement(Oyr,null)},Hyr=Vyr.map(t=>({id:t,icon:TJn[t],label:t.charAt(0).toUpperCase()+t.slice(1)})),IJn=()=>{let{selectedTab:t,setSelectedTab:e}=JV();return lo.default.createElement("div",{className:"tw-flex tw-flex-col"},lo.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-rounded-lg"},Hyr.map((r,n)=>lo.default.createElement(Hhr,{key:r.id,tab:r,isSelected:t===r.id,onClick:()=>e(r.id),isFirst:n===0,isLast:n===Hyr.length-1}))),lo.default.createElement("div",{className:"tw-w-full tw-border tw-border-solid"}),lo.default.createElement("div",null,Vyr.map(r=>{let n=AJn[r];return lo.default.createElement(Vhr,{key:r,id:r,isSelected:t===r},lo.default.createElement(n,null))})))},MJn=({plugin:t})=>{let[e,r]=lo.default.useState(0),{latestVersion:n,hasUpdate:o}=q_e(t.manifest.version),i=async()=>{new Nve(app,async()=>{eCe(),r(s=>s+1)}).open()};return lo.default.createElement(Khr,null,lo.default.createElement("div",null,lo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},lo.default.createElement("h1",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},lo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},lo.default.createElement("span",null,"Copilot Settings"),lo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},lo.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"v",t.manifest.version),n&&lo.default.createElement(lo.default.Fragment,null,o?lo.default.createElement("a",{href:"obsidian://show-plugin?id=copilot",target:"_blank",rel:"noopener noreferrer",className:"tw-text-xs tw-text-accent hover:tw-underline"},"(Update to v",n,")"):lo.default.createElement("span",{className:"tw-text-xs tw-text-normal"}," (up to date)")))),lo.default.createElement("div",{className:"tw-self-end sm:tw-self-auto"},lo.default.createElement(me,{variant:"secondary",size:"sm",onClick:i},"Reset Settings")))),lo.default.createElement(IJn,{key:e})))},Wyr=MJn;var XKe=j(Z()),Kyr=(0,XKe.createContext)(null);var dwe=class extends xX.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}async reloadPlugin(){try{this.app.workspace.getLeavesOfType(js)[0]?.view&&ne().autosaveChat&&await this.plugin.autosaveCurrentChat();let r=this.plugin.app;await r.plugins.disablePlugin("copilot"),await r.plugins.enablePlugin("copilot"),r.setting.openTabById("copilot").display(),new xX.Notice("Plugin reloaded successfully.")}catch(e){new xX.Notice("Failed to reload the plugin. Please reload manually."),console.error("Error reloading plugin:",e)}}display(){let{containerEl:e}=this;e.empty(),e.style.userSelect="text";let r=e.createDiv("div");(0,Gyr.createRoot)(r).render(QKe.default.createElement(Kyr.Provider,{value:e},QKe.default.createElement(Wyr,{plugin:this.plugin})))}};_t();$t();var fwe=class{constructor(e){this.chatManager=e;this.listeners=new Set;this.chatManager.setOnMessageCreatedCallback(()=>{this.notifyListeners()})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notifyListeners(){this.listeners.forEach(e=>{try{e()}catch(r){B("[ChatUIState] Error in listener:",r)}})}async sendMessage(e,r,n,o=!1,i){let a=await this.chatManager.sendMessage(e,r,n,o,i);return this.notifyListeners(),a}async editMessage(e,r,n,o=!1){let i=await this.chatManager.editMessage(e,r,n,o);return i&&this.notifyListeners(),i}async regenerateMessage(e,r,n){let o=await this.chatManager.regenerateMessage(e,r,i=>{n(i),this.notifyListeners()},()=>{this.notifyListeners()});return o&&this.notifyListeners(),o}async deleteMessage(e){let r=await this.chatManager.deleteMessage(e);return r&&this.notifyListeners(),r}addDisplayMessage(e,r,n){let o=this.chatManager.addDisplayMessage(e,r,n);return this.notifyListeners(),o}addFullMessage(e){let r=this.chatManager.addFullMessage(e);return this.notifyListeners(),r}clearMessages(){this.chatManager.clearMessages(),this.notifyListeners()}async truncateAfterMessageId(e){await this.chatManager.truncateAfterMessageId(e),this.notifyListeners()}getMessages(){return this.chatManager.getDisplayMessages()}getMessage(e){return this.chatManager.getMessage(e)}getLLMMessage(e){return this.chatManager.getLLMMessage(e)}getLLMMessages(){return this.chatManager.getLLMMessages()}get chatHistory(){return this.getMessages()}addMessage(e){e.isVisible?e.sources||e.content?this.addFullMessage(e):this.addDisplayMessage(e.message,e.sender,e.id):this.addFullMessage(e)}clearChatHistory(){this.clearMessages()}replaceMessages(e){this.chatManager.loadMessages(e),this.notifyListeners()}getDebugInfo(){return this.chatManager.getDebugInfo()}async loadMessages(e){await this.chatManager.loadMessages(e),this.notifyListeners()}async handleProjectSwitch(){await this.chatManager.handleProjectSwitch(),this.notifyListeners()}async saveChat(e){await this.chatManager.saveChat(e)}};Kde();Y6e();var IA=require("obsidian");obe();var pwe=class extends IA.Plugin{constructor(){super(...arguments);this.userMessageHistory=[]}async onload(){await this.loadSettings(),this.settingsUnsubscriber=oa(async(i,a)=>{a.enableEncryption?await this.saveData(await Ett(a)):await this.saveData(a),B8e(this,i,a)}),this.addSettingTab(new dwe(this.app,this)),lbe(this.app.vault),this.brevilabsClient=Zi.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),pO(),this.projectManager=Wd.getInstance(this.app,this),this.vectorStoreManager=KP.getInstance(),this.fileParserManager=new vR(this.brevilabsClient,this.app.vault);let r=new GV,n=this.projectManager.getCurrentChainManager(),o=new Rve(r,n,this.fileParserManager,this);this.chatUIState=new fwe(o),this.registerView(js,i=>new $N(i,this)),this.registerView(x7,i=>new vye(i)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",i=>{this.activateView()}),B8e(this,void 0,ne()),this.registerMarkdownCodeBlockProcessor(XH,(i,a)=>{qhr({plugin:this,element:a}),a.parentElement&&(a.parentElement.className="")}),o$.initTools(this.app.vault),this.registerEvent(this.app.workspace.on("editor-menu",i=>khr(i))),this.registerEvent(this.app.workspace.on("active-leaf-change",i=>{if(i&&i.view instanceof IA.MarkdownView&&i.view.file){let s=this.app.workspace.getLeavesOfType(js).find(u=>u.view instanceof $N)?.view;if(s){let u=new CustomEvent(Qg.ACTIVE_LEAF_CHANGE);s.eventTarget.dispatchEvent(u)}}})),this.autocompleteService=Sbe.getInstance(this),this.customCommandRegister=new Ive(this,this.app.vault),this.app.workspace.onLayoutReady(()=>{this.customCommandRegister.initialize().then(Bhr).then(zhr)})}async onunload(){this.projectManager&&this.projectManager.onunload(),this.customCommandRegister.cleanup(),this.settingsUnsubscriber?.(),this.autocompleteService?.destroy(),await Nf.flush(),B("Copilot plugin unloaded")}updateUserMessageHistory(r){this.userMessageHistory=[...this.userMessageHistory,r]}async autosaveCurrentChat(){if(ne().autosaveChat){let r=this.app.workspace.getLeavesOfType(js)[0]?.view;r&&await r.saveChat()}}async processText(r,n,o,i=!0){let a=await r.getSelection();this.app.workspace.getLeavesOfType(js).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(js).find(l=>l.view instanceof $N)?.view;if(u&&(!i||a)){let l=new CustomEvent(n,{detail:{selectedText:a,eventSubtype:o}});u.eventTarget.dispatchEvent(l)}},0)}processSelection(r,n,o){this.processText(r,n,o)}emitChatIsVisible(){let r=this.app.workspace.getLeavesOfType(js).find(n=>n.view instanceof $N)?.view;if(r){let n=new CustomEvent(Qg.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===js&&this.emitChatIsVisible()}))}getCurrentEditorOrDummy(){let r=this.app.workspace.getActiveViewOfType(IA.MarkdownView);return{getSelection:()=>{let n=r?.editor?.getSelection();if(n)return n;let o=this.app.workspace.getActiveFile();return o?this.app.vault.cachedRead(o):""},replaceSelection:r?.editor?.replaceSelection.bind(r.editor)||(()=>{})}}processCustomPrompt(r,n){let o=this.getCurrentEditorOrDummy();this.processText(o,r,n,!1)}toggleView(){this.app.workspace.getLeavesOfType(js).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(js);r.length===0?ne().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:js,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:js,active:!0}):this.app.workspace.revealLeaf(r[0]),this.emitChatIsVisible()}async deactivateView(){this.app.workspace.detachLeavesOfType(js)}async loadSettings(){let r=await this.loadData(),n=tCe(r);AE(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=Qr(i),s=o.get(a);s?o.set(a,{...i,isBuiltIn:s.isBuiltIn||i.isBuiltIn}):o.set(a,i)}),Array.from(o.values())}async loadCopilotChatHistory(){let r=await this.getChatHistoryFiles();if(r.length===0){new IA.Notice("No chat history found.");return}new Ave(this.app,r,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=this.app.vault.getAbstractFileByPath(ne().defaultSaveFolder);if(!(r instanceof IA.TFolder))return[];let o=(await this.app.vault.getMarkdownFiles()).filter(s=>s.path.startsWith(r.path)),a=Su()?.id;if(a){let s=`${a}__`;return o.filter(u=>u.basename.startsWith(s))}else return o.filter(s=>!s.basename.match(/^[a-zA-Z0-9-]+__/))}async loadChatHistory(r){await this.autosaveCurrentChat();let n=await this.app.vault.read(r),o=nir(n),i=this.app.workspace.getLeavesOfType(js)[0];i||this.activateView(),await this.chatUIState.loadMessages(o);let a=(i||this.app.workspace.getLeavesOfType(js)[0])?.view;a&&a.updateView()}async handleNewChat(){await this.autosaveCurrentChat();let r=this.app.workspace.getLeavesOfType(js)[0];if(r){let n=r.view,o=new CustomEvent(Qg.ABORT_STREAM,{detail:{reason:"new-chat"}});n.eventTarget.dispatchEvent(o)}this.chatUIState.clearMessages(),r?r.view.updateView():await this.activateView()}async newChat(){await this.handleNewChat()}async customSearchDB(r,n,o){return(await(ne().enableSemanticSearchV3?new(await Promise.resolve().then(()=>(CG(),Zde))).HybridRetriever({minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o}):new(await Promise.resolve().then(()=>(g7(),fye))).TieredLexicalRetriever(this.app,{minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o,timeRange:void 0,returnAll:!1,useRerankerThreshold:void 0})).getRelevantDocuments(r)).map(u=>({content:u.pageContent,metadata:u.metadata}))}};
/*! Bundled license information:
@langchain/core/dist/utils/fast-json-patch/src/helpers.js:
(*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017-2022 Joachim Wester
* MIT licensed
*)
@langchain/core/dist/utils/fast-json-patch/src/duplex.js:
(*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2013-2021 Joachim Wester
* MIT license
*)
mustache/mustache.mjs:
(*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*)
react/cjs/react.production.min.js:
(**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
moment/moment.js:
(*! moment.js *)
(*! version : 2.29.4 *)
(*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
(*! license : MIT *)
(*! momentjs.com *)
ieee754/index.js:
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
buffer/index.js:
(*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*)
scheduler/cjs/scheduler.production.min.js:
(**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react-dom/cjs/react-dom.production.min.js:
(**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react/cjs/react-jsx-runtime.production.min.js:
(**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/shared/src/utils.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/defaultAttributes.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/Icon.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/createLucideIcon.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/arrow-big-up.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/arrow-right.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/bot.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/brain.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/check.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/chevron-down.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/chevron-right.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/chevron-up.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-alert.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-check-big.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-dashed.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-help.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-plus.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-stop.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-x.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/cog.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/command.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/copy.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/corner-down-left.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/cpu.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/database.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/download.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/ellipsis-vertical.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/ellipsis.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/external-link.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/eye-off.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/eye.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-audio.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-image.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-input.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-output.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-text.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-video.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/folder.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/globe.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/grip-vertical.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/history.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/image.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/key.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/library-big.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/lightbulb.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/loader-circle.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/message-circle-plus.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/message-square.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/pen-line.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/pen.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/pencil-line.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/pencil.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/plus.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/refresh-ccw.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/refresh-cw.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/rotate-ccw.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/rotate-cw.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/search.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/sparkles.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/square-arrow-out-up-right.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/square-pen.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/tag.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/text-cursor-input.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/trash-2.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/triangle-alert.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/wrench.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/x.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/zap-off.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/zap.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/lucide-react.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
tslib/tslib.es6.js:
(*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** *)
safe-buffer/index.js:
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
@langchain/core/dist/utils/js-sha1/hash.js:
(*
* [js-sha1]{@link https://github.com/emn178/js-sha1}
*
* @version 0.6.0
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
*)
@langchain/core/dist/utils/js-sha256/hash.js:
(**
* [js-sha256]{@link https://github.com/emn178/js-sha256}
*
* @version 0.11.1
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2025
* @license MIT
*)
@google/generative-ai/dist/index.mjs:
(**
* @license
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*)
crypto-js/ripemd160.js:
(** @preserve
(c) 2012 by Cédric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*)
crypto-js/mode-ctr-gladman.js:
(** @preserve
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*)
*/
/* nosourcemap */